##// END OF EJS Templates
commitctx: use contexts more fully
Matt Mackall -
r8414:2348ce25 default
parent child Browse files
Show More
@@ -829,17 +829,12 b' class localrepository(repo.repository):'
829 tr = lock = 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 remove = ctx.removed()
831 remove = ctx.removed()
832
832 p1, p2 = ctx.p1(), ctx.p2()
833 p1, p2 = [p.node() for p in ctx.parents()]
833 m1 = p1.manifest().copy()
834 c1 = self.changelog.read(p1)
834 m2 = p2.manifest()
835 c2 = self.changelog.read(p2)
836 m1 = self.manifest.read(c1[0]).copy()
837 m2 = self.manifest.read(c2[0])
838 user = ctx.user()
835 user = ctx.user()
839
836
840 xp1, xp2 = hex(p1), hex(p2)
837 xp1, xp2 = p1.hex(), p2 and p2.hex() or ''
841 if p2 == nullid:
842 xp2 = ''
843 self.hook("precommit", throw=True, parent1=xp1, parent2=xp2)
838 self.hook("precommit", throw=True, parent1=xp1, parent2=xp2)
844
839
845 lock = self.lock()
840 lock = self.lock()
@@ -884,8 +879,8 b' class localrepository(repo.repository):'
884 if f in m1:
879 if f in m1:
885 del m1[f]
880 del m1[f]
886 removed1.append(f)
881 removed1.append(f)
887 mn = self.manifest.add(m1, trp, linkrev, c1[0], c2[0],
882 mn = self.manifest.add(m1, trp, linkrev, p1.manifestnode(),
888 (new, removed1))
883 p2.manifestnode(), (new, removed1))
889
884
890 text = ctx.description()
885 text = ctx.description()
891 if editor:
886 if editor:
@@ -897,7 +892,8 b' class localrepository(repo.repository):'
897 text = '\n'.join(lines)
892 text = '\n'.join(lines)
898
893
899 self.changelog.delayupdate()
894 self.changelog.delayupdate()
900 n = self.changelog.add(mn, changed + removed, text, trp, p1, p2,
895 n = self.changelog.add(mn, changed + removed, text, trp,
896 p1.node(), p2.node(),
901 user, ctx.date(), ctx.extra().copy())
897 user, ctx.date(), ctx.extra().copy())
902 p = lambda: self.changelog.writepending() and self.root or ""
898 p = lambda: self.changelog.writepending() and self.root or ""
903 self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1,
899 self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1,
General Comments 0
You need to be logged in to leave comments. Login now