From patchwork Mon Dec 15 19:14:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1,of,2,v3] context: stop setting None for modified or added nodes From: Augie Fackler X-Patchwork-Id: 7118 Message-Id: To: mercurial-devel@selenic.com Date: Mon, 15 Dec 2014 14:14:25 -0500 # HG changeset patch # User Augie Fackler # Date 1418416194 18000 # Fri Dec 12 15:29:54 2014 -0500 # Node ID b7772da447df306ddfad854d7acd6b72bb5d5534 # Parent 65c854f92d6ba8861414ff3191182fba28777a82 context: stop setting None for modified or added nodes Instead use a modified nullid, so that we can identify modified or added nodes correctly when using manifest.diff(). Thanks to Martin von Zweigbergk for catching that we have to update _buildstatus as well. That part eluded my debugging for some time. diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -17,6 +17,8 @@ import revlog propertycache = util.propertycache +_newnode = nullid + '!' + class basectx(object): """A basectx object represents the common logic for its children: changectx: read-only context that is already present in the repo, @@ -104,7 +106,7 @@ class basectx(object): if (fn not in deletedset and ((fn in withflags and mf1.flags(fn) != mf2.flags(fn)) or (mf1[fn] != mf2node and - (mf2node or self[fn].cmp(other[fn]))))): + (mf2node != _newnode or self[fn].cmp(other[fn]))))): modified.append(fn) elif listclean: clean.append(fn) @@ -1387,7 +1389,7 @@ class workingctx(committablectx): """ mf = self._repo['.']._manifestmatches(match, s) for f in s.modified + s.added: - mf[f] = None + mf[f] = _newnode mf.setflag(f, self.flags(f)) for f in s.removed: if f in mf: