comparison mercurial/context.py @ 23593:b1179dabc6de stable

context: stop setting None for modified or added nodes Instead use a magic value, 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.
author Augie Fackler <augie@google.com>
date Fri, 12 Dec 2014 15:29:54 -0500
parents 2963d5c9d90b
children a4679a74df14
comparison
equal deleted inserted replaced
23592:96d335e4eacb 23593:b1179dabc6de
14 import repoview 14 import repoview
15 import fileset 15 import fileset
16 import revlog 16 import revlog
17 17
18 propertycache = util.propertycache 18 propertycache = util.propertycache
19
20 # Phony node value to stand-in for new files in some uses of
21 # manifests. Manifests support 21-byte hashes for nodes which are
22 # dirty in the working copy.
23 _newnode = '!' * 21
19 24
20 class basectx(object): 25 class basectx(object):
21 """A basectx object represents the common logic for its children: 26 """A basectx object represents the common logic for its children:
22 changectx: read-only context that is already present in the repo, 27 changectx: read-only context that is already present in the repo,
23 workingctx: a context that represents the working directory and can 28 workingctx: a context that represents the working directory and can
126 for fn, mf2node in mf2.iteritems(): 131 for fn, mf2node in mf2.iteritems():
127 if fn in mf1: 132 if fn in mf1:
128 if (fn not in deletedset and 133 if (fn not in deletedset and
129 ((fn in withflags and mf1.flags(fn) != mf2.flags(fn)) or 134 ((fn in withflags and mf1.flags(fn) != mf2.flags(fn)) or
130 (mf1[fn] != mf2node and 135 (mf1[fn] != mf2node and
131 (mf2node or self[fn].cmp(other[fn]))))): 136 (mf2node != _newnode or self[fn].cmp(other[fn]))))):
132 modified.append(fn) 137 modified.append(fn)
133 elif listclean: 138 elif listclean:
134 clean.append(fn) 139 clean.append(fn)
135 del mf1[fn] 140 del mf1[fn]
136 elif fn not in deletedset: 141 elif fn not in deletedset:
1406 need to build a manifest and return what matches. 1411 need to build a manifest and return what matches.
1407 """ 1412 """
1408 mf = self._repo['.']._manifestmatches(match, s) 1413 mf = self._repo['.']._manifestmatches(match, s)
1409 modified, added, removed = s[0:3] 1414 modified, added, removed = s[0:3]
1410 for f in modified + added: 1415 for f in modified + added:
1411 mf[f] = None 1416 mf[f] = _newnode
1412 mf.setflag(f, self.flags(f)) 1417 mf.setflag(f, self.flags(f))
1413 for f in removed: 1418 for f in removed:
1414 if f in mf: 1419 if f in mf:
1415 del mf[f] 1420 del mf[f]
1416 return mf 1421 return mf