##// END OF EJS Templates
commitctx: eliminate some variables
Matt Mackall -
r8412:2bf4f380 default
parent child Browse files
Show More
@@ -826,25 +826,20 b' class localrepository(repo.repository):'
826 If working is set, the working directory is affected.
826 If working is set, the working directory is affected.
827 """
827 """
828
828
829 tr = None
829 tr = lock = None
830 valid = 0 # don't save the dirstate if this isn't set
830 valid = 0 # don't save the dirstate if this isn't set
831 lock = None
832 commit = sorted(ctx.modified() + ctx.added())
833 remove = ctx.removed()
831 remove = ctx.removed()
834 extra = ctx.extra().copy()
835 branchname = extra['branch']
836 user = ctx.user()
837 text = ctx.description()
838
832
839 p1, p2 = [p.node() for p in ctx.parents()]
833 p1, p2 = [p.node() for p in ctx.parents()]
840 c1 = self.changelog.read(p1)
834 c1 = self.changelog.read(p1)
841 c2 = self.changelog.read(p2)
835 c2 = self.changelog.read(p2)
842 m1 = self.manifest.read(c1[0]).copy()
836 m1 = self.manifest.read(c1[0]).copy()
843 m2 = self.manifest.read(c2[0])
837 m2 = self.manifest.read(c2[0])
838 user = ctx.user()
844
839
845 xp1 = hex(p1)
840 xp1, xp2 = hex(p1), hex(p2)
846 if p2 == nullid: xp2 = ''
841 if p2 == nullid:
847 else: xp2 = hex(p2)
842 xp2 = ''
848 self.hook("precommit", throw=True, parent1=xp1, parent2=xp2)
843 self.hook("precommit", throw=True, parent1=xp1, parent2=xp2)
849
844
850 lock = self.lock()
845 lock = self.lock()
@@ -856,7 +851,7 b' class localrepository(repo.repository):'
856 new = {}
851 new = {}
857 changed = []
852 changed = []
858 linkrev = len(self)
853 linkrev = len(self)
859 for f in commit:
854 for f in sorted(ctx.modified() + ctx.added()):
860 self.ui.note(f + "\n")
855 self.ui.note(f + "\n")
861 try:
856 try:
862 fctx = ctx[f]
857 fctx = ctx[f]
@@ -892,6 +887,7 b' class localrepository(repo.repository):'
892 mn = self.manifest.add(m1, trp, linkrev, c1[0], c2[0],
887 mn = self.manifest.add(m1, trp, linkrev, c1[0], c2[0],
893 (new, removed1))
888 (new, removed1))
894
889
890 text = ctx.description()
895 if editor:
891 if editor:
896 text = editor(self, ctx, added, updated, removed)
892 text = editor(self, ctx, added, updated, removed)
897
893
@@ -902,7 +898,7 b' class localrepository(repo.repository):'
902
898
903 self.changelog.delayupdate()
899 self.changelog.delayupdate()
904 n = self.changelog.add(mn, changed + removed, text, trp, p1, p2,
900 n = self.changelog.add(mn, changed + removed, text, trp, p1, p2,
905 user, ctx.date(), extra)
901 user, ctx.date(), ctx.extra().copy())
906 p = lambda: self.changelog.writepending() and self.root or ""
902 p = lambda: self.changelog.writepending() and self.root or ""
907 self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1,
903 self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1,
908 parent2=xp2, pending=p)
904 parent2=xp2, pending=p)
General Comments 0
You need to be logged in to leave comments. Login now