evolve: make graft wrapper handle --rev
authorPatrick Mezard <patrick@mezard.eu>
Sat, 04 Aug 2012 12:44:51 +0200
changeset 419 03672e955bc8
parent 413 984be08ef504
child 420 b6163a85ddac
evolve: make graft wrapper handle --rev
hgext/evolve.py
tests/test-evolve.t
--- a/hgext/evolve.py	Tue Jul 31 14:30:00 2012 +0200
+++ b/hgext/evolve.py	Sat Aug 04 12:44:51 2012 +0200
@@ -634,6 +634,10 @@
         lock.release()
 
 def graftwrapper(orig, ui, repo, *revs, **kwargs):
+    kwargs = dict(kwargs)
+    revs = list(revs) + kwargs.get('rev', [])
+    kwargs['rev'] = []
+
     lock = repo.lock()
     try:
         if kwargs.get('old_obsolete'):
--- a/tests/test-evolve.t	Tue Jul 31 14:30:00 2012 +0200
+++ b/tests/test-evolve.t	Sat Aug 04 12:44:51 2012 +0200
@@ -356,3 +356,51 @@
   (run 'hg update' to get a working copy)
   $ hg up
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd ..
+
+Test graft --obsolete/--old-obsolete
+
+  $ hg init test-graft
+  $ cd test-graft
+  $ mkcommit 0
+  $ mkcommit 1
+  $ mkcommit 2
+  $ mkcommit 3
+  $ hg up -qC 0
+  $ mkcommit 4
+  created new head
+  $ glog --hidden
+  @  4:ce341209337f@default(draft) add 4
+  |
+  | o  3:0e84df4912da@default(draft) add 3
+  | |
+  | o  2:db038628b9e5@default(draft) add 2
+  | |
+  | o  1:73d38bb17fd7@default(draft) add 1
+  |/
+  o  0:8685c6d34325@default(draft) add 0
+  
+  $ hg graft -r3 -O
+  grafting revision 3
+  $ hg graft -r1 -o 2
+  grafting revision 1
+  $ glog --hidden
+  @  6:acb28cd497b7@default(draft) add 1
+  |
+  o  5:0b9e50c35132@default(draft) add 3
+  |
+  o  4:ce341209337f@default(draft) add 4
+  |
+  | x  3:0e84df4912da@default(draft) add 3
+  | |
+  | x  2:db038628b9e5@default(draft) add 2
+  | |
+  | o  1:73d38bb17fd7@default(draft) add 1
+  |/
+  o  0:8685c6d34325@default(draft) add 0
+  
+  $ hg debugsuccessors
+  0e84df4912da 0b9e50c35132
+  db038628b9e5 acb28cd497b7
+  $ cd ..
+