Debian Codegraph @

tests/test-rebase-bookmarks.t

raw
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
3 > rebase=
4 > drawdag=$TESTDIR/drawdag.py
5 >
6 > [phases]
7 > publish=False
8 >
9 > [alias]
10 > tglog = log -G --template "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
11 > EOF
12
13 Create a repo with several bookmarks
14 $ hg init a
15 $ cd a
16
17 $ echo a > a
18 $ hg ci -Am A
19 adding a
20
21 $ echo b > b
22 $ hg ci -Am B
23 adding b
24 $ hg book 'X'
25 $ hg book 'Y'
26
27 $ echo c > c
28 $ hg ci -Am C
29 adding c
30 $ hg book 'Z'
31
32 $ hg up -q 0
33
34 $ echo d > d
35 $ hg ci -Am D
36 adding d
37 created new head
38
39 $ hg book W
40
41 $ hg tglog
42 @ 3: 41acb9dca9eb 'D' bookmarks: W
43 |
44 | o 2: 49cb3485fa0c 'C' bookmarks: Y Z
45 | |
46 | o 1: 6c81ed0049f8 'B' bookmarks: X
47 |/
48 o 0: 1994f17a630e 'A' bookmarks:
49
50
51 Move only rebased bookmarks
52
53 $ cd ..
54 $ hg clone -q a a1
55
56 $ cd a1
57 $ hg up -q Z
58
59 Test deleting divergent bookmarks from dest (issue3685)
60
61 $ hg book -r 3 Z@diverge
62
63 ... and also test that bookmarks not on dest or not being moved aren't deleted
64
65 $ hg book -r 3 X@diverge
66 $ hg book -r 0 Y@diverge
67
68 $ hg tglog
69 o 3: 41acb9dca9eb 'D' bookmarks: W X@diverge Z@diverge
70 |
71 | @ 2: 49cb3485fa0c 'C' bookmarks: Y Z
72 | |
73 | o 1: 6c81ed0049f8 'B' bookmarks: X
74 |/
75 o 0: 1994f17a630e 'A' bookmarks: Y@diverge
76
77 $ hg rebase -s Y -d 3
78 rebasing 2:49cb3485fa0c Y Z "C"
79 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/49cb3485fa0c-126f3e97-rebase.hg
80
81 $ hg tglog
82 @ 3: 17fb3faba63c 'C' bookmarks: Y Z
83 |
84 o 2: 41acb9dca9eb 'D' bookmarks: W X@diverge
85 |
86 | o 1: 6c81ed0049f8 'B' bookmarks: X
87 |/
88 o 0: 1994f17a630e 'A' bookmarks: Y@diverge
89
90 Do not try to keep active but deleted divergent bookmark
91
92 $ cd ..
93 $ hg clone -q a a4
94
95 $ cd a4
96 $ hg up -q 2
97 $ hg book W@diverge
98
99 $ hg rebase -s W -d .
100 rebasing 3:41acb9dca9eb W tip "D"
101 saved backup bundle to $TESTTMP/a4/.hg/strip-backup/41acb9dca9eb-b35a6a63-rebase.hg
102
103 $ hg bookmarks
104 W 3:0d3554f74897
105 X 1:6c81ed0049f8
106 Y 2:49cb3485fa0c
107 Z 2:49cb3485fa0c
108
109 Keep bookmarks to the correct rebased changeset
110
111 $ cd ..
112 $ hg clone -q a a2
113
114 $ cd a2
115 $ hg up -q Z
116
117 $ hg rebase -s 1 -d 3
118 rebasing 1:6c81ed0049f8 X "B"
119 rebasing 2:49cb3485fa0c Y Z "C"
120 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/6c81ed0049f8-a687065f-rebase.hg
121
122 $ hg tglog
123 @ 3: 3d5fa227f4b5 'C' bookmarks: Y Z
124 |
125 o 2: e926fccfa8ec 'B' bookmarks: X
126 |
127 o 1: 41acb9dca9eb 'D' bookmarks: W
128 |
129 o 0: 1994f17a630e 'A' bookmarks:
130
131
132 Keep active bookmark on the correct changeset
133
134 $ cd ..
135 $ hg clone -q a a3
136
137 $ cd a3
138 $ hg up -q X
139
140 $ hg rebase -d W
141 rebasing 1:6c81ed0049f8 X "B"
142 rebasing 2:49cb3485fa0c Y Z "C"
143 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/6c81ed0049f8-a687065f-rebase.hg
144
145 $ hg tglog
146 o 3: 3d5fa227f4b5 'C' bookmarks: Y Z
147 |
148 @ 2: e926fccfa8ec 'B' bookmarks: X
149 |
150 o 1: 41acb9dca9eb 'D' bookmarks: W
151 |
152 o 0: 1994f17a630e 'A' bookmarks:
153
154 $ hg bookmarks
155 W 1:41acb9dca9eb
156 * X 2:e926fccfa8ec
157 Y 3:3d5fa227f4b5
158 Z 3:3d5fa227f4b5
159
160 rebase --continue with bookmarks present (issue3802)
161
162 $ hg up 2
163 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
164 (leaving bookmark X)
165 $ echo 'C' > c
166 $ hg add c
167 $ hg ci -m 'other C'
168 created new head
169 $ hg up 3
170 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
171 $ hg rebase --dest 4
172 rebasing 3:3d5fa227f4b5 Y Z "C"
173 merging c
174 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
175 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
176 [240]
177 $ echo 'c' > c
178 $ hg resolve --mark c
179 (no more unresolved files)
180 continue: hg rebase --continue
181 $ hg rebase --continue
182 rebasing 3:3d5fa227f4b5 Y Z "C"
183 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/3d5fa227f4b5-c6ea2371-rebase.hg
184 $ hg tglog
185 @ 4: 45c0f0ec1203 'C' bookmarks: Y Z
186 |
187 o 3: b0e10b7175fd 'other C' bookmarks:
188 |
189 o 2: e926fccfa8ec 'B' bookmarks: X
190 |
191 o 1: 41acb9dca9eb 'D' bookmarks: W
192 |
193 o 0: 1994f17a630e 'A' bookmarks:
194
195
196 ensure that bookmarks given the names of revset functions can be used
197 as --rev arguments (issue3950)
198
199 $ hg update -q 3
200 $ echo bimble > bimble
201 $ hg add bimble
202 $ hg commit -q -m 'bisect'
203 $ echo e >> bimble
204 $ hg ci -m bisect2
205 $ echo e >> bimble
206 $ hg ci -m bisect3
207 $ hg book bisect
208 $ hg update -q Y
209 $ hg rebase -r '"bisect"^^::"bisect"^' -r bisect -d Z
210 rebasing 5:345c90f326a4 "bisect"
211 rebasing 6:f677a2907404 "bisect2"
212 rebasing 7:325c16001345 bisect tip "bisect3"
213 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/345c90f326a4-b4840586-rebase.hg
214
215 Bookmark and working parent get moved even if --keep is set (issue5682)
216
217 $ hg init $TESTTMP/book-keep
218 $ cd $TESTTMP/book-keep
219 $ hg debugdrawdag <<'EOS'
220 > B C
221 > |/
222 > A
223 > EOS
224 $ eval `hg tags -T 'hg bookmark -ir {node} {tag};\n' | grep -v tip`
225 $ rm .hg/localtags
226 $ hg up -q B
227 $ hg tglog
228 o 2: dc0947a82db8 'C' bookmarks: C
229 |
230 | @ 1: 112478962961 'B' bookmarks: B
231 |/
232 o 0: 426bada5c675 'A' bookmarks: A
233
234 $ hg rebase -r B -d C --keep
235 rebasing 1:112478962961 B "B"
236 $ hg tglog
237 @ 3: 9769fc65c4c5 'B' bookmarks: B
238 |
239 o 2: dc0947a82db8 'C' bookmarks: C
240 |
241 | o 1: 112478962961 'B' bookmarks:
242 |/
243 o 0: 426bada5c675 'A' bookmarks: A
244
245