tests/test-obsolete-rebase.t
author Patrick Mezard <patrick@mezard.eu>
Thu, 21 Jun 2012 19:58:57 +0200
changeset 298 f597421662f7
parent 285 691cb55358b0
child 302 d68ccae92d52
permissions -rw-r--r--
obsolete: unify collapsed revisions markers handling When collapsing A, B and C into D, amend was registering: A -> D B -> D A -> B C -> D A -> C while the rebase wrapper was doing: A -> D B -> D C -> D At this point, I have no argument to favor one or another or even a new one like: A -> B B -> C C -> D so I am aligning the rebase implementation on the older amend one. At least we can now change them all at once.

  $ cat >> $HGRCPATH <<EOF
  > [defaults]
  > amend=-d "0 0"
  > [extensions]
  > hgext.rebase=
  > hgext.graphlog=
  > EOF
  $ echo "obsolete=$(echo $(dirname $TESTDIR))/hgext/obsolete.py" >> $HGRCPATH

  $ glog() {
  >   hg glog --template '{rev}:{node|short}@{branch}({phase}) {desc|firstline}\n'\
  >     "$@"
  > }

  $ hg init repo
  $ cd repo
  $ echo a > a
  $ hg ci -Am adda
  adding a
  $ echo a >> a
  $ hg ci -m changea

Test regular rebase

  $ hg up 0
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ echo b > b
  $ hg ci -Am addb
  adding b
  created new head
  $ 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 -r . --detach
  $ glog --hidden
  @  4:9c5494949763@default(draft) adde
  |
  | 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
  98e4a024635e 9c5494949763

Test rebase with deleted empty revision

  $ hg up 0
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ hg branch foo
  marked working directory as branch foo
  (branches are permanent and global, did you want a bookmark?)
  $ echo a >> a
  $ hg ci -m changea
  $ hg rebase -d 1
  $ glog --hidden
  o  5:4e322f7ce8e3@foo(secret) changea
  |
  | o  4:9c5494949763@default(draft) adde
  | |
  | | 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
  4e322f7ce8e3 000000000000
  98e4a024635e 9c5494949763

Test rebase --collapse

  $ hg up 0
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ echo c > c
  $ hg ci -Am addc
  adding c
  created new head
  $ echo c >> c
  $ hg ci -m changec
  $ hg rebase --collapse -d 1
  merging c
  $ glog --hidden
  @  8:a7773ffa7edc@default(draft) Collapsed revision
  |
  | o  7:03f31481307a@default(secret) changec
  | |
  | o  6:076e9b2ffbe1@default(secret) addc
  | |
  | | o  5:4e322f7ce8e3@foo(secret) changea
  | |/
  +---o  4:9c5494949763@default(draft) adde
  | |
  | | 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
  03f31481307a a7773ffa7edc
  076e9b2ffbe1 03f31481307a
  076e9b2ffbe1 a7773ffa7edc
  4e322f7ce8e3 000000000000
  98e4a024635e 9c5494949763

Test rebase --abort

  $ hg debugsuccessors > ../successors.old
  $ hg up 0
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ echo d > d
  $ hg ci -Am addd d
  created new head
  $ echo b >> a
  $ hg ci -m appendab
  $ hg rebase -d 1
  merging a
  warning: conflicts during merge.
  merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
  abort: unresolved conflicts (see hg resolve, then hg rebase --continue)
  [255]
  $ hg rebase --abort
  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/03f165c84ea8-backup.hg
  rebase aborted
  $ hg debugsuccessors > ../successors.new
  $ diff -u ../successors.old ../successors.new

Test rebase --continue

  $ hg rebase -d 1
  merging a
  warning: conflicts during merge.
  merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
  abort: unresolved conflicts (see hg resolve, then hg rebase --continue)
  [255]
  $ hg resolve --tool internal:other a
  $ hg rebase --continue
  $ glog --hidden
  @  12:1951ead97108@default(draft) appendab
  |
  o  11:03f165c84ea8@default(draft) addd
  |
  | o  10:4b9d80f48523@default(secret) appendab
  | |
  | o  9:a31943eabc43@default(secret) addd
  | |
  +---o  8:a7773ffa7edc@default(draft) Collapsed revision
  | |
  | | o  7:03f31481307a@default(secret) changec
  | | |
  | | o  6:076e9b2ffbe1@default(secret) addc
  | |/
  | | o  5:4e322f7ce8e3@foo(secret) changea
  | |/
  +---o  4:9c5494949763@default(draft) adde
  | |
  | | 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 > ../successors.new
  $ diff -u ../successors.old ../successors.new
  --- ../successors.old* (glob)
  +++ ../successors.new* (glob)
  @@ -1,5 +1,7 @@
   03f31481307a a7773ffa7edc
   076e9b2ffbe1 03f31481307a
   076e9b2ffbe1 a7773ffa7edc
  +4b9d80f48523 1951ead97108
   4e322f7ce8e3 000000000000
   98e4a024635e 9c5494949763
  +a31943eabc43 03f165c84ea8
  [1]