[PATCH 2 of 2] rebase: add the tests to ensure we can abort from a stale rebase

Jason Harris jason.f.harris at gmail.com
Sun Nov 21 12:31:12 CST 2010


# HG changeset patch
# User jfh <jason at jasonfharris.com>
# Date 1290363148 -3600
# Node ID 5ee3601830c3f51d1a7793232e930a756dc589b3
# Parent  ec298433080bb12de80ad9657abb1bdad65fdcba
rebase: add the tests to ensure we can abort from a stale rebase

diff --git a/tests/test-rebase-abort-modified.t b/tests/test-rebase-abort-modified.t
new file mode 100644
--- /dev/null
+++ b/tests/test-rebase-abort-modified.t
@@ -0,0 +1,80 @@
+  $ cat >> $HGRCPATH <<EOF
+  > [extensions]
+  > graphlog=
+  > rebase=
+  > mq=
+  > 
+  > [alias]
+  > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
+  > EOF
+
+Create repo and give it some changesets
+  $ mkdir example
+  $ cd example
+  $ hg init
+  $ echo A > A
+  $ hg ci -Am A
+  adding A
+  $ echo B > B
+  $ hg ci -Am B
+  adding B
+  $ echo C > C
+  $ hg ci -Am C
+  adding C
+  $ echo D > D
+  $ hg ci -Am D
+  adding D
+ 
+Create some open heads
+  $ hg up -q -C 0
+  $ echo Z > B
+  $ hg ci -A -m "new B" B
+  created new head
+  $ hg up -q -C 0
+  $ echo W > C
+  $ hg ci -A -m "new C" C
+  created new head
+  $ hg up -q -C 0
+  $ echo Y > D
+  $ hg ci -A -m "new D" D
+  created new head
+  $ hg up -q -C 0
+  $ hg tglog
+  o  6: 'new D'
+  |
+  | o  5: 'new C'
+  |/
+  | o  4: 'new B'
+  |/
+  | o  3: 'D'
+  | |
+  | o  2: 'C'
+  | |
+  | o  1: 'B'
+  |/
+  @  0: 'A'
+  
+
+Rebase 1 onto 4 and it should fail since there will be conflicts
+  $ hg rebase --source 1 --dest 4 --detach
+  merging B
+  warning: conflicts during merge.
+  merging B failed!
+  abort: unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [255]
+
+Strip out the branches we tried to rebase
+  $ hg up -q -C 0
+  $ hg strip -q 1
+  $ hg strip -q 1
+  $ hg tglog
+  o  2: 'new D'
+  |
+  | o  1: 'new C'
+  |/
+  @  0: 'A'
+  
+ 
+Aborting the rebase should now not complain
+  $ hg rebase --abort
+  previous rebase aborted


More information about the Mercurial-devel mailing list