comparison mercurial/localrepo.py @ 6707:02bad34230a2

localrepo: hide commit() file selection behind workingctx
author Patrick Mezard <pmezard@gmail.com>
date Wed, 18 Jun 2008 22:52:25 +0200
parents 716a1296e182
children 7566f00a3979
comparison
equal deleted inserted replaced
6706:716a1296e182 6707:02bad34230a2
489 return filelog.filelog(self.sopener, f) 489 return filelog.filelog(self.sopener, f)
490 490
491 def changectx(self, changeid=None): 491 def changectx(self, changeid=None):
492 return context.changectx(self, changeid) 492 return context.changectx(self, changeid)
493 493
494 def workingctx(self, parents=None): 494 def workingctx(self, parents=None, changes=None):
495 return context.workingctx(self, parents) 495 return context.workingctx(self, parents, changes)
496 496
497 def parents(self, changeid=None): 497 def parents(self, changeid=None):
498 ''' 498 '''
499 get list of changectxs for parents of changeid or working directory 499 get list of changectxs for parents of changeid or working directory
500 ''' 500 '''
775 775
776 if (not force and p2 != nullid and 776 if (not force and p2 != nullid and
777 (match and (match.files() or match.anypats()))): 777 (match and (match.files() or match.anypats()))):
778 raise util.Abort(_('cannot partially commit a merge ' 778 raise util.Abort(_('cannot partially commit a merge '
779 '(do not specify files or patterns)')) 779 '(do not specify files or patterns)'))
780
781 if files:
782 modified, removed = [], []
783 for f in files:
784 s = self.dirstate[f]
785 if s in 'nma':
786 modified.append(f)
787 elif s == 'r':
788 removed.append(f)
789 else:
790 self.ui.warn(_("%s not tracked!\n") % f)
791 changes = [modified, [], removed, [], []]
792 else:
793 changes = self.status(match=match)
780 else: 794 else:
781 p1, p2 = p1, p2 or nullid 795 p1, p2 = p1, p2 or nullid
782 update_dirstate = (self.dirstate.parents()[0] == p1) 796 update_dirstate = (self.dirstate.parents()[0] == p1)
783 797 changes = [files, [], [], [], []]
784 wctx = self.workingctx((p1, p2)) 798
785 799 wctx = self.workingctx((p1, p2), changes)
786 if use_dirstate: 800 commit = wctx.modified() + wctx.added()
787 if files: 801 remove = wctx.removed()
788 for f in files:
789 s = self.dirstate[f]
790 if s in 'nma':
791 commit.append(f)
792 elif s == 'r':
793 remove.append(f)
794 else:
795 self.ui.warn(_("%s not tracked!\n") % f)
796 else:
797 changes = self.status(match=match)[:5]
798 modified, added, removed, deleted, unknown = changes
799 commit = modified + added
800 remove = removed
801 else:
802 commit = files
803 802
804 c1 = self.changelog.read(p1) 803 c1 = self.changelog.read(p1)
805 c2 = self.changelog.read(p2) 804 c2 = self.changelog.read(p2)
806 m1 = self.manifest.read(c1[0]).copy() 805 m1 = self.manifest.read(c1[0]).copy()
807 m2 = self.manifest.read(c2[0]) 806 m2 = self.manifest.read(c2[0])