Mercurial > evolve
diff hgext/obsolete.py @ 80:5d029a358252
[obsolete] add kill support
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Wed, 14 Sep 2011 19:52:57 +0200 |
parents | 9906560f585e |
children | 97a5c943db19 |
line wrap: on
line diff
--- a/hgext/obsolete.py Wed Sep 14 19:20:38 2011 +0200 +++ b/hgext/obsolete.py Wed Sep 14 19:52:57 2011 +0200 @@ -87,7 +87,7 @@ from mercurial import discovery from mercurial import error from mercurial import commands -from mercurial.node import hex, bin, short +from mercurial.node import hex, bin, short, nullid from mercurial.lock import release ### Patch changectx @@ -255,6 +255,8 @@ <subject-full-hex> <object-full-hex>\n""" for sub, objs in obssubrels.iteritems(): for obj in objs: + if sub is None: + sub = nullid flike.write('%s %s\n' % (hex(sub), hex(obj))) def _obsdeserialise(flike): @@ -264,7 +266,10 @@ rels = {} for line in flike: subhex, objhex = line.split() - rels.setdefault(bin(subhex), set()).add(bin(objhex)) + subnode = bin(subhex) + if subnode == nullid: + subnode = None + rels.setdefault( subnode, set()).add(bin(objhex)) return rels def reposetup(ui, repo): @@ -291,6 +296,8 @@ def addobsolete(self, sub, obj): """Add a relation marking that node <sub> is a new version of <obj>""" + if sub == nullid: + sub = None self._obssubrels.setdefault(sub, set()).add(obj) self._obsobjrels.setdefault(obj, set()).add(sub) try: