##// END OF EJS Templates
tests: add test for rebasing merges with ancestors of the rebase destination...
Mads Kiilerich -
r23406:65f215ea default
parent child Browse files
Show More
@@ -1,55 +1,171 b''
1 1 $ cat >> $HGRCPATH <<EOF
2 2 > [extensions]
3 3 > rebase=
4 4 >
5 5 > [alias]
6 6 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
7 7 > EOF
8 8
9 9 $ hg init repo
10 10 $ cd repo
11 11
12 12 $ echo A > a
13 13 $ echo >> a
14 14 $ hg ci -Am A
15 15 adding a
16 16
17 17 $ echo B > a
18 18 $ echo >> a
19 19 $ hg ci -m B
20 20
21 21 $ echo C > a
22 22 $ echo >> a
23 23 $ hg ci -m C
24 24
25 25 $ hg up -q -C 0
26 26
27 27 $ echo D >> a
28 28 $ hg ci -Am AD
29 29 created new head
30 30
31 31 $ hg tglog
32 32 @ 3: 'AD'
33 33 |
34 34 | o 2: 'C'
35 35 | |
36 36 | o 1: 'B'
37 37 |/
38 38 o 0: 'A'
39 39
40 40 $ hg rebase -s 1 -d 3
41 41 merging a
42 42 merging a
43 43 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-backup.hg (glob)
44 44
45 45 $ hg tglog
46 46 o 3: 'C'
47 47 |
48 48 o 2: 'B'
49 49 |
50 50 @ 1: 'AD'
51 51 |
52 52 o 0: 'A'
53 53
54 54
55 55 $ cd ..
56
57
58 Test rebasing of merges with ancestors of the rebase destination - a situation
59 that often happens when trying to recover from repeated merging with a mainline
60 branch.
61
62 The test case creates a dev branch that contains a couple of merges from the
63 default branch. When rebasing to the default branch, these merges would be
64 merges with ancestors on the same branch. The merges _could_ contain some
65 interesting conflict resolutions or additional changes in the merge commit, but
66 that is mixed up with the actual merge stuff and there is in general no way to
67 separate them.
68
69 Note: The dev branch contains _no_ changes to f-default. It might be unclear
70 how rebasing of ancestor merges should be handled, but the current behavior
71 with spurious prompts for conflicts in files that didn't change seems very
72 wrong.
73
74 $ hg init ancestor-merge
75 $ cd ancestor-merge
76
77 $ touch f-default
78 $ hg ci -Aqm 'default: create f-default'
79
80 $ hg branch -q dev
81 $ hg ci -qm 'dev: create branch'
82
83 $ echo stuff > f-dev
84 $ hg ci -Aqm 'dev: f-dev stuff'
85
86 $ hg up -q default
87 $ echo stuff > f-default
88 $ hg ci -m 'default: f-default stuff'
89
90 $ hg up -q dev
91 $ hg merge -q default
92 $ hg ci -m 'dev: merge default'
93
94 $ hg up -q default
95 $ hg rm f-default
96 $ hg ci -m 'default: remove f-default'
97
98 $ hg up -q dev
99 $ hg merge -q default
100 $ hg ci -m 'dev: merge default'
101
102 $ hg up -q default
103 $ echo stuff > f-other
104 $ hg ci -Aqm 'default: f-other stuff'
105
106 $ hg tglog
107 @ 7: 'default: f-other stuff'
108 |
109 | o 6: 'dev: merge default' dev
110 |/|
111 o | 5: 'default: remove f-default'
112 | |
113 | o 4: 'dev: merge default' dev
114 |/|
115 o | 3: 'default: f-default stuff'
116 | |
117 | o 2: 'dev: f-dev stuff' dev
118 | |
119 | o 1: 'dev: create branch' dev
120 |/
121 o 0: 'default: create f-default'
122
123 $ hg clone -qU . ../ancestor-merge-2
124
125 Full rebase all the way back from branching point:
126
127 $ hg rebase -r 'only(dev,default)' -d default
128 remote changed f-default which local deleted
129 use (c)hanged version or leave (d)eleted? c
130 local changed f-default which remote deleted
131 use (c)hanged version or (d)elete? c
132 saved backup bundle to $TESTTMP/ancestor-merge/.hg/strip-backup/1d1a643d390e-backup.hg (glob)
133 $ hg tglog
134 o 5: 'dev: merge default'
135 |
136 o 4: 'dev: f-dev stuff'
137 |
138 @ 3: 'default: f-other stuff'
139 |
140 o 2: 'default: remove f-default'
141 |
142 o 1: 'default: f-default stuff'
143 |
144 o 0: 'default: create f-default'
145
146 Grafty cherry picking rebasing:
147
148 $ cd ../ancestor-merge-2
149
150 $ hg phase -fdr0:
151 $ hg rebase -r 'children(only(dev,default))' -d default
152 remote changed f-default which local deleted
153 use (c)hanged version or leave (d)eleted? c
154 local changed f-default which remote deleted
155 use (c)hanged version or (d)elete? c
156 saved backup bundle to $TESTTMP/ancestor-merge-2/.hg/strip-backup/ec2c14fb2984-backup.hg (glob)
157 $ hg tglog
158 o 6: 'dev: merge default'
159 |
160 o 5: 'dev: f-dev stuff'
161 |
162 o 4: 'default: f-other stuff'
163 |
164 o 3: 'default: remove f-default'
165 |
166 o 2: 'default: f-default stuff'
167 |
168 | o 1: 'dev: create branch' dev
169 |/
170 o 0: 'default: create f-default'
171
General Comments 0
You need to be logged in to leave comments. Login now