Commits

Patrick Mézard committed 691cb55

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.

  • Participants
  • Parent commits 88a851a

Comments (0)

Files changed (2)

File hgext/obsolete.py

             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()

File tests/test-obsolete-rebase.t

   $ 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
 
   $ 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
 
   $ 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
   |/
   $ hg debugsuccessors
   03f31481307a a7773ffa7edc
   076e9b2ffbe1 a7773ffa7edc
-  102a90ea7b4a 03f017c74faa
   4e322f7ce8e3 000000000000
+  98e4a024635e 9c5494949763
 
 Test rebase --abort
 
   $ 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  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
   |/
   @@ -1,4 +1,6 @@
    03f31481307a a7773ffa7edc
    076e9b2ffbe1 a7773ffa7edc
-   102a90ea7b4a 03f017c74faa
   +4b9d80f48523 1951ead97108
    4e322f7ce8e3 000000000000
+   98e4a024635e 9c5494949763
   +a31943eabc43 03f165c84ea8
   [1]