obsolete: do not obsolete rebase --detach nullmerge revs
authorPatrick Mezard <patrick@mezard.eu>
Wed, 20 Jun 2012 14:43:20 +0200
changeset 285 691cb55358b0
parent 284 88a851a54f26
child 286 d3f20770b86a
child 288 d64f8468aaf9
obsolete: do not obsolete rebase --detach nullmerge revs Rebase state contains the changesets to rebase as well as 'nullmerge' entries used drive the merge strategy. These nullmerge were not rebased and should be ignored, and certainly not be marked obsolete.
hgext/obsolete.py
tests/test-obsolete-rebase.t
--- a/hgext/obsolete.py	Tue Jun 19 17:57:54 2012 +0200
+++ b/hgext/obsolete.py	Wed Jun 20 14:43:20 2012 +0200
@@ -278,6 +278,8 @@
             targetrev = repo[repo._rebasetarget].rev()
             newrevs = set([targetrev])
             for rev, newrev in sorted(repo._rebasestate.items()):
+                if newrev == -2:  # nullmerge
+                    continue
                 oldnode = repo[rev].node()
                 if newrev not in newrevs and newrev >= 0:
                     newnode = repo[newrev].node()
--- a/tests/test-obsolete-rebase.t	Tue Jun 19 17:57:54 2012 +0200
+++ b/tests/test-obsolete-rebase.t	Wed Jun 20 14:43:20 2012 +0200
@@ -28,22 +28,26 @@
   $ hg ci -Am addb
   adding b
   created new head
-  $ hg rebase -d 1 --keep  
+  $ echo e > e
+  $ hg ci -Am adde e
+  $ hg rebase -d 1 -r . --detach --keep  
   abort: rebase --keep option is unsupported with obsolete extension
   (see 'hg help obsolete')
   [255]
-  $ hg rebase -d 1
+  $ hg rebase -d 1 -r . --detach
   $ glog --hidden
-  @  3:03f017c74faa@default(draft) addb
+  @  4:9c5494949763@default(draft) adde
   |
-  | o  2:102a90ea7b4a@default(secret) addb
+  | o  3:98e4a024635e@default(secret) adde
+  | |
+  | o  2:102a90ea7b4a@default(draft) addb
   | |
   o |  1:540395c44225@default(draft) changea
   |/
   o  0:07f494440405@default(draft) adda
   
   $ hg debugsuccessors
-  102a90ea7b4a 03f017c74faa
+  98e4a024635e 9c5494949763
 
 Test rebase with deleted empty revision
 
@@ -56,19 +60,21 @@
   $ hg ci -m changea
   $ hg rebase -d 1
   $ glog --hidden
-  o  4:4e322f7ce8e3@foo(secret) changea
+  o  5:4e322f7ce8e3@foo(secret) changea
   |
-  | o  3:03f017c74faa@default(draft) addb
+  | o  4:9c5494949763@default(draft) adde
   | |
-  +---o  2:102a90ea7b4a@default(secret) addb
+  | | o  3:98e4a024635e@default(secret) adde
+  | | |
+  +---o  2:102a90ea7b4a@default(draft) addb
   | |
   | @  1:540395c44225@default(draft) changea
   |/
   o  0:07f494440405@default(draft) adda
   
   $ hg debugsuccessors
-  102a90ea7b4a 03f017c74faa
   4e322f7ce8e3 000000000000
+  98e4a024635e 9c5494949763
 
 Test rebase --collapse
 
@@ -83,17 +89,19 @@
   $ hg rebase --collapse -d 1
   merging c
   $ glog --hidden
-  @  7:a7773ffa7edc@default(draft) Collapsed revision
+  @  8:a7773ffa7edc@default(draft) Collapsed revision
   |
-  | o  6:03f31481307a@default(secret) changec
+  | o  7:03f31481307a@default(secret) changec
   | |
-  | o  5:076e9b2ffbe1@default(secret) addc
+  | o  6:076e9b2ffbe1@default(secret) addc
   | |
-  | | o  4:4e322f7ce8e3@foo(secret) changea
+  | | o  5:4e322f7ce8e3@foo(secret) changea
   | |/
-  +---o  3:03f017c74faa@default(draft) addb
+  +---o  4:9c5494949763@default(draft) adde
   | |
-  | | o  2:102a90ea7b4a@default(secret) addb
+  | | o  3:98e4a024635e@default(secret) adde
+  | | |
+  | | o  2:102a90ea7b4a@default(draft) addb
   | |/
   o |  1:540395c44225@default(draft) changea
   |/
@@ -102,8 +110,8 @@
   $ hg debugsuccessors
   03f31481307a a7773ffa7edc
   076e9b2ffbe1 a7773ffa7edc
-  102a90ea7b4a 03f017c74faa
   4e322f7ce8e3 000000000000
+  98e4a024635e 9c5494949763
 
 Test rebase --abort
 
@@ -138,25 +146,27 @@
   $ hg resolve --tool internal:other a
   $ hg rebase --continue
   $ glog --hidden
-  @  11:1951ead97108@default(draft) appendab
+  @  12:1951ead97108@default(draft) appendab
   |
-  o  10:03f165c84ea8@default(draft) addd
+  o  11:03f165c84ea8@default(draft) addd
   |
-  | o  9:4b9d80f48523@default(secret) appendab
+  | o  10:4b9d80f48523@default(secret) appendab
   | |
-  | o  8:a31943eabc43@default(secret) addd
+  | o  9:a31943eabc43@default(secret) addd
   | |
-  +---o  7:a7773ffa7edc@default(draft) Collapsed revision
+  +---o  8:a7773ffa7edc@default(draft) Collapsed revision
   | |
-  | | o  6:03f31481307a@default(secret) changec
+  | | o  7:03f31481307a@default(secret) changec
   | | |
-  | | o  5:076e9b2ffbe1@default(secret) addc
+  | | o  6:076e9b2ffbe1@default(secret) addc
+  | |/
+  | | o  5:4e322f7ce8e3@foo(secret) changea
   | |/
-  | | o  4:4e322f7ce8e3@foo(secret) changea
-  | |/
-  +---o  3:03f017c74faa@default(draft) addb
+  +---o  4:9c5494949763@default(draft) adde
   | |
-  | | o  2:102a90ea7b4a@default(secret) addb
+  | | o  3:98e4a024635e@default(secret) adde
+  | | |
+  | | o  2:102a90ea7b4a@default(draft) addb
   | |/
   o |  1:540395c44225@default(draft) changea
   |/
@@ -169,8 +179,8 @@
   @@ -1,4 +1,6 @@
    03f31481307a a7773ffa7edc
    076e9b2ffbe1 a7773ffa7edc
-   102a90ea7b4a 03f017c74faa
   +4b9d80f48523 1951ead97108
    4e322f7ce8e3 000000000000
+   98e4a024635e 9c5494949763
   +a31943eabc43 03f165c84ea8
   [1]