Mercurial > evolve
changeset 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 | 5cec25ce019c |
files | hgext/obsolete.py tests/test-obsolete.t |
diffstat | 2 files changed, 44 insertions(+), 5 deletions(-) [+] |
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:
--- a/tests/test-obsolete.t Wed Sep 14 19:20:38 2011 +0200 +++ b/tests/test-obsolete.t Wed Sep 14 19:52:57 2011 +0200 @@ -265,10 +265,42 @@ $ hg up null 0 files updated, 0 files merged, 4 files removed, 0 files unresolved - $ mkcommit toto # 8 + $ mkcommit toto # 9 created new head - $ hg debugobsolete 8 0 - 159dfc9fa5d3 try to obsolete immutable changeset 1f0dee641bb7 + $ hg id -n + 9 + $ hg debugobsolete 9 0 + 83b5778897ad try to obsolete immutable changeset 1f0dee641bb7 $ qlog -r 'obsolete()' 3 - 0d3f46688ccc +allow to just kill changeset + + $ qlog + 9 + - 83b5778897ad + 8 + - 159dfc9fa5d3 + 4 + - 725c380fe99b + 3 + - 0d3f46688ccc + 1 + - 7c3bad9141dc + 0 + - 1f0dee641bb7 + + $ hg debugobsolete null 9 + $ hg up null -q # to be not based on 9 anymore + $ qlog + 8 + - 159dfc9fa5d3 + 4 + - 725c380fe99b + 3 + - 0d3f46688ccc + 1 + - 7c3bad9141dc + 0 + - 1f0dee641bb7 +