# HG changeset patch # User Martin von Zweigbergk # Date 2014-10-13 21:11:47 # Node ID 4545c5b53013bff82ea62e7f5a4439883c264e3c # Parent 71570f3104173a20573e7b049a193a21d6eaeb15 commit: use separate variable for p1 manifest and new manifest In localrepo.commitctx(), p1's manifest is copied and used as the basis for the manifest that is about to be committed. The way the copy is updated makes it safe to use it where the original p1's manifest is wanted. For readability, though, a separate variable for each purpose would be clearer. Make it so. diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1387,8 +1387,9 @@ class localrepository(object): trp = weakref.proxy(tr) if ctx.files(): - m1 = p1.manifest().copy() + m1 = p1.manifest() m2 = p2.manifest() + m = m1.copy() # check in files new = {} @@ -1404,7 +1405,7 @@ class localrepository(object): else: new[f] = self._filecommit(fctx, m1, m2, linkrev, trp, changed) - m1.set(f, fctx.flags()) + m.set(f, fctx.flags()) except OSError, inst: self.ui.warn(_("trouble committing %s!\n") % f) raise @@ -1415,13 +1416,14 @@ class localrepository(object): raise # update manifest - m1.update(new) + m.update(new) removed = [f for f in sorted(removed) if f in m1 or f in m2] - drop = [f for f in removed if f in m1] + drop = [f for f in removed if f in m] for f in drop: - del m1[f] - mn = self.manifest.add(m1, trp, linkrev, p1.manifestnode(), - p2.manifestnode(), new, drop) + del m[f] + mn = self.manifest.add(m, trp, linkrev, + p1.manifestnode(), p2.manifestnode(), + new, drop) files = changed + removed else: mn = p1.manifestnode()