Mercurial > hg
changeset 8412:2bf4f380f6ab
commitctx: eliminate some variables
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 14 May 2009 13:21:20 -0500 |
parents | 4d5916358abd |
children | 36448afdadd4 |
files | mercurial/localrepo.py |
diffstat | 1 files changed, 8 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Thu May 14 13:21:20 2009 -0500 +++ b/mercurial/localrepo.py Thu May 14 13:21:20 2009 -0500 @@ -826,25 +826,20 @@ If working is set, the working directory is affected. """ - tr = None + tr = lock = None valid = 0 # don't save the dirstate if this isn't set - lock = None - commit = sorted(ctx.modified() + ctx.added()) remove = ctx.removed() - extra = ctx.extra().copy() - branchname = extra['branch'] - user = ctx.user() - text = ctx.description() p1, p2 = [p.node() for p in ctx.parents()] c1 = self.changelog.read(p1) c2 = self.changelog.read(p2) m1 = self.manifest.read(c1[0]).copy() m2 = self.manifest.read(c2[0]) + user = ctx.user() - xp1 = hex(p1) - if p2 == nullid: xp2 = '' - else: xp2 = hex(p2) + xp1, xp2 = hex(p1), hex(p2) + if p2 == nullid: + xp2 = '' self.hook("precommit", throw=True, parent1=xp1, parent2=xp2) lock = self.lock() @@ -856,7 +851,7 @@ new = {} changed = [] linkrev = len(self) - for f in commit: + for f in sorted(ctx.modified() + ctx.added()): self.ui.note(f + "\n") try: fctx = ctx[f] @@ -892,6 +887,7 @@ mn = self.manifest.add(m1, trp, linkrev, c1[0], c2[0], (new, removed1)) + text = ctx.description() if editor: text = editor(self, ctx, added, updated, removed) @@ -902,7 +898,7 @@ self.changelog.delayupdate() n = self.changelog.add(mn, changed + removed, text, trp, p1, p2, - user, ctx.date(), extra) + user, ctx.date(), ctx.extra().copy()) p = lambda: self.changelog.writepending() and self.root or "" self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1, parent2=xp2, pending=p)