comparison mercurial/context.py @ 25590:183965a00c76

context: override workingctx.hex() to avoid a crash Since node is None for workingctx, it can't use the base class implementation of 'hex(self.node())'. It doesn't appear that there are any current callers of this, but there will be when archive supports 'wdir()'. My first thought was to use "{p1node}+", but that would cause headaches elsewhere [1]. We should probably fix up localrepository.__getitem__ to accept this hash for consistency, as a followup. This works, if the full hash is specified: @@ -480,7 +480,7 @@ return dirstate.dirstate(self.vfs, self.ui, self.root, validate) def __getitem__(self, changeid): - if changeid is None: + if changeid is None or changeid == 'ff' * 20: return context.workingctx(self) if isinstance(changeid, slice): return [context.changectx(self, i) That differs from null, where it will accept any number of 0s, as long as it isn't ambiguous. [1] https://www.selenic.com/pipermail/mercurial-devel/2015-June/071166.html
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 14 Jun 2015 22:04:17 -0400
parents f472228a9e5e
children 70ac1868b707
comparison
equal deleted inserted replaced
25589:273d94255e1e 25590:183965a00c76
1332 yield f 1332 yield f
1333 1333
1334 def __contains__(self, key): 1334 def __contains__(self, key):
1335 return self._repo.dirstate[key] not in "?r" 1335 return self._repo.dirstate[key] not in "?r"
1336 1336
1337 def hex(self):
1338 return "ff" * 20
1339
1337 @propertycache 1340 @propertycache
1338 def _parents(self): 1341 def _parents(self):
1339 p = self._repo.dirstate.parents() 1342 p = self._repo.dirstate.parents()
1340 if p[1] == nullid: 1343 if p[1] == nullid:
1341 p = p[:-1] 1344 p = p[:-1]