obsolete: improve rebase compat
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 20 Mar 2012 15:10:53 +0100
changeset 150 f12fd2410a60
parent 149 03f314e32058
child 151 e73944b6be8f
obsolete: improve rebase compat
hgext/obsolete.py
tests/test-obsolete.t
--- 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:
--- 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
+  
+