tests/test-obsolete-rebase.t
author Patrick Mezard <patrick@mezard.eu>
Tue, 19 Jun 2012 18:05:23 +0200
changeset 282 05ab164c6593
parent 280 fd43e3908f09
child 283 8d1a8eeb5a84
permissions -rw-r--r--
obsolete: handle rebase --collapse Recording obsolete in concludenode() did not work for --collapse because only the first revision was passed to the call. The new strategy is to track the rebase state in defineparents() and concludenode() and to create markers only after a successful non-abort call. In theory, this should also fix --continue/--abort cases. The change in test-stabilize-order.t comes from concludenode() no longer creating obsolete marker. stabilize command was actually duplicating markers, once in concludenode(), once explicitely.

  $ 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
  $ hg rebase -d 1 --keep  
  abort: rebase --keep option is unsupported with obsolete extension
  (see 'hg help obsolete')
  [255]
  $ hg rebase -d 1
  $ glog --hidden
  @  3:03f017c74faa@default(draft) addb
  |
  | o  2:102a90ea7b4a@default(secret) addb
  | |
  o |  1:540395c44225@default(draft) changea
  |/
  o  0:07f494440405@default(draft) adda
  
  $ hg debugsuccessors
  102a90ea7b4a 03f017c74faa

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  4:4e322f7ce8e3@foo(secret) changea
  |
  | o  3:03f017c74faa@default(draft) addb
  | |
  +---o  2:102a90ea7b4a@default(secret) addb
  | |
  | @  1:540395c44225@default(draft) changea
  |/
  o  0:07f494440405@default(draft) adda
  
  $ hg debugsuccessors
  102a90ea7b4a 03f017c74faa
  4e322f7ce8e3 000000000000

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
  @  7:a7773ffa7edc@default(draft) Collapsed revision
  |
  | o  6:03f31481307a@default(secret) changec
  | |
  | o  5:076e9b2ffbe1@default(secret) addc
  | |
  | | o  4:4e322f7ce8e3@foo(secret) changea
  | |/
  +---o  3:03f017c74faa@default(draft) addb
  | |
  | | o  2:102a90ea7b4a@default(secret) addb
  | |/
  o |  1:540395c44225@default(draft) changea
  |/
  o  0:07f494440405@default(draft) adda
  
  $ hg debugsuccessors
  03f31481307a a7773ffa7edc
  076e9b2ffbe1 a7773ffa7edc
  102a90ea7b4a 03f017c74faa
  4e322f7ce8e3 000000000000