# HG changeset patch # User Pierre-Yves David # Date 1332252653 -3600 # Node ID f12fd2410a60aed77d95daad45148e31189977c4 # Parent 03f314e32058bafedcf6ab9f53fc5aa2c418ac82 obsolete: improve rebase compat diff -r 03f314e32058 -r f12fd2410a60 hgext/obsolete.py --- a/hgext/obsolete.py Tue Mar 20 11:02:11 2012 +0100 +++ b/hgext/obsolete.py Tue Mar 20 15:10:53 2012 +0100 @@ -189,6 +189,13 @@ ### Other Extension compat ############################ + +def buildstate(orig, repo, dest, rebaseset, detach): + """wrapper for rebase 's buildstate that exclude obsolete changeset""" + rebaseset = repo.revs('%ld - extinct()', rebaseset) + return orig(repo, dest, rebaseset, detach) + + def concludenode(orig, repo, rev, *args, **kwargs): """wrapper for rebase 's concludenode that set obsolete relation""" newrev = orig(repo, rev, *args, **kwargs) @@ -219,6 +226,7 @@ try: rebase = extensions.find('rebase') if rebase: + extensions.wrapfunction(rebase, 'buildstate', buildstate) extensions.wrapfunction(rebase, 'concludenode', concludenode) extensions.wrapcommand(rebase.cmdtable, "rebase", cmdrebase) except KeyError: diff -r 03f314e32058 -r f12fd2410a60 tests/test-obsolete.t --- a/tests/test-obsolete.t Tue Mar 20 11:02:11 2012 +0100 +++ b/tests/test-obsolete.t Tue Mar 20 15:10:53 2012 +0100 @@ -339,3 +339,54 @@ 0 - 1f0dee641bb7 +check rebase compat + + $ hg --config extensions.graphlog= glog -r 'not extinct()' --template='{rev} - {node|short}\n' + o 8 - 159dfc9fa5d3 + | + | o 4 - 725c380fe99b + | | + o | 3 - 0d3f46688ccc + |/ + o 1 - 7c3bad9141dc + | + o 0 - 1f0dee641bb7 + + + $ hg --config extensions.graphlog= glog --template='{rev} - {node|short}\n' + o 9 - 83b5778897ad + + o 8 - 159dfc9fa5d3 + | + | o 7 - 909a0fb57e5d + |/ + | o 6 - 95de7fc6918d + |/ + | o 5 - a7a6f2b5d8a5 + |/ + | o 4 - 725c380fe99b + | | + o | 3 - 0d3f46688ccc + |/ + | o 2 - 4538525df7e2 + |/ + o 1 - 7c3bad9141dc + | + o 0 - 1f0dee641bb7 + + +should not rebase extinct changeset + + $ hg --config extensions.hgext.rebase= rebase -b 3 -d 4 --traceback + $ hg --config extensions.graphlog= glog -r 'not extinct()' --template='{rev} - {node|short}\n' + @ 11 - 9468a5f5d8b2 + | + o 10 - 2033b4e49474 + | + o 4 - 725c380fe99b + | + o 1 - 7c3bad9141dc + | + o 0 - 1f0dee641bb7 + +