comparison mercurial/localrepo.py @ 2899:bee4b7abcb01

Merge with crew
author Matt Mackall <mpm@selenic.com>
date Mon, 14 Aug 2006 14:42:15 -0500
parents 3d6efcbbd1c9
children 05257fd28591
comparison
equal deleted inserted replaced
2898:06c05c675a35 2899:bee4b7abcb01
1 # localrepo.py - read/write repository class for mercurial 1 # localrepo.py - read/write repository class for mercurial
2 # 2 #
3 # Copyright 2005 Matt Mackall <mpm@selenic.com> 3 # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com>
4 # 4 #
5 # This software may be used and distributed according to the terms 5 # This software may be used and distributed according to the terms
6 # of the GNU General Public License, incorporated herein by reference. 6 # of the GNU General Public License, incorporated herein by reference.
7 7
8 from node import * 8 from node import *
196 if local: 196 if local:
197 self.opener('localtags', 'a').write('%s %s\n' % (node, name)) 197 self.opener('localtags', 'a').write('%s %s\n' % (node, name))
198 self.hook('tag', node=node, tag=name, local=local) 198 self.hook('tag', node=node, tag=name, local=local)
199 return 199 return
200 200
201 for x in self.changes(): 201 for x in self.status()[:5]:
202 if '.hgtags' in x: 202 if '.hgtags' in x:
203 raise util.Abort(_('working copy of .hgtags is changed ' 203 raise util.Abort(_('working copy of .hgtags is changed '
204 '(please commit .hgtags manually)')) 204 '(please commit .hgtags manually)'))
205 205
206 self.wfile('.hgtags', 'ab').write('%s %s\n' % (node, name)) 206 self.wfile('.hgtags', 'ab').write('%s %s\n' % (node, name))
500 if update_dirstate: 500 if update_dirstate:
501 self.dirstate.update([f], "n") 501 self.dirstate.update([f], "n")
502 except IOError: 502 except IOError:
503 try: 503 try:
504 del m1[f] 504 del m1[f]
505 del m1[f]
506 if update_dirstate: 505 if update_dirstate:
507 self.dirstate.forget([f]) 506 self.dirstate.forget([f])
508 except: 507 except:
509 # deleted from p2? 508 # deleted from p2?
510 pass 509 pass
531 elif s == 'r': 530 elif s == 'r':
532 remove.append(f) 531 remove.append(f)
533 else: 532 else:
534 self.ui.warn(_("%s not tracked!\n") % f) 533 self.ui.warn(_("%s not tracked!\n") % f)
535 else: 534 else:
536 modified, added, removed, deleted, unknown = self.changes(match=match) 535 modified, added, removed, deleted, unknown = self.status(match=match)[:5]
537 commit = modified + added 536 commit = modified + added
538 remove = removed 537 remove = removed
539 538
540 p1, p2 = self.dirstate.parents() 539 p1, p2 = self.dirstate.parents()
541 c1 = self.changelog.read(p1) 540 c1 = self.changelog.read(p1)
749 748
750 # sort and return results: 749 # sort and return results:
751 for l in modified, added, removed, deleted, unknown, ignored, clean: 750 for l in modified, added, removed, deleted, unknown, ignored, clean:
752 l.sort() 751 l.sort()
753 return (modified, added, removed, deleted, unknown, ignored, clean) 752 return (modified, added, removed, deleted, unknown, ignored, clean)
754
755 def changes(self, node1=None, node2=None, files=[], match=util.always,
756 wlock=None, list_ignored=False, list_clean=False):
757 '''DEPRECATED - use status instead'''
758 marduit = self.status(node1, node2, files, match, wlock,
759 list_ignored, list_clean)
760 if list_ignored:
761 return marduit[:-1]
762 else:
763 return marduit[:-2]
764 753
765 def add(self, list, wlock=None): 754 def add(self, list, wlock=None):
766 if not wlock: 755 if not wlock:
767 wlock = self.wlock() 756 wlock = self.wlock()
768 for f in list: 757 for f in list: