[PATCH] test-rebase-base: add test cases about multiple branches with merges
Jun Wu
quark at fb.com
Fri Nov 25 12:49:01 UTC 2016
# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1480077830 0
# Fri Nov 25 12:43:50 2016 +0000
# Node ID c0a9c4c2c6ae2a779c060dc2424942099d7c984d
# Parent fd4175ec0f4e9bd68f4bfdcd601e11d77499d486
# Available At https://bitbucket.org/quark-zju/hg-draft
# hg pull https://bitbucket.org/quark-zju/hg-draft -r c0a9c4c2c6ae
test-rebase-base: add test cases about multiple branches with merges
This helps clarify the current behavior. When a merge changeset is selected
in --base directly, only one path will be chosen. The behavior remains the
same before and after "rebase: calculate ancestors for --base separately
(issue5420)".
diff --git a/tests/test-rebase-base.t b/tests/test-rebase-base.t
--- a/tests/test-rebase-base.t
+++ b/tests/test-rebase-base.t
@@ -93,2 +93,169 @@ Mixed rebasable and non-rebasable bases
nothing to rebase
[1]
+
+ $ cd ..
+
+Multiple branches with merges:
+
+ $ hg init b
+ $ cd b
+
+ $ hg debugdrawdag <<EOS
+ > h g
+ > | /|
+ > | f |
+ > |/ /
+ > | e
+ > |/ d
+ > | /|
+ > | c |
+ > |/ /
+ > | b
+ > |/
+ > a
+ > EOS
+
+ $ hg rebase -b b+f -d h
+ rebasing 1:488e1b7e7341 "b" (b)
+ rebasing 6:0c088b72e768 "d" (d)
+ rebasing 4:0e9bbb7dd767 "f" (f)
+ rebasing 7:9bdc802fd225 "g" (g tip)
+ saved backup bundle to $TESTTMP/b/.hg/strip-backup/0e9bbb7dd767-ff8b132b-backup.hg (glob)
+ $ hg tglog
+ o 7: g
+ |\
+ | o 6: f
+ | |
+ | | o 5: d
+ | | |\
+ | +---o 4: b
+ | | |
+ | o | 3: h
+ | | |
+ o | | 2: e
+ |/ /
+ | o 1: c
+ |/
+ o 0: a
+
+ $ cd ..
+
+Multiple branches with multiple merges:
+
+ $ hg init c
+ $ cd c
+
+ $ hg debugdrawdag <<'EOS'
+ > j i
+ > | |
+ > | h
+ > | /|
+ > | g | k
+ > | /| |/
+ > | f | |
+ > |/ / |
+ > | e /
+ > |/ d
+ > | /|
+ > | c |
+ > |/ /
+ > | b
+ > |/
+ > a
+ > EOS
+ $ hg rebase -b b+f -d j
+ rebasing 1:488e1b7e7341 "b" (b)
+ rebasing 4:0e9bbb7dd767 "f" (f)
+ rebasing 6:0c088b72e768 "d" (d)
+ rebasing 9:91358dadd39b "k" (k)
+ rebasing 7:9bdc802fd225 "g" (g)
+ rebasing 8:91a34cc1f2a7 "h" (h)
+ rebasing 10:f0d5af4cc88e "i" (i tip)
+ saved backup bundle to $TESTTMP/c/.hg/strip-backup/0e9bbb7dd767-6f921be4-backup.hg (glob)
+ $ hg tglog
+ o 10: i
+ |
+ o 9: h
+ |\
+ | o 8: g
+ | |\
+ +-----o 7: k
+ | | |
+ o | | 6: d
+ |\ \ \
+ | | | o 5: f
+ | | | |
+ | o---+ 4: b
+ | / /
+ | | o 3: j
+ | | |
+ | o | 2: e
+ | |/
+ o / 1: c
+ |/
+ o 0: a
+
+
+ $ cd ..
+
+Pick merge changesets in -b, only one of the two parents is selected:
+
+ $ hg init d
+ $ cd d
+
+ $ hg debugdrawdag <<'EOS'
+ > dest n
+ > | |\
+ > m | g d
+ > |\ | /|
+ > | l | f |
+ > \ \|/ /
+ > k | e
+ > i \|/ d
+ > |\ | /|
+ > | h | c |
+ > \ \|/ /
+ > j | b
+ > \|/
+ > a
+ > EOS
+
+ $ hg rebase -b n+i -d dest
+ rebasing 6:e22eece29d69 "h" (h)
+ rebasing 12:edd90b885ce0 "i" (i)
+ rebasing 1:488e1b7e7341 "b" (b)
+ rebasing 10:0c088b72e768 "d" (d)
+ rebasing 14:f188fc87af23 "n" (n tip)
+ saved backup bundle to $TESTTMP/d/.hg/strip-backup/e22eece29d69-0eeca84a-backup.hg (glob)
+ $ hg tglog
+ o 14: n
+ |\
+ | o 13: d
+ | |\
+ | | o 12: b
+ | | |
+ | | | o 11: i
+ | | | |\
+ | | +---o 10: h
+ | | | |
+ | | | | o 9: m
+ | | | | |\
+ o \ \ \ \ \ 8: g
+ |\ \ \ \ \ \
+ | | | | | | o 7: l
+ | | | | | | |
+ | | | | | o | 6: k
+ | | | | | |/
+ | | | | o / 5: j
+ | | | | |/
+ | o-----+ 4: f
+ | / / /
+ o-----+ 3: e
+ / / /
+ | o / 2: dest
+ | |/
+ o / 1: c
+ |/
+ o 0: a
+
+ $ cd ..
More information about the Mercurial-devel
mailing list