##// END OF EJS Templates
localrepo.commit: use explicit variables, avoid creating new contexts
Benoit Boissinot -
r10970:3213e894 default
parent child Browse files
Show More
@@ -798,10 +798,10 b' class localrepository(repo.repository):'
798
798
799 wlock = self.wlock()
799 wlock = self.wlock()
800 try:
800 try:
801 p1, p2 = self.dirstate.parents()
802 wctx = self[None]
801 wctx = self[None]
802 merge = len(wctx.parents()) > 1
803
803
804 if (not force and p2 != nullid and match and
804 if (not force and merge and match and
805 (match.files() or match.anypats())):
805 (match.files() or match.anypats())):
806 raise util.Abort(_('cannot partially commit a merge '
806 raise util.Abort(_('cannot partially commit a merge '
807 '(do not specify files or patterns)'))
807 '(do not specify files or patterns)'))
@@ -841,9 +841,9 b' class localrepository(repo.repository):'
841 elif f not in self.dirstate:
841 elif f not in self.dirstate:
842 fail(f, _("file not tracked!"))
842 fail(f, _("file not tracked!"))
843
843
844 if (not force and not extra.get("close") and p2 == nullid
844 if (not force and not extra.get("close") and not merge
845 and not (changes[0] or changes[1] or changes[2])
845 and not (changes[0] or changes[1] or changes[2])
846 and self[None].branch() == self['.'].branch()):
846 and wctx.branch() == wctx.p1().branch()):
847 return None
847 return None
848
848
849 ms = mergemod.mergestate(self)
849 ms = mergemod.mergestate(self)
@@ -873,8 +873,9 b' class localrepository(repo.repository):'
873 msgfile.write(cctx._text)
873 msgfile.write(cctx._text)
874 msgfile.close()
874 msgfile.close()
875
875
876 p1, p2 = self.dirstate.parents()
877 hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '')
876 try:
878 try:
877 hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '')
878 self.hook("precommit", throw=True, parent1=hookp1, parent2=hookp2)
879 self.hook("precommit", throw=True, parent1=hookp1, parent2=hookp2)
879 ret = self.commitctx(cctx, True)
880 ret = self.commitctx(cctx, True)
880 except:
881 except:
General Comments 0
You need to be logged in to leave comments. Login now