##// END OF EJS Templates
tests: run many tests in $TESTTMP/repo instead of $TESTTMP...
Arseniy Alekseyev -
r50516:55c6ebd1 stable
parent child Browse files
Show More
@@ -1,240 +1,241 b''
1 1 The simple store doesn't escape paths robustly and can't store paths
2 2 with periods, etc. So much of this test fails with it.
3 3 #require no-reposimplestore
4 4
5 $ hg init
5 $ hg init repo
6 $ cd repo
6 7
7 8 audit of .hg
8 9
9 10 $ hg add .hg/00changelog.i
10 11 abort: path contains illegal component: .hg/00changelog.i
11 12 [10]
12 13
13 14 #if symlink
14 15
15 16 Symlinks
16 17
17 18 $ mkdir a
18 19 $ echo a > a/a
19 20 $ hg ci -Ama
20 21 adding a/a
21 22 $ ln -s a b
22 23 $ echo b > a/b
23 24 $ hg add b/b
24 25 abort: path 'b/b' traverses symbolic link 'b'
25 26 [255]
26 27 $ hg add b
27 28
28 29 should still fail - maybe
29 30
30 31 $ hg add b/b
31 32 abort: path 'b/b' traverses symbolic link 'b'
32 33 [255]
33 34
34 35 $ hg commit -m 'add symlink b'
35 36
36 37
37 38 Test symlink traversing when accessing history:
38 39 -----------------------------------------------
39 40
40 41 (build a changeset where the path exists as a directory)
41 42
42 43 $ hg up 0
43 44 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
44 45 $ mkdir b
45 46 $ echo c > b/a
46 47 $ hg add b/a
47 48 $ hg ci -m 'add directory b'
48 49 created new head
49 50
50 51 Test that hg cat does not do anything wrong the working copy has 'b' as directory
51 52
52 53 $ hg cat b/a
53 54 c
54 55 $ hg cat -r "desc(directory)" b/a
55 56 c
56 57 $ hg cat -r "desc(symlink)" b/a
57 58 b/a: no such file in rev bc151a1f53bd
58 59 [1]
59 60
60 61 Test that hg cat does not do anything wrong the working copy has 'b' as a symlink (issue4749)
61 62
62 63 $ hg up 'desc(symlink)'
63 64 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
64 65 $ hg cat b/a
65 66 b/a: no such file in rev bc151a1f53bd
66 67 [1]
67 68 $ hg cat -r "desc(directory)" b/a
68 69 c
69 70 $ hg cat -r "desc(symlink)" b/a
70 71 b/a: no such file in rev bc151a1f53bd
71 72 [1]
72 73
73 74 #endif
74 75
75 76
76 77 unbundle tampered bundle
77 78
78 79 $ hg init target
79 80 $ cd target
80 81 $ hg unbundle "$TESTDIR/bundles/tampered.hg"
81 82 adding changesets
82 83 adding manifests
83 84 adding file changes
84 85 added 5 changesets with 6 changes to 6 files (+4 heads)
85 86 new changesets b7da9bf6b037:fc1393d727bc (5 drafts)
86 87 (run 'hg heads' to see heads, 'hg merge' to merge)
87 88
88 89 attack .hg/test
89 90
90 91 $ hg manifest -r0
91 92 .hg/test
92 93 $ hg update -Cr0
93 94 abort: path contains illegal component: .hg/test
94 95 [10]
95 96
96 97 attack foo/.hg/test
97 98
98 99 $ hg manifest -r1
99 100 foo/.hg/test
100 101 $ hg update -Cr1
101 102 abort: path 'foo/.hg/test' is inside nested repo 'foo'
102 103 [10]
103 104
104 105 attack back/test where back symlinks to ..
105 106
106 107 $ hg manifest -r2
107 108 back
108 109 back/test
109 110 #if symlink
110 111 $ hg update -Cr2
111 112 abort: path 'back/test' traverses symbolic link 'back'
112 113 [255]
113 114 #else
114 115 ('back' will be a file and cause some other system specific error)
115 116 $ hg update -Cr2
116 117 abort: $TESTTMP/target/back/test: $ENOTDIR$
117 118 [255]
118 119 #endif
119 120
120 121 attack ../test
121 122
122 123 $ hg manifest -r3
123 124 ../test
124 125 $ mkdir ../test
125 126 $ echo data > ../test/file
126 127 $ hg update -Cr3
127 128 abort: path contains illegal component: ../test
128 129 [10]
129 130 $ cat ../test/file
130 131 data
131 132
132 133 attack /tmp/test
133 134
134 135 $ hg manifest -r4
135 136 /tmp/test
136 137 $ hg update -Cr4
137 138 abort: path contains illegal component: /tmp/test
138 139 [10]
139 140
140 141 $ cd ..
141 142
142 143 Test symlink traversal on merge:
143 144 --------------------------------
144 145
145 146 #if symlink
146 147
147 148 set up symlink hell
148 149
149 150 $ mkdir merge-symlink-out
150 151 $ hg init merge-symlink
151 152 $ cd merge-symlink
152 153 $ touch base
153 154 $ hg commit -qAm base
154 155 $ ln -s ../merge-symlink-out a
155 156 $ hg commit -qAm 'symlink a -> ../merge-symlink-out'
156 157 $ hg up -q 0
157 158 $ mkdir a
158 159 $ touch a/poisoned
159 160 $ hg commit -qAm 'file a/poisoned'
160 161 $ hg log -G -T '{rev}: {desc}\n'
161 162 @ 2: file a/poisoned
162 163 |
163 164 | o 1: symlink a -> ../merge-symlink-out
164 165 |/
165 166 o 0: base
166 167
167 168
168 169 try trivial merge
169 170
170 171 $ hg up -qC 1
171 172 $ hg merge 2
172 173 abort: path 'a/poisoned' traverses symbolic link 'a'
173 174 [255]
174 175
175 176 try rebase onto other revision: cache of audited paths should be discarded,
176 177 and the rebase should fail (issue5628)
177 178
178 179 $ hg up -qC 2
179 180 $ hg rebase -s 2 -d 1 --config extensions.rebase=
180 181 rebasing 2:e73c21d6b244 tip "file a/poisoned"
181 182 abort: path 'a/poisoned' traverses symbolic link 'a'
182 183 [255]
183 184 $ ls ../merge-symlink-out
184 185
185 186 $ cd ..
186 187
187 188 Test symlink traversal on update:
188 189 ---------------------------------
189 190
190 191 $ mkdir update-symlink-out
191 192 $ hg init update-symlink
192 193 $ cd update-symlink
193 194 $ ln -s ../update-symlink-out a
194 195 $ hg commit -qAm 'symlink a -> ../update-symlink-out'
195 196 $ hg rm a
196 197 $ mkdir a && touch a/b
197 198 $ hg ci -qAm 'file a/b' a/b
198 199 $ hg up -qC 0
199 200 $ hg rm a
200 201 $ mkdir a && touch a/c
201 202 $ hg ci -qAm 'rm a, file a/c'
202 203 $ hg log -G -T '{rev}: {desc}\n'
203 204 @ 2: rm a, file a/c
204 205 |
205 206 | o 1: file a/b
206 207 |/
207 208 o 0: symlink a -> ../update-symlink-out
208 209
209 210
210 211 try linear update where symlink already exists:
211 212
212 213 $ hg up -qC 0
213 214 $ hg up 1
214 215 abort: path 'a/b' traverses symbolic link 'a'
215 216 [255]
216 217
217 218 try linear update including symlinked directory and its content: paths are
218 219 audited first by calculateupdates(), where no symlink is created so both
219 220 'a' and 'a/b' are taken as good paths. still applyupdates() should fail.
220 221
221 222 $ hg up -qC null
222 223 $ hg up 1
223 224 abort: path 'a/b' traverses symbolic link 'a'
224 225 [255]
225 226 $ ls ../update-symlink-out
226 227
227 228 try branch update replacing directory with symlink, and its content: the
228 229 path 'a' is audited as a directory first, which should be audited again as
229 230 a symlink.
230 231
231 232 $ rm -f a
232 233 $ hg up -qC 2
233 234 $ hg up 1
234 235 abort: path 'a/b' traverses symbolic link 'a'
235 236 [255]
236 237 $ ls ../update-symlink-out
237 238
238 239 $ cd ..
239 240
240 241 #endif
@@ -1,18 +1,19 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3 $ echo This is file a1 > a
3 4 $ hg add a
4 5 $ hg commit -m "commit #0"
5 6 $ ls -A
6 7 .hg
7 8 a
8 9 $ echo This is file b1 > b
9 10 $ hg add b
10 11 $ hg commit -m "commit #1"
11 12 $ hg co 0
12 13 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
13 14
14 15 B should disappear
15 16
16 17 $ ls -A
17 18 .hg
18 19 a
@@ -1,795 +1,795 b''
1 $ hg init
2
1 $ hg init repo
2 $ cd repo
3 3
4 4 committing changes
5 5
6 6 $ count=0
7 7 $ echo > a
8 8 $ while test $count -lt 32 ; do
9 9 > echo 'a' >> a
10 10 > test $count -eq 0 && hg add
11 11 > hg ci -m "msg $count" -d "$count 0"
12 12 > count=`expr $count + 1`
13 13 > done
14 14 adding a
15 15
16 16
17 17 $ hg log -G
18 18 @ changeset: 31:58c80a7c8a40
19 19 | tag: tip
20 20 | user: test
21 21 | date: Thu Jan 01 00:00:31 1970 +0000
22 22 | summary: msg 31
23 23 |
24 24 o changeset: 30:ed2d2f24b11c
25 25 | user: test
26 26 | date: Thu Jan 01 00:00:30 1970 +0000
27 27 | summary: msg 30
28 28 |
29 29 o changeset: 29:b5bd63375ab9
30 30 | user: test
31 31 | date: Thu Jan 01 00:00:29 1970 +0000
32 32 | summary: msg 29
33 33 |
34 34 o changeset: 28:8e0c2264c8af
35 35 | user: test
36 36 | date: Thu Jan 01 00:00:28 1970 +0000
37 37 | summary: msg 28
38 38 |
39 39 o changeset: 27:288867a866e9
40 40 | user: test
41 41 | date: Thu Jan 01 00:00:27 1970 +0000
42 42 | summary: msg 27
43 43 |
44 44 o changeset: 26:3efc6fd51aeb
45 45 | user: test
46 46 | date: Thu Jan 01 00:00:26 1970 +0000
47 47 | summary: msg 26
48 48 |
49 49 o changeset: 25:02a84173a97a
50 50 | user: test
51 51 | date: Thu Jan 01 00:00:25 1970 +0000
52 52 | summary: msg 25
53 53 |
54 54 o changeset: 24:10e0acd3809e
55 55 | user: test
56 56 | date: Thu Jan 01 00:00:24 1970 +0000
57 57 | summary: msg 24
58 58 |
59 59 o changeset: 23:5ec79163bff4
60 60 | user: test
61 61 | date: Thu Jan 01 00:00:23 1970 +0000
62 62 | summary: msg 23
63 63 |
64 64 o changeset: 22:06c7993750ce
65 65 | user: test
66 66 | date: Thu Jan 01 00:00:22 1970 +0000
67 67 | summary: msg 22
68 68 |
69 69 o changeset: 21:e5db6aa3fe2a
70 70 | user: test
71 71 | date: Thu Jan 01 00:00:21 1970 +0000
72 72 | summary: msg 21
73 73 |
74 74 o changeset: 20:7128fb4fdbc9
75 75 | user: test
76 76 | date: Thu Jan 01 00:00:20 1970 +0000
77 77 | summary: msg 20
78 78 |
79 79 o changeset: 19:52798545b482
80 80 | user: test
81 81 | date: Thu Jan 01 00:00:19 1970 +0000
82 82 | summary: msg 19
83 83 |
84 84 o changeset: 18:86977a90077e
85 85 | user: test
86 86 | date: Thu Jan 01 00:00:18 1970 +0000
87 87 | summary: msg 18
88 88 |
89 89 o changeset: 17:03515f4a9080
90 90 | user: test
91 91 | date: Thu Jan 01 00:00:17 1970 +0000
92 92 | summary: msg 17
93 93 |
94 94 o changeset: 16:a2e6ea4973e9
95 95 | user: test
96 96 | date: Thu Jan 01 00:00:16 1970 +0000
97 97 | summary: msg 16
98 98 |
99 99 o changeset: 15:e7fa0811edb0
100 100 | user: test
101 101 | date: Thu Jan 01 00:00:15 1970 +0000
102 102 | summary: msg 15
103 103 |
104 104 o changeset: 14:ce8f0998e922
105 105 | user: test
106 106 | date: Thu Jan 01 00:00:14 1970 +0000
107 107 | summary: msg 14
108 108 |
109 109 o changeset: 13:9d7d07bc967c
110 110 | user: test
111 111 | date: Thu Jan 01 00:00:13 1970 +0000
112 112 | summary: msg 13
113 113 |
114 114 o changeset: 12:1941b52820a5
115 115 | user: test
116 116 | date: Thu Jan 01 00:00:12 1970 +0000
117 117 | summary: msg 12
118 118 |
119 119 o changeset: 11:7b4cd9578619
120 120 | user: test
121 121 | date: Thu Jan 01 00:00:11 1970 +0000
122 122 | summary: msg 11
123 123 |
124 124 o changeset: 10:7c5eff49a6b6
125 125 | user: test
126 126 | date: Thu Jan 01 00:00:10 1970 +0000
127 127 | summary: msg 10
128 128 |
129 129 o changeset: 9:eb44510ef29a
130 130 | user: test
131 131 | date: Thu Jan 01 00:00:09 1970 +0000
132 132 | summary: msg 9
133 133 |
134 134 o changeset: 8:453eb4dba229
135 135 | user: test
136 136 | date: Thu Jan 01 00:00:08 1970 +0000
137 137 | summary: msg 8
138 138 |
139 139 o changeset: 7:03750880c6b5
140 140 | user: test
141 141 | date: Thu Jan 01 00:00:07 1970 +0000
142 142 | summary: msg 7
143 143 |
144 144 o changeset: 6:a3d5c6fdf0d3
145 145 | user: test
146 146 | date: Thu Jan 01 00:00:06 1970 +0000
147 147 | summary: msg 6
148 148 |
149 149 o changeset: 5:7874a09ea728
150 150 | user: test
151 151 | date: Thu Jan 01 00:00:05 1970 +0000
152 152 | summary: msg 5
153 153 |
154 154 o changeset: 4:9b2ba8336a65
155 155 | user: test
156 156 | date: Thu Jan 01 00:00:04 1970 +0000
157 157 | summary: msg 4
158 158 |
159 159 o changeset: 3:b53bea5e2fcb
160 160 | user: test
161 161 | date: Thu Jan 01 00:00:03 1970 +0000
162 162 | summary: msg 3
163 163 |
164 164 o changeset: 2:db07c04beaca
165 165 | user: test
166 166 | date: Thu Jan 01 00:00:02 1970 +0000
167 167 | summary: msg 2
168 168 |
169 169 o changeset: 1:5cd978ea5149
170 170 | user: test
171 171 | date: Thu Jan 01 00:00:01 1970 +0000
172 172 | summary: msg 1
173 173 |
174 174 o changeset: 0:b99c7b9c8e11
175 175 user: test
176 176 date: Thu Jan 01 00:00:00 1970 +0000
177 177 summary: msg 0
178 178
179 179
180 180 $ hg up -C
181 181 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
182 182
183 183 bisect test
184 184
185 185 $ hg bisect -r
186 186 $ hg bisect -b
187 187 $ hg status -v
188 188 # The repository is in an unfinished *bisect* state.
189 189
190 190 # To mark the changeset good: hg bisect --good
191 191 # To mark the changeset bad: hg bisect --bad
192 192 # To abort: hg bisect --reset
193 193
194 194 $ hg status -v --config commands.status.skipstates=bisect
195 195 $ hg summary
196 196 parent: 31:58c80a7c8a40 tip
197 197 msg 31
198 198 branch: default
199 199 commit: (clean)
200 200 update: (current)
201 201 phases: 32 draft
202 202 $ hg bisect -g 1
203 203 Testing changeset 16:a2e6ea4973e9 "msg 16" (30 changesets remaining, ~4 tests)
204 204 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
205 205 $ hg bisect -g
206 206 Testing changeset 23:5ec79163bff4 "msg 23" (15 changesets remaining, ~3 tests)
207 207 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
208 208
209 209 skip
210 210
211 211 $ hg bisect -s
212 212 Testing changeset 24:10e0acd3809e "msg 24" (15 changesets remaining, ~3 tests)
213 213 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
214 214 $ hg bisect -g
215 215 Testing changeset 27:288867a866e9 "msg 27" (7 changesets remaining, ~2 tests)
216 216 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
217 217 $ hg bisect -g
218 218 Testing changeset 29:b5bd63375ab9 "msg 29" (4 changesets remaining, ~2 tests)
219 219 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
220 220 $ hg bisect -b
221 221 Testing changeset 28:8e0c2264c8af "msg 28" (2 changesets remaining, ~1 tests)
222 222 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
223 223 $ hg bisect -g
224 224 The first bad revision is:
225 225 changeset: 29:b5bd63375ab9
226 226 user: test
227 227 date: Thu Jan 01 00:00:29 1970 +0000
228 228 summary: msg 29
229 229
230 230
231 231 mark revsets instead of single revs
232 232
233 233 $ hg bisect -r
234 234 $ hg bisect -b "0::3"
235 235 $ hg bisect -s "13::16"
236 236 $ hg bisect -g "26::tip"
237 237 Testing changeset 12:1941b52820a5 "msg 12" (23 changesets remaining, ~4 tests)
238 238 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
239 239 $ cat .hg/bisect.state
240 240 bad b99c7b9c8e11558adef3fad9af211c58d46f325b
241 241 bad 5cd978ea51499179507ee7b6f340d2dbaa401185
242 242 bad db07c04beaca44cf24832541e7f4a2346a95275b
243 243 bad b53bea5e2fcb30d3e00bd3409507a5659ce0fd8b
244 244 current 1941b52820a544549596820a8ae006842b0e2c64
245 245 good 3efc6fd51aeb8594398044c6c846ca59ae021203
246 246 good 288867a866e9adb7a29880b66936c874b80f4651
247 247 good 8e0c2264c8af790daf3585ada0669d93dee09c83
248 248 good b5bd63375ab9a290419f2024b7f4ee9ea7ce90a8
249 249 good ed2d2f24b11c368fa8aa0da9f4e1db580abade59
250 250 good 58c80a7c8a4025a94cedaf7b4a4e3124e8909a96
251 251 skip 9d7d07bc967ca98ad0600c24953fd289ad5fa991
252 252 skip ce8f0998e922c179e80819d5066fbe46e2998784
253 253 skip e7fa0811edb063f6319531f0d0a865882138e180
254 254 skip a2e6ea4973e9196ddd3386493b0c214b41fd97d3
255 255
256 256 bisect reverse test
257 257
258 258 $ hg bisect -r
259 259 $ hg bisect -b null
260 260 $ hg bisect -g tip
261 261 Testing changeset 15:e7fa0811edb0 "msg 15" (32 changesets remaining, ~5 tests)
262 262 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
263 263 $ hg bisect -g
264 264 Testing changeset 7:03750880c6b5 "msg 7" (16 changesets remaining, ~4 tests)
265 265 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
266 266
267 267 skip
268 268
269 269 $ hg bisect -s
270 270 Testing changeset 6:a3d5c6fdf0d3 "msg 6" (16 changesets remaining, ~4 tests)
271 271 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
272 272 $ hg bisect -g
273 273 Testing changeset 2:db07c04beaca "msg 2" (7 changesets remaining, ~2 tests)
274 274 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
275 275 $ hg bisect -g
276 276 Testing changeset 0:b99c7b9c8e11 "msg 0" (3 changesets remaining, ~1 tests)
277 277 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
278 278 $ hg bisect -b
279 279 Testing changeset 1:5cd978ea5149 "msg 1" (2 changesets remaining, ~1 tests)
280 280 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
281 281 $ hg bisect -g
282 282 The first good revision is:
283 283 changeset: 1:5cd978ea5149
284 284 user: test
285 285 date: Thu Jan 01 00:00:01 1970 +0000
286 286 summary: msg 1
287 287
288 288
289 289 $ hg bisect -r
290 290 $ hg bisect -g tip
291 291 $ hg bisect -b tip
292 292 abort: inconsistent state, 31:58c80a7c8a40 is good and bad
293 293 [255]
294 294
295 295 $ hg bisect -r
296 296 $ hg bisect -g null
297 297 $ hg bisect -bU tip
298 298 Testing changeset 15:e7fa0811edb0 "msg 15" (32 changesets remaining, ~5 tests)
299 299 $ hg id
300 300 5cd978ea5149
301 301
302 302
303 303 Issue1228: hg bisect crashes when you skip the last rev in bisection
304 304 Issue1182: hg bisect exception
305 305
306 306 $ hg bisect -r
307 307 $ hg bisect -b 4
308 308 $ hg bisect -g 0
309 309 Testing changeset 2:db07c04beaca "msg 2" (4 changesets remaining, ~2 tests)
310 310 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
311 311 $ hg bisect -s
312 312 Testing changeset 1:5cd978ea5149 "msg 1" (4 changesets remaining, ~2 tests)
313 313 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
314 314 $ hg bisect -s
315 315 Testing changeset 3:b53bea5e2fcb "msg 3" (4 changesets remaining, ~2 tests)
316 316 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
317 317 $ hg bisect -s
318 318 Due to skipped revisions, the first bad revision could be any of:
319 319 changeset: 1:5cd978ea5149
320 320 user: test
321 321 date: Thu Jan 01 00:00:01 1970 +0000
322 322 summary: msg 1
323 323
324 324 changeset: 2:db07c04beaca
325 325 user: test
326 326 date: Thu Jan 01 00:00:02 1970 +0000
327 327 summary: msg 2
328 328
329 329 changeset: 3:b53bea5e2fcb
330 330 user: test
331 331 date: Thu Jan 01 00:00:03 1970 +0000
332 332 summary: msg 3
333 333
334 334 changeset: 4:9b2ba8336a65
335 335 user: test
336 336 date: Thu Jan 01 00:00:04 1970 +0000
337 337 summary: msg 4
338 338
339 339
340 340
341 341 reproduce non converging bisect, issue1182
342 342
343 343 $ hg bisect -r
344 344 $ hg bisect -g 0
345 345 $ hg bisect -b 2
346 346 Testing changeset 1:5cd978ea5149 "msg 1" (2 changesets remaining, ~1 tests)
347 347 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
348 348 $ hg bisect -s
349 349 Due to skipped revisions, the first bad revision could be any of:
350 350 changeset: 1:5cd978ea5149
351 351 user: test
352 352 date: Thu Jan 01 00:00:01 1970 +0000
353 353 summary: msg 1
354 354
355 355 changeset: 2:db07c04beaca
356 356 user: test
357 357 date: Thu Jan 01 00:00:02 1970 +0000
358 358 summary: msg 2
359 359
360 360
361 361
362 362 test no action
363 363
364 364 $ hg bisect -r
365 365 $ hg bisect
366 366 abort: cannot bisect (no known good revisions)
367 367 [20]
368 368
369 369
370 370 reproduce AssertionError, issue1445
371 371
372 372 $ hg bisect -r
373 373 $ hg bisect -b 6
374 374 $ hg bisect -g 0
375 375 Testing changeset 3:b53bea5e2fcb "msg 3" (6 changesets remaining, ~2 tests)
376 376 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
377 377 $ hg bisect -s
378 378 Testing changeset 2:db07c04beaca "msg 2" (6 changesets remaining, ~2 tests)
379 379 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
380 380 $ hg bisect -s
381 381 Testing changeset 4:9b2ba8336a65 "msg 4" (6 changesets remaining, ~2 tests)
382 382 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
383 383 $ hg bisect -s
384 384 Testing changeset 1:5cd978ea5149 "msg 1" (6 changesets remaining, ~2 tests)
385 385 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
386 386 $ hg bisect -s
387 387 Testing changeset 5:7874a09ea728 "msg 5" (6 changesets remaining, ~2 tests)
388 388 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
389 389 $ hg bisect -g
390 390 The first bad revision is:
391 391 changeset: 6:a3d5c6fdf0d3
392 392 user: test
393 393 date: Thu Jan 01 00:00:06 1970 +0000
394 394 summary: msg 6
395 395
396 396 $ hg log -r "bisect(good)"
397 397 changeset: 0:b99c7b9c8e11
398 398 user: test
399 399 date: Thu Jan 01 00:00:00 1970 +0000
400 400 summary: msg 0
401 401
402 402 changeset: 5:7874a09ea728
403 403 user: test
404 404 date: Thu Jan 01 00:00:05 1970 +0000
405 405 summary: msg 5
406 406
407 407 $ hg log -r "bisect(bad)"
408 408 changeset: 6:a3d5c6fdf0d3
409 409 user: test
410 410 date: Thu Jan 01 00:00:06 1970 +0000
411 411 summary: msg 6
412 412
413 413 $ hg log -r "bisect(current)"
414 414 changeset: 5:7874a09ea728
415 415 user: test
416 416 date: Thu Jan 01 00:00:05 1970 +0000
417 417 summary: msg 5
418 418
419 419 $ hg log -r "bisect(skip)"
420 420 changeset: 1:5cd978ea5149
421 421 user: test
422 422 date: Thu Jan 01 00:00:01 1970 +0000
423 423 summary: msg 1
424 424
425 425 changeset: 2:db07c04beaca
426 426 user: test
427 427 date: Thu Jan 01 00:00:02 1970 +0000
428 428 summary: msg 2
429 429
430 430 changeset: 3:b53bea5e2fcb
431 431 user: test
432 432 date: Thu Jan 01 00:00:03 1970 +0000
433 433 summary: msg 3
434 434
435 435 changeset: 4:9b2ba8336a65
436 436 user: test
437 437 date: Thu Jan 01 00:00:04 1970 +0000
438 438 summary: msg 4
439 439
440 440
441 441 test legacy bisected() keyword
442 442
443 443 $ hg log -r "bisected(bad)"
444 444 changeset: 6:a3d5c6fdf0d3
445 445 user: test
446 446 date: Thu Jan 01 00:00:06 1970 +0000
447 447 summary: msg 6
448 448
449 449
450 450 $ set +e
451 451
452 452 test invalid command
453 453 assuming that the shell returns 127 if command not found ...
454 454
455 455 $ hg bisect -r
456 456 $ hg bisect --command 'exit 127'
457 457 abort: failed to execute exit 127
458 458 [255]
459 459
460 460
461 461 test bisecting command
462 462
463 $ cat > script.py <<EOF
463 $ cat > "$TESTTMP/script.py" <<EOF
464 464 > #!$PYTHON
465 465 > import sys
466 466 > from mercurial import hg, ui as uimod
467 467 > repo = hg.repository(uimod.ui.load(), b'.')
468 468 > if repo[b'.'].rev() < 6:
469 469 > sys.exit(1)
470 470 > EOF
471 $ chmod +x script.py
471 $ chmod +x "$TESTTMP/script.py"
472 472 $ hg bisect -r
473 473 $ hg up -qr tip
474 474 $ hg bisect --command "\"$PYTHON\" \"$TESTTMP/script.py\" and some parameters"
475 475 changeset 31:58c80a7c8a40 tip "msg 31": good
476 476 abort: cannot bisect (no known bad revisions)
477 477 [20]
478 478 $ hg up -qr 0
479 479 $ hg bisect --command "\"$PYTHON\" \"$TESTTMP/script.py\" and some parameters"
480 480 changeset 0:b99c7b9c8e11 "msg 0": bad
481 481 changeset 15:e7fa0811edb0 "msg 15": good
482 482 changeset 7:03750880c6b5 "msg 7": good
483 483 changeset 3:b53bea5e2fcb "msg 3": bad
484 484 changeset 5:7874a09ea728 "msg 5": bad
485 485 changeset 6:a3d5c6fdf0d3 "msg 6": good
486 486 The first good revision is:
487 487 changeset: 6:a3d5c6fdf0d3
488 488 user: test
489 489 date: Thu Jan 01 00:00:06 1970 +0000
490 490 summary: msg 6
491 491
492 492
493 493
494 494 test bisecting via a command without updating the working dir, and
495 495 ensure that the bisect state file is updated before running a test
496 496 command
497 497
498 498 $ hg update null
499 499 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
500 $ cat > script.sh <<'EOF'
500 $ cat > "$TESTTMP/script.sh" <<'EOF'
501 501 > #!/bin/sh
502 502 > test -n "$HG_NODE" || (echo HG_NODE missing; exit 127)
503 503 > current="`hg log -r \"bisect(current)\" --template {node}`"
504 504 > test "$current" = "$HG_NODE" || (echo current is bad: $current; exit 127)
505 505 > rev="`hg log -r $HG_NODE --template {rev}`"
506 506 > test "$rev" -ge 6
507 507 > EOF
508 $ chmod +x script.sh
508 $ chmod +x "$TESTTMP/script.sh"
509 509 $ hg bisect -r
510 510 $ hg bisect --good tip --noupdate
511 511 $ hg bisect --bad 0 --noupdate
512 512 Testing changeset 15:e7fa0811edb0 "msg 15" (31 changesets remaining, ~4 tests)
513 513 $ hg bisect --command "sh \"$TESTTMP/script.sh\" and some params" --noupdate
514 514 changeset 15:e7fa0811edb0 "msg 15": good
515 515 changeset 7:03750880c6b5 "msg 7": good
516 516 changeset 3:b53bea5e2fcb "msg 3": bad
517 517 changeset 5:7874a09ea728 "msg 5": bad
518 518 changeset 6:a3d5c6fdf0d3 "msg 6": good
519 519 The first good revision is:
520 520 changeset: 6:a3d5c6fdf0d3
521 521 user: test
522 522 date: Thu Jan 01 00:00:06 1970 +0000
523 523 summary: msg 6
524 524
525 525
526 526 ensure that we still don't have a working dir
527 527
528 528 $ hg parents
529 529
530 530
531 531 test the same case, this time with updating
532 532
533 $ cat > script.sh <<'EOF'
533 $ cat > "$TESTTMP/script.sh" <<'EOF'
534 534 > #!/bin/sh
535 535 > test -n "$HG_NODE" || (echo HG_NODE missing; exit 127)
536 536 > current="`hg log -r \"bisect(current)\" --template {node}`"
537 537 > test "$current" = "$HG_NODE" || (echo current is bad: $current; exit 127)
538 538 > rev="`hg log -r . --template {rev}`"
539 539 > test "$rev" -ge 6
540 540 > EOF
541 $ chmod +x script.sh
541 $ chmod +x "$TESTTMP/script.sh"
542 542 $ hg bisect -r
543 543 $ hg up -qr tip
544 544 $ hg bisect --command "sh \"$TESTTMP/script.sh\" and some params"
545 545 changeset 31:58c80a7c8a40 tip "msg 31": good
546 546 abort: cannot bisect (no known bad revisions)
547 547 [20]
548 548 $ hg up -qr 0
549 549 $ hg bisect --command "sh \"$TESTTMP/script.sh\" and some params"
550 550 changeset 0:b99c7b9c8e11 "msg 0": bad
551 551 changeset 15:e7fa0811edb0 "msg 15": good
552 552 changeset 7:03750880c6b5 "msg 7": good
553 553 changeset 3:b53bea5e2fcb "msg 3": bad
554 554 changeset 5:7874a09ea728 "msg 5": bad
555 555 changeset 6:a3d5c6fdf0d3 "msg 6": good
556 556 The first good revision is:
557 557 changeset: 6:a3d5c6fdf0d3
558 558 user: test
559 559 date: Thu Jan 01 00:00:06 1970 +0000
560 560 summary: msg 6
561 561
562 562 $ hg graft -q 15
563 563 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
564 564 abort: unresolved conflicts, can't continue
565 565 (use 'hg resolve' and 'hg graft --continue')
566 566 [1]
567 567 $ hg bisect --reset
568 568 $ hg up -C .
569 569 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
570 570
571 571 Check that bisect does not break on obsolete changesets
572 572 =========================================================
573 573
574 574 $ cat >> $HGRCPATH << EOF
575 575 > [experimental]
576 576 > evolution.createmarkers=True
577 577 > EOF
578 578
579 579 tip is obsolete
580 580 ---------------------
581 581
582 582 $ hg debugobsolete `hg id --debug -i -r tip`
583 583 1 new obsolescence markers
584 584 obsoleted 1 changesets
585 585 $ hg bisect --reset
586 586 $ hg bisect --good 15
587 587 $ hg bisect --bad 30
588 588 Testing changeset 22:06c7993750ce "msg 22" (15 changesets remaining, ~3 tests)
589 589 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
590 590 $ hg bisect --command true
591 591 changeset 22:06c7993750ce "msg 22": good
592 592 changeset 26:3efc6fd51aeb "msg 26": good
593 593 changeset 28:8e0c2264c8af "msg 28": good
594 594 changeset 29:b5bd63375ab9 "msg 29": good
595 595 The first bad revision is:
596 596 changeset: 30:ed2d2f24b11c
597 597 tag: tip
598 598 user: test
599 599 date: Thu Jan 01 00:00:30 1970 +0000
600 600 summary: msg 30
601 601
602 602
603 603 Rewritten commits should not crash
604 604
605 605 $ hg co 29
606 606 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
607 607 $ hg revert --all -r 30
608 608 reverting a
609 609 $ hg commit -m 'msg 30 -- fixed'
610 610 created new head
611 611 $ hg debugobsolete `hg id --debug -i -r 30` `hg id --debug -i -r .`
612 612 1 new obsolescence markers
613 613 obsoleted 1 changesets
614 614 $ hg bisect
615 615 The first bad revision is:
616 616 changeset: 30:ed2d2f24b11c
617 617 user: test
618 618 date: Thu Jan 01 00:00:30 1970 +0000
619 619 obsolete: rewritten as 32:8a638ebd1122
620 620 summary: msg 30
621 621
622 622
623 623 Log template does not crash
624 624
625 625 $ hg log -GTbisect -r 15::
626 626 @ changeset: 32:8a638ebd1122
627 627 | bisect: good (implicit)
628 628 | tag: tip
629 629 | parent: 29:b5bd63375ab9
630 630 | user: test
631 631 | date: Thu Jan 01 00:00:00 1970 +0000
632 632 | summary: msg 30 -- fixed
633 633 |
634 634 o changeset: 29:b5bd63375ab9
635 635 | bisect: good
636 636 | user: test
637 637 | date: Thu Jan 01 00:00:29 1970 +0000
638 638 | summary: msg 29
639 639 |
640 640 o changeset: 28:8e0c2264c8af
641 641 | bisect: good
642 642 | user: test
643 643 | date: Thu Jan 01 00:00:28 1970 +0000
644 644 | summary: msg 28
645 645 |
646 646 o changeset: 27:288867a866e9
647 647 | bisect: ignored
648 648 | user: test
649 649 | date: Thu Jan 01 00:00:27 1970 +0000
650 650 | summary: msg 27
651 651 |
652 652 o changeset: 26:3efc6fd51aeb
653 653 | bisect: good
654 654 | user: test
655 655 | date: Thu Jan 01 00:00:26 1970 +0000
656 656 | summary: msg 26
657 657 |
658 658 o changeset: 25:02a84173a97a
659 659 | bisect: ignored
660 660 | user: test
661 661 | date: Thu Jan 01 00:00:25 1970 +0000
662 662 | summary: msg 25
663 663 |
664 664 o changeset: 24:10e0acd3809e
665 665 | bisect: ignored
666 666 | user: test
667 667 | date: Thu Jan 01 00:00:24 1970 +0000
668 668 | summary: msg 24
669 669 |
670 670 o changeset: 23:5ec79163bff4
671 671 | bisect: ignored
672 672 | user: test
673 673 | date: Thu Jan 01 00:00:23 1970 +0000
674 674 | summary: msg 23
675 675 |
676 676 o changeset: 22:06c7993750ce
677 677 | bisect: good
678 678 | user: test
679 679 | date: Thu Jan 01 00:00:22 1970 +0000
680 680 | summary: msg 22
681 681 |
682 682 o changeset: 21:e5db6aa3fe2a
683 683 | bisect: ignored
684 684 | user: test
685 685 | date: Thu Jan 01 00:00:21 1970 +0000
686 686 | summary: msg 21
687 687 |
688 688 o changeset: 20:7128fb4fdbc9
689 689 | bisect: ignored
690 690 | user: test
691 691 | date: Thu Jan 01 00:00:20 1970 +0000
692 692 | summary: msg 20
693 693 |
694 694 o changeset: 19:52798545b482
695 695 | bisect: ignored
696 696 | user: test
697 697 | date: Thu Jan 01 00:00:19 1970 +0000
698 698 | summary: msg 19
699 699 |
700 700 o changeset: 18:86977a90077e
701 701 | bisect: ignored
702 702 | user: test
703 703 | date: Thu Jan 01 00:00:18 1970 +0000
704 704 | summary: msg 18
705 705 |
706 706 o changeset: 17:03515f4a9080
707 707 | bisect: ignored
708 708 | user: test
709 709 | date: Thu Jan 01 00:00:17 1970 +0000
710 710 | summary: msg 17
711 711 |
712 712 o changeset: 16:a2e6ea4973e9
713 713 | bisect: ignored
714 714 | user: test
715 715 | date: Thu Jan 01 00:00:16 1970 +0000
716 716 | summary: msg 16
717 717 |
718 718 o changeset: 15:e7fa0811edb0
719 719 | bisect: good
720 720 ~ user: test
721 721 date: Thu Jan 01 00:00:15 1970 +0000
722 722 summary: msg 15
723 723
724 724 $ hg debugobsolete --delete `hg debugobsolete --index -T'{index}\n' | tail -1`
725 725 deleted 1 obsolescence markers
726 726
727 727 Changeset in the bad:good range is obsolete
728 728 ---------------------------------------------
729 729
730 730 $ hg up 30
731 731 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
732 732 $ echo 'a' >> a
733 733 $ hg ci -m "msg 32" -d "32 0"
734 734 $ hg bisect --reset
735 735 $ hg bisect --good .
736 736 $ hg bisect --bad 25
737 737 Testing changeset 28:8e0c2264c8af "msg 28" (6 changesets remaining, ~2 tests)
738 738 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
739 739 $ hg bisect --command true
740 740 changeset 28:8e0c2264c8af "msg 28": good
741 741 changeset 26:3efc6fd51aeb "msg 26": good
742 742 The first good revision is:
743 743 changeset: 26:3efc6fd51aeb
744 744 user: test
745 745 date: Thu Jan 01 00:00:26 1970 +0000
746 746 summary: msg 26
747 747
748 748 Test the validation message when exclusive options are used:
749 749
750 750 $ hg bisect -r
751 751 $ hg bisect -b -c false
752 752 abort: --bad and --command are incompatible
753 753 [10]
754 754 $ hg bisect -b -e
755 755 abort: --bad and --extend are incompatible
756 756 [10]
757 757 $ hg bisect -b -g
758 758 abort: --bad and --good are incompatible
759 759 [10]
760 760 $ hg bisect -b -r
761 761 abort: --bad and --reset are incompatible
762 762 [10]
763 763 $ hg bisect -b -s
764 764 abort: --bad and --skip are incompatible
765 765 [10]
766 766 $ hg bisect -c false -e
767 767 abort: --command and --extend are incompatible
768 768 [10]
769 769 $ hg bisect -c false -g
770 770 abort: --command and --good are incompatible
771 771 [10]
772 772 $ hg bisect -c false -r
773 773 abort: --command and --reset are incompatible
774 774 [10]
775 775 $ hg bisect -c false -s
776 776 abort: --command and --skip are incompatible
777 777 [10]
778 778 $ hg bisect -e -g
779 779 abort: --extend and --good are incompatible
780 780 [10]
781 781 $ hg bisect -e -r
782 782 abort: --extend and --reset are incompatible
783 783 [10]
784 784 $ hg bisect -e -s
785 785 abort: --extend and --skip are incompatible
786 786 [10]
787 787 $ hg bisect -g -r
788 788 abort: --good and --reset are incompatible
789 789 [10]
790 790 $ hg bisect -g -s
791 791 abort: --good and --skip are incompatible
792 792 [10]
793 793 $ hg bisect -r -s
794 794 abort: --reset and --skip are incompatible
795 795 [10]
@@ -1,248 +1,249 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3
3 4 no bookmarks
4 5
5 6 $ hg bookmarks
6 7 no bookmarks set
7 8
8 9 set bookmark X
9 10
10 11 $ hg bookmark X
11 12
12 13 list bookmarks
13 14
14 15 $ hg bookmark
15 16 * X -1:000000000000
16 17
17 18 list bookmarks with color
18 19
19 20 $ hg --config extensions.color= --config color.mode=ansi \
20 21 > bookmark --color=always
21 22 \x1b[0;32m * \x1b[0m\x1b[0;32mX\x1b[0m\x1b[0;32m -1:000000000000\x1b[0m (esc)
22 23
23 24 update to bookmark X
24 25
25 26 $ hg bookmarks
26 27 * X -1:000000000000
27 28 $ hg update X
28 29 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 30
30 31 list bookmarks
31 32
32 33 $ hg bookmarks
33 34 * X -1:000000000000
34 35
35 36 rename
36 37
37 38 $ hg bookmark -m X Z
38 39
39 40 list bookmarks
40 41
41 42 $ cat .hg/bookmarks.current
42 43 Z (no-eol)
43 44 $ cat .hg/bookmarks
44 45 0000000000000000000000000000000000000000 Z
45 46 $ hg bookmarks
46 47 * Z -1:000000000000
47 48
48 49 new bookmarks X and Y, first one made active
49 50
50 51 $ hg bookmark Y X
51 52
52 53 list bookmarks
53 54
54 55 $ hg bookmark
55 56 X -1:000000000000
56 57 * Y -1:000000000000
57 58 Z -1:000000000000
58 59
59 60 $ hg bookmark -d X
60 61
61 62 commit
62 63
63 64 $ echo 'b' > b
64 65 $ hg add b
65 66 $ hg commit -m'test'
66 67
67 68 list bookmarks
68 69
69 70 $ hg bookmark
70 71 * Y 0:719295282060
71 72 Z -1:000000000000
72 73
73 74 Verify that switching to Z updates the active bookmark:
74 75 $ hg update Z
75 76 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
76 77 (activating bookmark Z)
77 78 $ hg bookmark
78 79 Y 0:719295282060
79 80 * Z -1:000000000000
80 81
81 82 Switch back to Y for the remaining tests in this file:
82 83 $ hg update Y
83 84 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
84 85 (activating bookmark Y)
85 86
86 87 delete bookmarks
87 88
88 89 $ hg bookmark -d Y
89 90 $ hg bookmark -d Z
90 91
91 92 list bookmarks
92 93
93 94 $ hg bookmark
94 95 no bookmarks set
95 96
96 97 update to tip
97 98
98 99 $ hg update tip
99 100 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
100 101
101 102 set bookmark Y using -r . but make sure that the active
102 103 bookmark is not activated
103 104
104 105 $ hg bookmark -r . Y
105 106
106 107 list bookmarks, Y should not be active
107 108
108 109 $ hg bookmark
109 110 Y 0:719295282060
110 111
111 112 now, activate Y
112 113
113 114 $ hg up -q Y
114 115
115 116 set bookmark Z using -i
116 117
117 118 $ hg bookmark -r . -i Z
118 119 $ hg bookmarks
119 120 * Y 0:719295282060
120 121 Z 0:719295282060
121 122
122 123 deactivate active bookmark using -i
123 124
124 125 $ hg bookmark -i Y
125 126 $ hg bookmarks
126 127 Y 0:719295282060
127 128 Z 0:719295282060
128 129
129 130 $ hg up -q Y
130 131 $ hg bookmark -i
131 132 $ hg bookmarks
132 133 Y 0:719295282060
133 134 Z 0:719295282060
134 135 $ hg bookmark -i
135 136 no active bookmark
136 137 $ hg up -q Y
137 138 $ hg bookmarks
138 139 * Y 0:719295282060
139 140 Z 0:719295282060
140 141
141 142 deactivate active bookmark while renaming
142 143
143 144 $ hg bookmark -i -m Y X
144 145 $ hg bookmarks
145 146 X 0:719295282060
146 147 Z 0:719295282060
147 148
148 149 bare update moves the active bookmark forward and clear the divergent bookmarks
149 150
150 151 $ echo a > a
151 152 $ hg ci -Am1
152 153 adding a
153 154 $ echo b >> a
154 155 $ hg ci -Am2
155 156 $ hg bookmark X@1 -r 1
156 157 $ hg bookmark X@2 -r 2
157 158 $ hg update X
158 159 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
159 160 (activating bookmark X)
160 161 $ hg bookmarks
161 162 * X 0:719295282060
162 163 X@1 1:cc586d725fbe
163 164 X@2 2:49e1c4e84c58
164 165 Z 0:719295282060
165 166 $ hg update
166 167 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
167 168 updating bookmark X
168 169 $ hg bookmarks
169 170 * X 2:49e1c4e84c58
170 171 Z 0:719295282060
171 172
172 173 test deleting .hg/bookmarks.current when explicitly updating
173 174 to a revision
174 175
175 176 $ echo a >> b
176 177 $ hg ci -m.
177 178 $ hg up -q X
178 179 $ test -f .hg/bookmarks.current
179 180
180 181 try to update to it again to make sure we don't
181 182 set and then unset it
182 183
183 184 $ hg up -q X
184 185 $ test -f .hg/bookmarks.current
185 186
186 187 $ hg up -q 1
187 188 $ test -f .hg/bookmarks.current
188 189 [1]
189 190
190 191 when a bookmark is active, hg up -r . is
191 192 analogous to hg book -i <active bookmark>
192 193
193 194 $ hg up -q X
194 195 $ hg up -q .
195 196 $ test -f .hg/bookmarks.current
196 197 [1]
197 198
198 199 issue 4552 -- simulate a pull moving the active bookmark
199 200
200 201 $ hg up -q X
201 202 $ printf "Z" > .hg/bookmarks.current
202 203 $ hg log -T '{activebookmark}\n' -r Z
203 204 Z
204 205 $ hg log -T '{bookmarks % "{active}\n"}' -r Z
205 206 Z
206 207
207 208 test that updating to closed branch head also advances active bookmark
208 209
209 210 $ hg commit --close-branch -m "closed"
210 211 $ hg update -q ".^1"
211 212 $ hg bookmark Y
212 213 $ hg bookmarks
213 214 X 3:4d6bd4bfb1ae
214 215 * Y 3:4d6bd4bfb1ae
215 216 Z 0:719295282060
216 217 $ hg update
217 218 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
218 219 updating bookmark Y
219 220 $ hg bookmarks
220 221 X 3:4d6bd4bfb1ae
221 222 * Y 4:8fa964221e8e
222 223 Z 0:719295282060
223 224 $ hg parents -q
224 225 4:8fa964221e8e
225 226
226 227 Checks command to retrieve active bookmark
227 228 ------------------------------------------
228 229
229 230 display how "{activebookmark}" template is unsuitable for the task
230 231
231 232 $ hg book -T '- {activebookmark}\n'
232 233 -
233 234 - Y
234 235 -
235 236
236 237 $ hg book -r . W
237 238 $ hg book -T '- {activebookmark}\n'
238 239 - Y
239 240 -
240 241 - Y
241 242 -
242 243
243 244 $ hg bookmarks -ql .
244 245 Y
245 246 $ hg bookmarks --inactive
246 247 $ hg bookmarks -ql .
247 248 abort: no active bookmark
248 249 [10]
@@ -1,152 +1,153 b''
1 1 # init
2 2
3 $ hg init
3 $ hg init repo
4 $ cd repo
4 5 $ echo a > a
5 6 $ hg add a
6 7 $ hg commit -m'a'
7 8 $ echo b > b
8 9 $ hg add b
9 10 $ hg commit -m'b'
10 11 $ hg up -C 0
11 12 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
12 13 $ echo c > c
13 14 $ hg add c
14 15 $ hg commit -m'c'
15 16 created new head
16 17
17 18 # test merging of diverged bookmarks
18 19 $ hg bookmark -r 1 "c@diverge"
19 20 $ hg bookmark -r 1 b
20 21 $ hg bookmark c
21 22 $ hg bookmarks
22 23 b 1:d2ae7f538514
23 24 * c 2:d36c0562f908
24 25 c@diverge 1:d2ae7f538514
25 26 $ hg merge "c@diverge"
26 27 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
27 28 (branch merge, don't forget to commit)
28 29 $ hg commit -m'merge'
29 30 $ hg bookmarks
30 31 b 1:d2ae7f538514
31 32 * c 3:b8f96cf4688b
32 33
33 34 $ hg up -C 3
34 35 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
35 36 (leaving bookmark c)
36 37 $ echo d > d
37 38 $ hg add d
38 39 $ hg commit -m'd'
39 40
40 41 $ hg up -C 3
41 42 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
42 43 $ echo e > e
43 44 $ hg add e
44 45 $ hg commit -m'e'
45 46 created new head
46 47 $ hg up -C 5
47 48 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
48 49 $ hg bookmark e
49 50 $ hg bookmarks
50 51 b 1:d2ae7f538514
51 52 c 3:b8f96cf4688b
52 53 * e 5:26bee9c5bcf3
53 54
54 55 # the picked side is bookmarked
55 56
56 57 $ hg up -C 4
57 58 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
58 59 (leaving bookmark e)
59 60 $ hg merge
60 61 abort: heads are bookmarked - please merge with an explicit rev
61 62 (run 'hg heads' to see all heads, specify rev with -r)
62 63 [255]
63 64
64 65 # our revision is bookmarked
65 66
66 67 $ hg up -C e
67 68 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
68 69 (activating bookmark e)
69 70 $ hg merge
70 71 abort: no matching bookmark to merge - please merge with an explicit rev or bookmark
71 72 (run 'hg heads' to see all heads, specify rev with -r)
72 73 [255]
73 74
74 75 # merge bookmark heads
75 76
76 77 $ hg up -C 4
77 78 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
78 79 (leaving bookmark e)
79 80 $ echo f > f
80 81 $ hg commit -Am "f"
81 82 adding f
82 83 $ hg bookmarks -r 4 "e@diverged"
83 84 $ hg up -q -C "e@diverged"
84 85 $ hg merge
85 86 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
86 87 (branch merge, don't forget to commit)
87 88 $ hg parents
88 89 changeset: 4:a0546fcfe0fb
89 90 bookmark: e@diverged
90 91 user: test
91 92 date: Thu Jan 01 00:00:00 1970 +0000
92 93 summary: d
93 94
94 95 changeset: 5:26bee9c5bcf3
95 96 bookmark: e
96 97 parent: 3:b8f96cf4688b
97 98 user: test
98 99 date: Thu Jan 01 00:00:00 1970 +0000
99 100 summary: e
100 101
101 102 $ hg up -C e
102 103 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
103 104 (activating bookmark e)
104 105 $ hg bookmarks
105 106 b 1:d2ae7f538514
106 107 c 3:b8f96cf4688b
107 108 * e 5:26bee9c5bcf3
108 109 e@diverged 4:a0546fcfe0fb
109 110 $ hg merge
110 111 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
111 112 (branch merge, don't forget to commit)
112 113 $ hg commit -m'merge'
113 114 $ hg bookmarks
114 115 b 1:d2ae7f538514
115 116 c 3:b8f96cf4688b
116 117 * e 7:ca784329f0ba
117 118
118 119 # test warning when all heads are inactive bookmarks
119 120
120 121 $ hg up -C 6
121 122 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
122 123 (leaving bookmark e)
123 124 $ echo g > g
124 125 $ hg commit -Am 'g'
125 126 adding g
126 127 $ hg bookmark -i g
127 128 $ hg bookmarks
128 129 b 1:d2ae7f538514
129 130 c 3:b8f96cf4688b
130 131 e 7:ca784329f0ba
131 132 g 8:04dd21731d95
132 133 $ hg heads
133 134 changeset: 8:04dd21731d95
134 135 bookmark: g
135 136 tag: tip
136 137 parent: 6:be381d1126a0
137 138 user: test
138 139 date: Thu Jan 01 00:00:00 1970 +0000
139 140 summary: g
140 141
141 142 changeset: 7:ca784329f0ba
142 143 bookmark: e
143 144 parent: 5:26bee9c5bcf3
144 145 parent: 4:a0546fcfe0fb
145 146 user: test
146 147 date: Thu Jan 01 00:00:00 1970 +0000
147 148 summary: merge
148 149
149 150 $ hg merge
150 151 abort: heads are bookmarked - please merge with an explicit rev
151 152 (run 'hg heads' to see all heads, specify rev with -r)
152 153 [255]
@@ -1,105 +1,106 b''
1 1 $ echo "[extensions]" >> $HGRCPATH
2 2 $ echo "rebase=" >> $HGRCPATH
3 3
4 4 initialize repository
5 5
6 $ hg init
6 $ hg init repo
7 $ cd repo
7 8
8 9 $ echo 'a' > a
9 10 $ hg ci -A -m "0"
10 11 adding a
11 12
12 13 $ echo 'b' > b
13 14 $ hg ci -A -m "1"
14 15 adding b
15 16
16 17 $ hg up 0
17 18 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
18 19 $ echo 'c' > c
19 20 $ hg ci -A -m "2"
20 21 adding c
21 22 created new head
22 23
23 24 $ echo 'd' > d
24 25 $ hg ci -A -m "3"
25 26 adding d
26 27
27 28 $ hg bookmark -r 1 one
28 29 $ hg bookmark -r 3 two
29 30 $ hg up -q two
30 31
31 32 bookmark list
32 33
33 34 $ hg bookmark
34 35 one 1:925d80f479bb
35 36 * two 3:2ae46b1d99a7
36 37
37 38 rebase
38 39
39 40 $ hg rebase -s two -d one
40 41 rebasing 3:2ae46b1d99a7 two tip "3"
41 saved backup bundle to $TESTTMP/.hg/strip-backup/2ae46b1d99a7-e6b057bc-rebase.hg
42 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/2ae46b1d99a7-e6b057bc-rebase.hg
42 43
43 44 $ hg log
44 45 changeset: 3:42e5ed2cdcf4
45 46 bookmark: two
46 47 tag: tip
47 48 parent: 1:925d80f479bb
48 49 user: test
49 50 date: Thu Jan 01 00:00:00 1970 +0000
50 51 summary: 3
51 52
52 53 changeset: 2:db815d6d32e6
53 54 parent: 0:f7b1eb17ad24
54 55 user: test
55 56 date: Thu Jan 01 00:00:00 1970 +0000
56 57 summary: 2
57 58
58 59 changeset: 1:925d80f479bb
59 60 bookmark: one
60 61 user: test
61 62 date: Thu Jan 01 00:00:00 1970 +0000
62 63 summary: 1
63 64
64 65 changeset: 0:f7b1eb17ad24
65 66 user: test
66 67 date: Thu Jan 01 00:00:00 1970 +0000
67 68 summary: 0
68 69
69 70 aborted rebase should restore active bookmark.
70 71
71 72 $ hg up 1
72 73 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
73 74 (leaving bookmark two)
74 75 $ echo 'e' > d
75 76 $ hg ci -A -m "4"
76 77 adding d
77 78 created new head
78 79 $ hg bookmark three
79 80 $ hg rebase -s three -d two
80 81 rebasing 4:dd7c838e8362 three tip "4"
81 82 merging d
82 83 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
83 84 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
84 85 [240]
85 86 $ hg rebase --abort
86 87 rebase aborted
87 88 $ hg bookmark
88 89 one 1:925d80f479bb
89 90 * three 4:dd7c838e8362
90 91 two 3:42e5ed2cdcf4
91 92
92 93 after aborted rebase, restoring a bookmark that has been removed should not fail
93 94
94 95 $ hg rebase -s three -d two
95 96 rebasing 4:dd7c838e8362 three tip "4"
96 97 merging d
97 98 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
98 99 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
99 100 [240]
100 101 $ hg bookmark -d three
101 102 $ hg rebase --abort
102 103 rebase aborted
103 104 $ hg bookmark
104 105 one 1:925d80f479bb
105 106 two 3:42e5ed2cdcf4
@@ -1,127 +1,128 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3 $ echo 0 > a
3 4 $ echo 0 > b
4 5 $ hg ci -A -m m
5 6 adding a
6 7 adding b
7 8 $ hg rm a
8 9 $ hg cat a
9 10 0
10 11 $ hg cat --decode a # more tests in test-encode
11 12 0
12 13 $ echo 1 > b
13 14 $ hg ci -m m
14 15 $ echo 2 > b
15 16 $ hg cat -r 0 a
16 17 0
17 18 $ hg cat -r 0 b
18 19 0
19 20 $ hg cat -r 1 a
20 21 a: no such file in rev 7040230c159c
21 22 [1]
22 23 $ hg cat -r 1 b
23 24 1
24 25
25 26 Test multiple files
26 27
27 28 $ echo 3 > c
28 29 $ hg ci -Am addmore c
29 30 $ hg cat b c
30 31 1
31 32 3
32 33 $ hg cat .
33 34 1
34 35 3
35 36 $ hg cat . c
36 37 1
37 38 3
38 39
39 40 Test fileset
40 41
41 42 $ hg cat 'set:not(b) or a'
42 43 3
43 44 $ hg cat 'set:c or b'
44 45 1
45 46 3
46 47
47 48 $ mkdir tmp
48 49 $ hg cat --output tmp/HH_%H c
49 50 $ hg cat --output tmp/RR_%R c
50 51 $ hg cat --output tmp/h_%h c
51 52 $ hg cat --output tmp/r_%r c
52 53 $ hg cat --output tmp/%s_s c
53 54 $ hg cat --output tmp/%d%%_d c
54 55 $ hg cat --output tmp/%p_p c
55 56 $ hg log -r . --template "{rev}: {node|short}\n"
56 57 2: 45116003780e
57 58 $ find tmp -type f | sort
58 59 tmp/.%_d
59 60 tmp/HH_45116003780e3678b333fb2c99fa7d559c8457e9
60 61 tmp/RR_2
61 62 tmp/c_p
62 63 tmp/c_s
63 64 tmp/h_45116003780e
64 65 tmp/r_2
65 66
66 67 Test template output
67 68
68 69 $ hg --cwd tmp cat ../b ../c -T '== {path|relpath} ({path}) r{rev} ==\n{data}'
69 70 == ../b (b) r2 ==
70 71 1
71 72 == ../c (c) r2 ==
72 73 3
73 74
74 75 $ hg cat b c -Tjson --output -
75 76 [
76 77 {
77 78 "data": "1\n",
78 79 "path": "b"
79 80 },
80 81 {
81 82 "data": "3\n",
82 83 "path": "c"
83 84 }
84 85 ]
85 86
86 87 $ hg cat b c -Tjson --output 'tmp/%p.json'
87 88 $ cat tmp/b.json
88 89 [
89 90 {
90 91 "data": "1\n",
91 92 "path": "b"
92 93 }
93 94 ]
94 95 $ cat tmp/c.json
95 96 [
96 97 {
97 98 "data": "3\n",
98 99 "path": "c"
99 100 }
100 101 ]
101 102
102 103 Test working directory
103 104
104 105 $ echo b-wdir > b
105 106 $ hg cat -r 'wdir()' b
106 107 b-wdir
107 108
108 109 Environment variables are not visible by default
109 110
110 111 $ PATTERN='t4' hg log -r '.' -T "{ifcontains('PATTERN', envvars, 'yes', 'no')}\n"
111 112 no
112 113
113 114 Environment variable visibility can be explicit
114 115
115 116 $ PATTERN='t4' hg log -r '.' -T "{envvars % '{key} -> {value}\n'}" \
116 117 > --config "experimental.exportableenviron=PATTERN"
117 118 PATTERN -> t4
118 119
119 120 Test behavior of output when directory structure does not already exist
120 121
121 122 $ mkdir foo
122 123 $ echo a > foo/a
123 124 $ hg add foo/a
124 125 $ hg commit -qm "add foo/a"
125 126 $ hg cat --output "output/%p" foo/a
126 127 $ cat output/foo/a
127 128 a
@@ -1,112 +1,113 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3 $ echo foo > bar
3 4 $ hg commit -Am default
4 5 adding bar
5 6 $ hg up -r null
6 7 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
7 8 $ hg branch mine
8 9 marked working directory as branch mine
9 10 (branches are permanent and global, did you want a bookmark?)
10 11 $ echo hello > world
11 12 $ hg commit -Am hello
12 13 adding world
13 14 $ hg up -r null
14 15 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
15 16 $ hg branch other
16 17 marked working directory as branch other
17 18 $ echo good > bye
18 19 $ hg commit -Am other
19 20 adding bye
20 21 $ hg up -r mine
21 22 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
22 23
23 24 $ hg clone -U -u . .#other ../b -r 0 -r 1 -r 2 -b other
24 25 abort: cannot specify both --noupdate and --updaterev
25 26 [10]
26 27
27 28 $ hg clone -U .#other ../b -r 0 -r 1 -r 2 -b other
28 29 adding changesets
29 30 adding manifests
30 31 adding file changes
31 32 added 3 changesets with 3 changes to 3 files (+2 heads)
32 33 new changesets 8c68ee086fd0:fcc393352796
33 34 $ rm -rf ../b
34 35
35 36 $ hg clone -u . .#other ../b -r 0 -r 1 -r 2 -b other
36 37 adding changesets
37 38 adding manifests
38 39 adding file changes
39 40 added 3 changesets with 3 changes to 3 files (+2 heads)
40 41 new changesets 8c68ee086fd0:fcc393352796
41 42 updating to branch mine
42 43 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 44 $ rm -rf ../b
44 45
45 46 $ hg clone -u 0 .#other ../b -r 0 -r 1 -r 2 -b other
46 47 adding changesets
47 48 adding manifests
48 49 adding file changes
49 50 added 3 changesets with 3 changes to 3 files (+2 heads)
50 51 new changesets 8c68ee086fd0:fcc393352796
51 52 updating to branch default
52 53 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
53 54 $ rm -rf ../b
54 55
55 56 $ hg clone -u 1 .#other ../b -r 0 -r 1 -r 2 -b other
56 57 adding changesets
57 58 adding manifests
58 59 adding file changes
59 60 added 3 changesets with 3 changes to 3 files (+2 heads)
60 61 new changesets 8c68ee086fd0:fcc393352796
61 62 updating to branch mine
62 63 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
63 64 $ rm -rf ../b
64 65
65 66 $ hg clone -u 2 .#other ../b -r 0 -r 1 -r 2 -b other
66 67 adding changesets
67 68 adding manifests
68 69 adding file changes
69 70 added 3 changesets with 3 changes to 3 files (+2 heads)
70 71 new changesets 8c68ee086fd0:fcc393352796
71 72 updating to branch other
72 73 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
73 74 $ rm -rf ../b
74 75
75 76 Test -r mine ... mine is ignored:
76 77
77 78 $ hg clone -u 2 .#other ../b -r mine -r 0 -r 1 -r 2 -b other
78 79 adding changesets
79 80 adding manifests
80 81 adding file changes
81 82 added 3 changesets with 3 changes to 3 files (+2 heads)
82 83 new changesets 8c68ee086fd0:fcc393352796
83 84 updating to branch other
84 85 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
85 86 $ rm -rf ../b
86 87
87 88 $ hg clone .#other ../b -b default -b mine
88 89 adding changesets
89 90 adding manifests
90 91 adding file changes
91 92 added 3 changesets with 3 changes to 3 files (+2 heads)
92 93 new changesets 8c68ee086fd0:fcc393352796
93 94 updating to branch default
94 95 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
95 96 $ rm -rf ../b
96 97
97 98 $ hg clone .#other ../b
98 99 adding changesets
99 100 adding manifests
100 101 adding file changes
101 102 added 1 changesets with 1 changes to 1 files
102 103 new changesets fcc393352796
103 104 updating to branch other
104 105 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
105 106 $ rm -rf ../b
106 107
107 108 $ hg clone -U . ../c -r 1 -r 2 > /dev/null
108 109 $ hg clone ../c ../b
109 110 updating to branch other
110 111 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
111 112 $ rm -rf ../b ../c
112 113
@@ -1,1330 +1,1331 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3
3 4 Setup:
4 5
5 6 $ echo a >> a
6 7 $ hg ci -Am 'base'
7 8 adding a
8 9
9 10 Refuse to amend public csets:
10 11
11 12 $ hg phase -r . -p
12 13 $ hg ci --amend
13 14 abort: cannot amend public changesets: ad120869acf0
14 15 (see 'hg help phases' for details)
15 16 [10]
16 17 $ hg phase -r . -f -d
17 18
18 19 $ echo a >> a
19 20 $ hg ci -Am 'base1'
20 21
21 22 Nothing to amend:
22 23
23 24 $ hg ci --amend -m 'base1'
24 25 nothing changed
25 26 [1]
26 27
27 28 $ cat >> $HGRCPATH <<EOF
28 29 > [hooks]
29 30 > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE"
30 31 > EOF
31 32
32 33 Amending changeset with changes in working dir:
33 34 (and check that --message does not trigger an editor)
34 35
35 36 $ echo a >> a
36 37 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1'
37 38 pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149
38 39 43f1ba15f28a tip
39 saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-5ab4f721-amend.hg
40 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/489edb5b847d-5ab4f721-amend.hg
40 41 $ echo 'pretxncommit.foo = ' >> $HGRCPATH
41 42 $ hg diff -c .
42 43 diff -r ad120869acf0 -r 43f1ba15f28a a
43 44 --- a/a Thu Jan 01 00:00:00 1970 +0000
44 45 +++ b/a Thu Jan 01 00:00:00 1970 +0000
45 46 @@ -1,1 +1,3 @@
46 47 a
47 48 +a
48 49 +a
49 50 $ hg log
50 51 changeset: 1:43f1ba15f28a
51 52 tag: tip
52 53 user: test
53 54 date: Thu Jan 01 00:00:00 1970 +0000
54 55 summary: amend base1
55 56
56 57 changeset: 0:ad120869acf0
57 58 user: test
58 59 date: Thu Jan 01 00:00:00 1970 +0000
59 60 summary: base
60 61
61 62
62 63 Check proper abort for empty message
63 64
64 65 $ cat > editor.sh << '__EOF__'
65 66 > #!/bin/sh
66 67 > echo "" > "$1"
67 68 > __EOF__
68 69
69 70 Update the existing file to ensure that the dirstate is not in pending state
70 71 (where the status of some files in the working copy is not known yet). This in
71 72 turn ensures that when the transaction is aborted due to an empty message during
72 73 the amend, there should be no rollback.
73 74 $ echo a >> a
74 75
75 76 $ echo b > b
76 77 $ hg add b
77 78 $ hg summary
78 79 parent: 1:43f1ba15f28a tip
79 80 amend base1
80 81 branch: default
81 82 commit: 1 modified, 1 added, 1 unknown
82 83 update: (current)
83 84 phases: 2 draft
84 85 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
85 86 abort: empty commit message
86 87 [10]
87 88 $ hg summary
88 89 parent: 1:43f1ba15f28a tip
89 90 amend base1
90 91 branch: default
91 92 commit: 1 modified, 1 added, 1 unknown
92 93 update: (current)
93 94 phases: 2 draft
94 95
95 96 Add new file along with modified existing file:
96 97 $ hg ci --amend -m 'amend base1 new file'
97 saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-007467c2-amend.hg
98 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/43f1ba15f28a-007467c2-amend.hg
98 99
99 100 Remove file that was added in amended commit:
100 101 (and test logfile option)
101 102 (and test that logfile option do not trigger an editor)
102 103
103 104 $ hg rm b
104 105 $ echo 'amend base1 remove new file' > ../logfile
105 106 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile
106 saved backup bundle to $TESTTMP/.hg/strip-backup/c16295aaf401-1ada9901-amend.hg
107 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/c16295aaf401-1ada9901-amend.hg
107 108
108 109 $ hg cat b
109 110 b: no such file in rev 47343646fa3d
110 111 [1]
111 112
112 113 No changes, just a different message:
113 114
114 115 $ hg ci -v --amend -m 'no changes, new message'
115 116 amending changeset 47343646fa3d
116 117 copying changeset 47343646fa3d to ad120869acf0
117 118 committing files:
118 119 a
119 120 committing manifest
120 121 committing changelog
121 122 1 changesets found
122 123 uncompressed size of bundle content:
123 124 254 (changelog)
124 125 163 (manifests)
125 126 131 a
126 saved backup bundle to $TESTTMP/.hg/strip-backup/47343646fa3d-c2758885-amend.hg
127 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/47343646fa3d-c2758885-amend.hg
127 128 1 changesets found
128 129 uncompressed size of bundle content:
129 130 250 (changelog)
130 131 163 (manifests)
131 132 131 a
132 133 adding branch
133 134 adding changesets
134 135 adding manifests
135 136 adding file changes
136 137 added 1 changesets with 1 changes to 1 files
137 138 committed changeset 1:401431e913a1
138 139 $ hg diff -c .
139 140 diff -r ad120869acf0 -r 401431e913a1 a
140 141 --- a/a Thu Jan 01 00:00:00 1970 +0000
141 142 +++ b/a Thu Jan 01 00:00:00 1970 +0000
142 143 @@ -1,1 +1,4 @@
143 144 a
144 145 +a
145 146 +a
146 147 +a
147 148 $ hg log
148 149 changeset: 1:401431e913a1
149 150 tag: tip
150 151 user: test
151 152 date: Thu Jan 01 00:00:00 1970 +0000
152 153 summary: no changes, new message
153 154
154 155 changeset: 0:ad120869acf0
155 156 user: test
156 157 date: Thu Jan 01 00:00:00 1970 +0000
157 158 summary: base
158 159
159 160
160 161 Disable default date on commit so when -d isn't given, the old date is preserved:
161 162
162 163 $ echo '[defaults]' >> $HGRCPATH
163 164 $ echo 'commit=' >> $HGRCPATH
164 165
165 166 Test -u/-d:
166 167
167 168 $ cat > .hg/checkeditform.sh <<EOF
168 169 > env | grep HGEDITFORM
169 170 > true
170 171 > EOF
171 172 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0'
172 173 HGEDITFORM=commit.amend.normal
173 saved backup bundle to $TESTTMP/.hg/strip-backup/401431e913a1-5e8e532c-amend.hg
174 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/401431e913a1-5e8e532c-amend.hg
174 175 $ echo a >> a
175 176 $ hg ci --amend -u foo -d '1 0'
176 saved backup bundle to $TESTTMP/.hg/strip-backup/d96b1d28ae33-677e0afb-amend.hg
177 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d96b1d28ae33-677e0afb-amend.hg
177 178 $ hg log -r .
178 179 changeset: 1:a9a13940fc03
179 180 tag: tip
180 181 user: foo
181 182 date: Thu Jan 01 00:00:01 1970 +0000
182 183 summary: no changes, new message
183 184
184 185
185 186 Open editor with old commit message if a message isn't given otherwise:
186 187
187 188 $ cat > editor.sh << '__EOF__'
188 189 > #!/bin/sh
189 190 > cat $1
190 191 > echo "another precious commit message" > "$1"
191 192 > __EOF__
192 193
193 194 at first, test saving last-message.txt
194 195
195 196 $ cat > .hg/hgrc << '__EOF__'
196 197 > [hooks]
197 198 > pretxncommit.test-saving-last-message = false
198 199 > __EOF__
199 200
200 201 $ rm -f .hg/last-message.txt
201 202 $ hg commit --amend -v -m "message given from command line"
202 203 amending changeset a9a13940fc03
203 204 copying changeset a9a13940fc03 to ad120869acf0
204 205 committing files:
205 206 a
206 207 committing manifest
207 208 committing changelog
208 209 running hook pretxncommit.test-saving-last-message: false
209 210 transaction abort!
210 211 rollback completed
211 212 abort: pretxncommit.test-saving-last-message hook exited with status 1
212 213 [40]
213 214 $ cat .hg/last-message.txt
214 215 message given from command line (no-eol)
215 216
216 217 $ rm -f .hg/last-message.txt
217 218 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
218 219 amending changeset a9a13940fc03
219 220 copying changeset a9a13940fc03 to ad120869acf0
220 221 no changes, new message
221 222
222 223
223 224 HG: Enter commit message. Lines beginning with 'HG:' are removed.
224 225 HG: Leave message empty to abort commit.
225 226 HG: --
226 227 HG: user: foo
227 228 HG: branch 'default'
228 229 HG: changed a
229 230 committing files:
230 231 a
231 232 committing manifest
232 233 committing changelog
233 234 running hook pretxncommit.test-saving-last-message: false
234 235 transaction abort!
235 236 rollback completed
236 237 abort: pretxncommit.test-saving-last-message hook exited with status 1
237 238 [40]
238 239
239 240 $ cat .hg/last-message.txt
240 241 another precious commit message
241 242
242 243 $ cat > .hg/hgrc << '__EOF__'
243 244 > [hooks]
244 245 > pretxncommit.test-saving-last-message =
245 246 > __EOF__
246 247
247 248 then, test editing custom commit message
248 249
249 250 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
250 251 amending changeset a9a13940fc03
251 252 copying changeset a9a13940fc03 to ad120869acf0
252 253 no changes, new message
253 254
254 255
255 256 HG: Enter commit message. Lines beginning with 'HG:' are removed.
256 257 HG: Leave message empty to abort commit.
257 258 HG: --
258 259 HG: user: foo
259 260 HG: branch 'default'
260 261 HG: changed a
261 262 committing files:
262 263 a
263 264 committing manifest
264 265 committing changelog
265 266 1 changesets found
266 267 uncompressed size of bundle content:
267 268 249 (changelog)
268 269 163 (manifests)
269 270 133 a
270 saved backup bundle to $TESTTMP/.hg/strip-backup/a9a13940fc03-7c2e8674-amend.hg
271 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/a9a13940fc03-7c2e8674-amend.hg
271 272 1 changesets found
272 273 uncompressed size of bundle content:
273 274 257 (changelog)
274 275 163 (manifests)
275 276 133 a
276 277 adding branch
277 278 adding changesets
278 279 adding manifests
279 280 adding file changes
280 281 added 1 changesets with 1 changes to 1 files
281 282 committed changeset 1:64a124ba1b44
282 283
283 284 Same, but with changes in working dir (different code path):
284 285
285 286 $ echo a >> a
286 287 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
287 288 amending changeset 64a124ba1b44
288 289 another precious commit message
289 290
290 291
291 292 HG: Enter commit message. Lines beginning with 'HG:' are removed.
292 293 HG: Leave message empty to abort commit.
293 294 HG: --
294 295 HG: user: foo
295 296 HG: branch 'default'
296 297 HG: changed a
297 298 committing files:
298 299 a
299 300 committing manifest
300 301 committing changelog
301 302 1 changesets found
302 303 uncompressed size of bundle content:
303 304 257 (changelog)
304 305 163 (manifests)
305 306 133 a
306 saved backup bundle to $TESTTMP/.hg/strip-backup/64a124ba1b44-10374b8f-amend.hg
307 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/64a124ba1b44-10374b8f-amend.hg
307 308 1 changesets found
308 309 uncompressed size of bundle content:
309 310 257 (changelog)
310 311 163 (manifests)
311 312 135 a
312 313 adding branch
313 314 adding changesets
314 315 adding manifests
315 316 adding file changes
316 317 added 1 changesets with 1 changes to 1 files
317 318 committed changeset 1:7892795b8e38
318 319
319 320 $ rm editor.sh
320 321 $ hg log -r .
321 322 changeset: 1:7892795b8e38
322 323 tag: tip
323 324 user: foo
324 325 date: Thu Jan 01 00:00:01 1970 +0000
325 326 summary: another precious commit message
326 327
327 328
328 329 Moving bookmarks, preserve active bookmark:
329 330
330 331 $ hg book book1
331 332 $ hg book book2
332 333 $ hg ci --amend -m 'move bookmarks'
333 saved backup bundle to $TESTTMP/.hg/strip-backup/7892795b8e38-3fb46217-amend.hg
334 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/7892795b8e38-3fb46217-amend.hg
334 335 $ hg book
335 336 book1 1:8311f17e2616
336 337 * book2 1:8311f17e2616
337 338 $ echo a >> a
338 339 $ hg ci --amend -m 'move bookmarks'
339 saved backup bundle to $TESTTMP/.hg/strip-backup/8311f17e2616-f0504fe3-amend.hg
340 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/8311f17e2616-f0504fe3-amend.hg
340 341 $ hg book
341 342 book1 1:a3b65065808c
342 343 * book2 1:a3b65065808c
343 344
344 345 abort does not loose bookmarks
345 346
346 347 $ cat > editor.sh << '__EOF__'
347 348 > #!/bin/sh
348 349 > echo "" > "$1"
349 350 > __EOF__
350 351 $ echo a >> a
351 352 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
352 353 abort: empty commit message
353 354 [10]
354 355 $ hg book
355 356 book1 1:a3b65065808c
356 357 * book2 1:a3b65065808c
357 358 $ hg revert -Caq
358 359 $ rm editor.sh
359 360
360 361 $ echo '[defaults]' >> $HGRCPATH
361 362 $ echo "commit=-d '0 0'" >> $HGRCPATH
362 363
363 364 Moving branches:
364 365
365 366 $ hg branch foo
366 367 marked working directory as branch foo
367 368 (branches are permanent and global, did you want a bookmark?)
368 369 $ echo a >> a
369 370 $ hg ci -m 'branch foo'
370 371 $ hg branch default -f
371 372 marked working directory as branch default
372 373 $ hg ci --amend -m 'back to default'
373 saved backup bundle to $TESTTMP/.hg/strip-backup/f8339a38efe1-c18453c9-amend.hg
374 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/f8339a38efe1-c18453c9-amend.hg
374 375 $ hg branches
375 376 default 2:9c07515f2650
376 377
377 378 Close branch:
378 379
379 380 $ hg up -q 0
380 381 $ echo b >> b
381 382 $ hg branch foo
382 383 marked working directory as branch foo
383 384 (branches are permanent and global, did you want a bookmark?)
384 385 $ hg ci -Am 'fork'
385 386 adding b
386 387 $ echo b >> b
387 388 $ hg ci -mb
388 389 $ hg ci --amend --close-branch -m 'closing branch foo'
389 saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-54245dc7-amend.hg
390 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/c962248fa264-54245dc7-amend.hg
390 391
391 392 Same thing, different code path:
392 393
393 394 $ echo b >> b
394 395 $ hg ci -m 'reopen branch'
395 396 reopening closed branch head 4
396 397 $ echo b >> b
397 398 $ hg ci --amend --close-branch
398 saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-b900d9fa-amend.hg
399 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/027371728205-b900d9fa-amend.hg
399 400 $ hg branches
400 401 default 2:9c07515f2650
401 402
402 403 Refuse to amend during a merge:
403 404
404 405 $ hg up -q default
405 406 $ hg merge foo
406 407 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
407 408 (branch merge, don't forget to commit)
408 409 $ hg ci --amend
409 410 abort: cannot amend changesets while merging
410 411 [20]
411 412 $ hg ci -m 'merge'
412 413
413 414 Refuse to amend if there is a merge conflict (issue5805):
414 415
415 416 $ hg up -q foo
416 417 $ echo c > a
417 418 $ hg up default -t :fail
418 419 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
419 420 use 'hg resolve' to retry unresolved file merges
420 421 [1]
421 422 $ hg resolve -l
422 423 U a
423 424
424 425 $ hg ci --amend
425 426 abort: unresolved merge conflicts (see 'hg help resolve')
426 427 [20]
427 428
428 429 $ hg up -qC .
429 430
430 431 Follow copies/renames:
431 432
432 433 $ hg mv b c
433 434 $ hg ci -m 'b -> c'
434 435 $ hg mv c d
435 436 $ hg ci --amend -m 'b -> d'
436 saved backup bundle to $TESTTMP/.hg/strip-backup/42f3f27a067d-f23cc9f7-amend.hg
437 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/42f3f27a067d-f23cc9f7-amend.hg
437 438 $ hg st --rev '.^' --copies d
438 439 A d
439 440 b
440 441 $ hg cp d e
441 442 $ hg ci -m 'e = d'
442 443 $ hg cp e f
443 444 $ hg ci --amend -m 'f = d'
444 saved backup bundle to $TESTTMP/.hg/strip-backup/9198f73182d5-251d584a-amend.hg
445 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/9198f73182d5-251d584a-amend.hg
445 446 $ hg st --rev '.^' --copies f
446 447 A f
447 448 d
448 449
449 450 $ mv f f.orig
450 451 $ hg rm -A f
451 452 $ hg ci -m removef
452 453 $ hg cp a f
453 454 $ mv f.orig f
454 455 $ hg ci --amend -m replacef
455 saved backup bundle to $TESTTMP/.hg/strip-backup/f0993ab6b482-eda301bf-amend.hg
456 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/f0993ab6b482-eda301bf-amend.hg
456 457 $ hg st --change . --copies
457 458 $ hg log -r . --template "{file_copies}\n"
458 459
459 460
460 461 Move added file (issue3410):
461 462
462 463 $ echo g >> g
463 464 $ hg ci -Am g
464 465 adding g
465 466 $ hg mv g h
466 467 $ hg ci --amend
467 saved backup bundle to $TESTTMP/.hg/strip-backup/58585e3f095c-0f5ebcda-amend.hg
468 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/58585e3f095c-0f5ebcda-amend.hg
468 469 $ hg st --change . --copies h
469 470 A h
470 471 $ hg log -r . --template "{file_copies}\n"
471 472
472 473
473 474 Can't rollback an amend:
474 475
475 476 $ hg rollback
476 477 no rollback information available
477 478 [1]
478 479
479 480 Preserve extra dict (issue3430):
480 481
481 482 $ hg branch a
482 483 marked working directory as branch a
483 484 (branches are permanent and global, did you want a bookmark?)
484 485 $ echo a >> a
485 486 $ hg ci -ma
486 487 $ hg ci --amend -m "a'"
487 saved backup bundle to $TESTTMP/.hg/strip-backup/39a162f1d65e-9dfe13d8-amend.hg
488 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/39a162f1d65e-9dfe13d8-amend.hg
488 489 $ hg log -r . --template "{branch}\n"
489 490 a
490 491 $ hg ci --amend -m "a''"
491 saved backup bundle to $TESTTMP/.hg/strip-backup/d5ca7b1ac72b-0b4c1a34-amend.hg
492 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d5ca7b1ac72b-0b4c1a34-amend.hg
492 493 $ hg log -r . --template "{branch}\n"
493 494 a
494 495
495 496 Also preserve other entries in the dict that are in the old commit,
496 497 first graft something so there's an additional entry:
497 498
498 499 $ hg up 0 -q
499 500 $ echo z > z
500 501 $ hg ci -Am 'fork'
501 502 adding z
502 503 created new head
503 504 $ hg up 11
504 505 5 files updated, 0 files merged, 1 files removed, 0 files unresolved
505 506 $ hg graft 12
506 507 grafting 12:2647734878ef "fork" (tip)
507 508 $ hg ci --amend -m 'graft amend'
508 saved backup bundle to $TESTTMP/.hg/strip-backup/fe8c6f7957ca-25638666-amend.hg
509 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/fe8c6f7957ca-25638666-amend.hg
509 510 $ hg log -r . --debug | grep extra
510 511 extra: amend_source=fe8c6f7957ca1665ed77496ed7a07657d469ac60
511 512 extra: branch=a
512 513 extra: source=2647734878ef0236dda712fae9c1651cf694ea8a
513 514
514 515 Preserve phase
515 516
516 517 $ hg phase '.^::.'
517 518 11: draft
518 519 13: draft
519 520 $ hg phase --secret --force .
520 521 $ hg phase '.^::.'
521 522 11: draft
522 523 13: secret
523 524 $ hg commit --amend -m 'amend for phase' -q
524 525 $ hg phase '.^::.'
525 526 11: draft
526 527 13: secret
527 528
528 529 Test amend with obsolete
529 530 ---------------------------
530 531
531 532 Enable obsolete
532 533
533 534 $ cat >> $HGRCPATH << EOF
534 535 > [experimental]
535 536 > evolution.createmarkers=True
536 537 > evolution.allowunstable=True
537 538 > EOF
538 539
539 540 Amend with no files changes
540 541
541 542 $ hg id -n
542 543 13
543 544 $ hg ci --amend -m 'babar'
544 545 $ hg id -n
545 546 14
546 547 $ hg log -Gl 3 --style=compact
547 548 @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test
548 549 | babar
549 550 |
550 551 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
551 552 | | fork
552 553 | ~
553 554 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
554 555 | a''
555 556 ~
556 557 $ hg log -Gl 4 --hidden --style=compact
557 558 @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test
558 559 | babar
559 560 |
560 561 | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test
561 562 |/ amend for phase
562 563 |
563 564 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
564 565 | | fork
565 566 | ~
566 567 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
567 568 | a''
568 569 ~
569 570
570 571 Amend with files changes
571 572
572 573 (note: the extra commit over 15 is a temporary junk I would be happy to get
573 574 ride of)
574 575
575 576 $ echo 'babar' >> a
576 577 $ hg commit --amend
577 578 $ hg log -Gl 6 --hidden --style=compact
578 579 @ 15[tip]:11 a5b42b49b0d5 1970-01-01 00:00 +0000 test
579 580 | babar
580 581 |
581 582 | x 14:11 682950e85999 1970-01-01 00:00 +0000 test
582 583 |/ babar
583 584 |
584 585 | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test
585 586 |/ amend for phase
586 587 |
587 588 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
588 589 | | fork
589 590 | ~
590 591 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
591 592 | a''
592 593 |
593 594 o 10 5fa75032e226 1970-01-01 00:00 +0000 test
594 595 | g
595 596 ~
596 597
597 598
598 599 Test that amend does not make it easy to create obsolescence cycle
599 600 ---------------------------------------------------------------------
600 601
601 602 $ hg id -r 14 --hidden
602 603 682950e85999 (a)
603 604 $ hg revert -ar 14 --hidden
604 605 reverting a
605 606 $ hg commit --amend
606 607 $ hg id
607 608 37973c7e0b61 (a) tip
608 609
609 610 Test that rewriting leaving instability behind is allowed
610 611 ---------------------------------------------------------------------
611 612
612 613 $ hg up '.^'
613 614 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
614 615 $ echo 'b' >> a
615 616 $ hg log --style compact -r 'children(.)'
616 617 16[tip]:11 37973c7e0b61 1970-01-01 00:00 +0000 test
617 618 babar
618 619
619 620 $ hg commit --amend
620 621 1 new orphan changesets
621 622 $ hg log -r 'orphan()'
622 623 changeset: 16:37973c7e0b61
623 624 branch: a
624 625 parent: 11:0ddb275cfad1
625 626 user: test
626 627 date: Thu Jan 01 00:00:00 1970 +0000
627 628 instability: orphan
628 629 summary: babar
629 630
630 631
631 632 Amend a merge changeset (with renames and conflicts from the second parent):
632 633
633 634 $ hg up -q default
634 635 $ hg branch -q bar
635 636 $ hg cp a aa
636 637 $ hg mv z zz
637 638 $ echo cc > cc
638 639 $ hg add cc
639 640 $ hg ci -m aazzcc
640 641 $ hg up -q default
641 642 $ echo a >> a
642 643 $ echo dd > cc
643 644 $ hg add cc
644 645 $ hg ci -m aa
645 646 $ hg merge -q bar
646 647 warning: conflicts while merging cc! (edit, then use 'hg resolve --mark')
647 648 [1]
648 649 $ hg resolve -m cc
649 650 (no more unresolved files)
650 651 $ hg ci -m 'merge bar'
651 652 $ hg log --config diff.git=1 -pr .
652 653 changeset: 20:5aba7f3726e6
653 654 tag: tip
654 655 parent: 19:30d96aeaf27b
655 656 parent: 18:1aa437659d19
656 657 user: test
657 658 date: Thu Jan 01 00:00:00 1970 +0000
658 659 summary: merge bar
659 660
660 661 diff --git a/a b/aa
661 662 copy from a
662 663 copy to aa
663 664 diff --git a/cc b/cc
664 665 --- a/cc
665 666 +++ b/cc
666 667 @@ -1,1 +1,5 @@
667 668 +<<<<<<< working copy: 30d96aeaf27b - test: aa
668 669 dd
669 670 +=======
670 671 +cc
671 672 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
672 673 diff --git a/z b/zz
673 674 rename from z
674 675 rename to zz
675 676
676 677 $ hg debugrename aa
677 678 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
678 679 $ hg debugrename zz
679 680 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
680 681 $ hg debugrename cc
681 682 cc not renamed
682 683 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit
683 684 HGEDITFORM=commit.amend.merge
684 685 $ hg log --config diff.git=1 -pr .
685 686 changeset: 21:4b0631ef043e
686 687 tag: tip
687 688 parent: 19:30d96aeaf27b
688 689 parent: 18:1aa437659d19
689 690 user: test
690 691 date: Thu Jan 01 00:00:00 1970 +0000
691 692 summary: merge bar (amend message)
692 693
693 694 diff --git a/a b/aa
694 695 copy from a
695 696 copy to aa
696 697 diff --git a/cc b/cc
697 698 --- a/cc
698 699 +++ b/cc
699 700 @@ -1,1 +1,5 @@
700 701 +<<<<<<< working copy: 30d96aeaf27b - test: aa
701 702 dd
702 703 +=======
703 704 +cc
704 705 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
705 706 diff --git a/z b/zz
706 707 rename from z
707 708 rename to zz
708 709
709 710 $ hg debugrename aa
710 711 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
711 712 $ hg debugrename zz
712 713 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
713 714 $ hg debugrename cc
714 715 cc not renamed
715 716 $ hg mv zz z
716 717 $ hg ci --amend -m 'merge bar (undo rename)'
717 718 $ hg log --config diff.git=1 -pr .
718 719 changeset: 22:06423be42d60
719 720 tag: tip
720 721 parent: 19:30d96aeaf27b
721 722 parent: 18:1aa437659d19
722 723 user: test
723 724 date: Thu Jan 01 00:00:00 1970 +0000
724 725 summary: merge bar (undo rename)
725 726
726 727 diff --git a/a b/aa
727 728 copy from a
728 729 copy to aa
729 730 diff --git a/cc b/cc
730 731 --- a/cc
731 732 +++ b/cc
732 733 @@ -1,1 +1,5 @@
733 734 +<<<<<<< working copy: 30d96aeaf27b - test: aa
734 735 dd
735 736 +=======
736 737 +cc
737 738 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
738 739
739 740 $ hg debugrename z
740 741 z not renamed
741 742
742 743 Amend a merge changeset (with renames during the merge):
743 744
744 745 $ hg up -q bar
745 746 $ echo x > x
746 747 $ hg add x
747 748 $ hg ci -m x
748 749 $ hg up -q default
749 750 $ hg merge -q bar
750 751 $ hg mv aa aaa
751 752 $ echo aa >> aaa
752 753 $ hg ci -m 'merge bar again'
753 754 $ hg log --config diff.git=1 -pr .
754 755 changeset: 24:a89974a20457
755 756 tag: tip
756 757 parent: 22:06423be42d60
757 758 parent: 23:4c94d5bc65f5
758 759 user: test
759 760 date: Thu Jan 01 00:00:00 1970 +0000
760 761 summary: merge bar again
761 762
762 763 diff --git a/aa b/aa
763 764 deleted file mode 100644
764 765 --- a/aa
765 766 +++ /dev/null
766 767 @@ -1,2 +0,0 @@
767 768 -a
768 769 -a
769 770 diff --git a/aaa b/aaa
770 771 new file mode 100644
771 772 --- /dev/null
772 773 +++ b/aaa
773 774 @@ -0,0 +1,3 @@
774 775 +a
775 776 +a
776 777 +aa
777 778 diff --git a/x b/x
778 779 new file mode 100644
779 780 --- /dev/null
780 781 +++ b/x
781 782 @@ -0,0 +1,1 @@
782 783 +x
783 784
784 785 $ hg debugrename aaa
785 786 aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980
786 787
787 788 Update to p1 with 'aaa' modified. 'aaa' was renamed from 'aa' in p2. 'aa' exists
788 789 in p1 too, but it was recorded as copied from p2.
789 790 $ echo modified >> aaa
790 791 $ hg co -m '.^' -t :merge3
791 792 file 'aaa' was deleted in other [destination] but was modified in local [working copy].
792 793 You can use (c)hanged version, (d)elete, or leave (u)nresolved.
793 794 What do you want to do? u
794 795 1 files updated, 0 files merged, 1 files removed, 1 files unresolved
795 796 use 'hg resolve' to retry unresolved file merges
796 797 [1]
797 798 $ hg co -C tip
798 799 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
799 800
800 801 $ hg mv aaa aa
801 802 $ hg ci --amend -m 'merge bar again (undo rename)'
802 803 $ hg log --config diff.git=1 -pr .
803 804 changeset: 25:282080768800
804 805 tag: tip
805 806 parent: 22:06423be42d60
806 807 parent: 23:4c94d5bc65f5
807 808 user: test
808 809 date: Thu Jan 01 00:00:00 1970 +0000
809 810 summary: merge bar again (undo rename)
810 811
811 812 diff --git a/aa b/aa
812 813 --- a/aa
813 814 +++ b/aa
814 815 @@ -1,2 +1,3 @@
815 816 a
816 817 a
817 818 +aa
818 819 diff --git a/x b/x
819 820 new file mode 100644
820 821 --- /dev/null
821 822 +++ b/x
822 823 @@ -0,0 +1,1 @@
823 824 +x
824 825
825 826 $ hg debugrename aa
826 827 aa not renamed
827 828 $ hg debugrename -r '.^' aa
828 829 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
829 830
830 831 Amend a merge changeset (with manifest-level conflicts):
831 832
832 833 $ hg up -q bar
833 834 $ hg rm aa
834 835 $ hg ci -m 'rm aa'
835 836 $ hg up -q default
836 837 $ echo aa >> aa
837 838 $ hg ci -m aa
838 839 $ hg merge -q bar --config ui.interactive=True << EOF
839 840 > c
840 841 > EOF
841 842 file 'aa' was deleted in other [merge rev] but was modified in local [working copy].
842 843 You can use (c)hanged version, (d)elete, or leave (u)nresolved.
843 844 What do you want to do? c
844 845 $ hg ci -m 'merge bar (with conflicts)'
845 846 $ hg log --config diff.git=1 -pr .
846 847 changeset: 28:ed15db12298d
847 848 tag: tip
848 849 parent: 27:eb5adec0b43b
849 850 parent: 26:67db8847a540
850 851 user: test
851 852 date: Thu Jan 01 00:00:00 1970 +0000
852 853 summary: merge bar (with conflicts)
853 854
854 855
855 856 $ hg rm aa
856 857 $ hg ci --amend -m 'merge bar (with conflicts, amended)'
857 858 $ hg log --config diff.git=1 -pr .
858 859 changeset: 29:0eeafd043f63
859 860 tag: tip
860 861 parent: 27:eb5adec0b43b
861 862 parent: 26:67db8847a540
862 863 user: test
863 864 date: Thu Jan 01 00:00:00 1970 +0000
864 865 summary: merge bar (with conflicts, amended)
865 866
866 867 diff --git a/aa b/aa
867 868 deleted file mode 100644
868 869 --- a/aa
869 870 +++ /dev/null
870 871 @@ -1,4 +0,0 @@
871 872 -a
872 873 -a
873 874 -aa
874 875 -aa
875 876
876 877 Issue 3445: amending with --close-branch a commit that created a new head should fail
877 878 This shouldn't be possible:
878 879
879 880 $ hg up -q default
880 881 $ hg branch closewithamend
881 882 marked working directory as branch closewithamend
882 883 $ echo foo > foo
883 884 $ hg add foo
884 885 $ hg ci -m..
885 886 $ hg ci --amend --close-branch -m 'closing'
886 887 abort: can only close branch heads
887 888 [10]
888 889
889 890 This silliness fails:
890 891
891 892 $ hg branch silliness
892 893 marked working directory as branch silliness
893 894 $ echo b >> b
894 895 $ hg ci --close-branch -m'open and close'
895 896 abort: branch "silliness" has no heads to close
896 897 [10]
897 898
898 899 Test that amend with --secret creates new secret changeset forcibly
899 900 ---------------------------------------------------------------------
900 901
901 902 $ hg phase '.^::.'
902 903 29: draft
903 904 30: draft
904 905 $ hg commit --amend --secret -m 'amend as secret' -q
905 906 $ hg phase '.^::.'
906 907 29: draft
907 908 31: secret
908 909
909 910 Test that amend with --edit invokes editor forcibly
910 911 ---------------------------------------------------
911 912
912 913 $ hg parents --template "{desc}\n"
913 914 amend as secret
914 915 $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed"
915 916 $ hg parents --template "{desc}\n"
916 917 editor should be suppressed
917 918
918 919 $ hg status --rev '.^1::.'
919 920 A foo
920 921 $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit
921 922 editor should be invoked
922 923
923 924
924 925 HG: Enter commit message. Lines beginning with 'HG:' are removed.
925 926 HG: Leave message empty to abort commit.
926 927 HG: --
927 928 HG: user: test
928 929 HG: branch 'silliness'
929 930 HG: added foo
930 931 $ hg parents --template "{desc}\n"
931 932 editor should be invoked
932 933
933 934 Test that amend with --no-edit avoids the editor
934 935 ------------------------------------------------
935 936
936 937 $ hg commit --amend -m "before anything happens"
937 938 $ hg parents --template "{desc}\n"
938 939 before anything happens
939 940 $ HGEDITOR=cat hg commit --amend --no-edit -m "editor should be suppressed"
940 941 $ hg parents --template "{desc}\n"
941 942 editor should be suppressed
942 943
943 944 (We need a file change here since we won't have a message change)
944 945 $ cp foo foo.orig
945 946 $ echo hi >> foo
946 947 $ HGEDITOR=cat hg commit --amend --no-edit
947 948 $ hg parents --template "{desc}\n"
948 949 editor should be suppressed
949 950 $ hg status -mar
950 951 (Let's undo adding that "hi" so later tests don't need to be adjusted)
951 952 $ mv foo.orig foo
952 953 $ hg commit --amend --no-edit
953 954
954 955 Test that "diff()" in committemplate works correctly for amending
955 956 -----------------------------------------------------------------
956 957
957 958 $ cat >> .hg/hgrc <<EOF
958 959 > [committemplate]
959 960 > changeset.commit.amend = {desc}\n
960 961 > HG: {revset('parents()') % 'parent: {desc|firstline}\n'}
961 962 > HG: M: {file_mods}
962 963 > HG: A: {file_adds}
963 964 > HG: R: {file_dels}
964 965 > {splitlines(diff()) % 'HG: {line}\n'}
965 966 > EOF
966 967
967 968 $ hg parents --template "M: {file_mods}\nA: {file_adds}\nR: {file_dels}\n"
968 969 M:
969 970 A: foo
970 971 R:
971 972 $ hg status -amr
972 973 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo"
973 974 expecting diff of foo
974 975
975 976 HG: parent: editor should be suppressed
976 977
977 978 HG: M:
978 979 HG: A: foo
979 980 HG: R:
980 981 HG: diff -r 0eeafd043f63 foo
981 982 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
982 983 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
983 984 HG: @@ -0,0 +1,1 @@
984 985 HG: +foo
985 986
986 987 $ echo y > y
987 988 $ hg add y
988 989 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo and y"
989 990 expecting diff of foo and y
990 991
991 992 HG: parent: expecting diff of foo
992 993
993 994 HG: M:
994 995 HG: A: foo y
995 996 HG: R:
996 997 HG: diff -r 0eeafd043f63 foo
997 998 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
998 999 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
999 1000 HG: @@ -0,0 +1,1 @@
1000 1001 HG: +foo
1001 1002 HG: diff -r 0eeafd043f63 y
1002 1003 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1003 1004 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1004 1005 HG: @@ -0,0 +1,1 @@
1005 1006 HG: +y
1006 1007
1007 1008 $ hg rm a
1008 1009 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo and y"
1009 1010 expecting diff of a, foo and y
1010 1011
1011 1012 HG: parent: expecting diff of foo and y
1012 1013
1013 1014 HG: M:
1014 1015 HG: A: foo y
1015 1016 HG: R: a
1016 1017 HG: diff -r 0eeafd043f63 a
1017 1018 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1018 1019 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1019 1020 HG: @@ -1,2 +0,0 @@
1020 1021 HG: -a
1021 1022 HG: -a
1022 1023 HG: diff -r 0eeafd043f63 foo
1023 1024 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1024 1025 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1025 1026 HG: @@ -0,0 +1,1 @@
1026 1027 HG: +foo
1027 1028 HG: diff -r 0eeafd043f63 y
1028 1029 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1029 1030 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1030 1031 HG: @@ -0,0 +1,1 @@
1031 1032 HG: +y
1032 1033
1033 1034 $ hg rm x
1034 1035 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo, x and y"
1035 1036 expecting diff of a, foo, x and y
1036 1037
1037 1038 HG: parent: expecting diff of a, foo and y
1038 1039
1039 1040 HG: M:
1040 1041 HG: A: foo y
1041 1042 HG: R: a x
1042 1043 HG: diff -r 0eeafd043f63 a
1043 1044 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1044 1045 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1045 1046 HG: @@ -1,2 +0,0 @@
1046 1047 HG: -a
1047 1048 HG: -a
1048 1049 HG: diff -r 0eeafd043f63 foo
1049 1050 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1050 1051 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1051 1052 HG: @@ -0,0 +1,1 @@
1052 1053 HG: +foo
1053 1054 HG: diff -r 0eeafd043f63 x
1054 1055 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1055 1056 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1056 1057 HG: @@ -1,1 +0,0 @@
1057 1058 HG: -x
1058 1059 HG: diff -r 0eeafd043f63 y
1059 1060 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1060 1061 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1061 1062 HG: @@ -0,0 +1,1 @@
1062 1063 HG: +y
1063 1064
1064 1065 $ echo cccc >> cc
1065 1066 $ hg status -amr
1066 1067 M cc
1067 1068 $ HGEDITOR=cat hg commit --amend -e -m "cc should be excluded" -X cc
1068 1069 cc should be excluded
1069 1070
1070 1071 HG: parent: expecting diff of a, foo, x and y
1071 1072
1072 1073 HG: M:
1073 1074 HG: A: foo y
1074 1075 HG: R: a x
1075 1076 HG: diff -r 0eeafd043f63 a
1076 1077 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1077 1078 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1078 1079 HG: @@ -1,2 +0,0 @@
1079 1080 HG: -a
1080 1081 HG: -a
1081 1082 HG: diff -r 0eeafd043f63 foo
1082 1083 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1083 1084 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1084 1085 HG: @@ -0,0 +1,1 @@
1085 1086 HG: +foo
1086 1087 HG: diff -r 0eeafd043f63 x
1087 1088 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1088 1089 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1089 1090 HG: @@ -1,1 +0,0 @@
1090 1091 HG: -x
1091 1092 HG: diff -r 0eeafd043f63 y
1092 1093 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1093 1094 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1094 1095 HG: @@ -0,0 +1,1 @@
1095 1096 HG: +y
1096 1097
1097 1098 Check for issue4405
1098 1099 -------------------
1099 1100
1100 1101 Setup the repo with a file that gets moved in a second commit.
1101 1102 $ hg init repo
1102 1103 $ cd repo
1103 1104 $ touch a0
1104 1105 $ hg add a0
1105 1106 $ hg commit -m a0
1106 1107 $ hg mv a0 a1
1107 1108 $ hg commit -m a1
1108 1109 $ hg up -q 0
1109 1110 $ hg log -G --template '{rev} {desc}'
1110 1111 o 1 a1
1111 1112 |
1112 1113 @ 0 a0
1113 1114
1114 1115
1115 1116 Now we branch the repro, but re-use the file contents, so we have a divergence
1116 1117 in the file revlog topology and the changelog topology.
1117 1118 $ hg revert --rev 1 --all
1118 1119 removing a0
1119 1120 adding a1
1120 1121 $ hg ci -qm 'a1-amend'
1121 1122 $ hg log -G --template '{rev} {desc}'
1122 1123 @ 2 a1-amend
1123 1124 |
1124 1125 | o 1 a1
1125 1126 |/
1126 1127 o 0 a0
1127 1128
1128 1129
1129 1130 The way mercurial does amends is by folding the working copy and old commit
1130 1131 together into another commit (rev 3). During this process, _findlimit is called
1131 1132 to check how far back to look for the transitive closure of file copy
1132 1133 information, but due to the divergence of the filelog and changelog graph
1133 1134 topologies, before _findlimit was fixed, it returned a rev which was not far
1134 1135 enough back in this case.
1135 1136 $ hg mv a1 a2
1136 1137 $ hg status --copies --rev 0
1137 1138 A a2
1138 1139 a0
1139 1140 R a0
1140 1141 $ hg ci --amend -q
1141 1142 $ hg log -G --template '{rev} {desc}'
1142 1143 @ 3 a1-amend
1143 1144 |
1144 1145 | o 1 a1
1145 1146 |/
1146 1147 o 0 a0
1147 1148
1148 1149
1149 1150 Before the fix, the copy information was lost.
1150 1151 $ hg status --copies --rev 0
1151 1152 A a2
1152 1153 a0
1153 1154 R a0
1154 1155 $ cd ..
1155 1156
1156 1157 Check that amend properly preserve rename from directory rename (issue-4516)
1157 1158
1158 1159 If a parent of the merge renames a full directory, any files added to the old
1159 1160 directory in the other parent will be renamed to the new directory. For some
1160 1161 reason, the rename metadata was when amending such merge. This test ensure we
1161 1162 do not regress. We have a dedicated repo because it needs a setup with renamed
1162 1163 directory)
1163 1164
1164 1165 $ hg init issue4516
1165 1166 $ cd issue4516
1166 1167 $ mkdir olddirname
1167 1168 $ echo line1 > olddirname/commonfile.py
1168 1169 $ hg add olddirname/commonfile.py
1169 1170 $ hg ci -m first
1170 1171
1171 1172 $ hg branch newdirname
1172 1173 marked working directory as branch newdirname
1173 1174 (branches are permanent and global, did you want a bookmark?)
1174 1175 $ hg mv olddirname newdirname
1175 1176 moving olddirname/commonfile.py to newdirname/commonfile.py
1176 1177 $ hg ci -m rename
1177 1178
1178 1179 $ hg update default
1179 1180 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1180 1181 $ echo line1 > olddirname/newfile.py
1181 1182 $ hg add olddirname/newfile.py
1182 1183 $ hg ci -m log
1183 1184
1184 1185 $ hg up newdirname
1185 1186 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1186 1187 $ # create newdirname/newfile.py
1187 1188 $ hg merge default
1188 1189 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1189 1190 (branch merge, don't forget to commit)
1190 1191 $ hg ci -m add
1191 1192 $
1192 1193 $ hg debugrename newdirname/newfile.py
1193 1194 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
1194 1195 $ hg status -C --change .
1195 1196 A newdirname/newfile.py
1196 1197 $ hg status -C --rev 1
1197 1198 A newdirname/newfile.py
1198 1199 $ hg status -C --rev 2
1199 1200 A newdirname/commonfile.py
1200 1201 olddirname/commonfile.py
1201 1202 A newdirname/newfile.py
1202 1203 olddirname/newfile.py
1203 1204 R olddirname/commonfile.py
1204 1205 R olddirname/newfile.py
1205 1206 $ hg debugindex newdirname/newfile.py
1206 1207 rev linkrev nodeid p1-nodeid p2-nodeid
1207 1208 0 3 34a4d536c0c0 000000000000 000000000000
1208 1209
1209 1210 $ echo a >> newdirname/commonfile.py
1210 1211 $ hg ci --amend -m bug
1211 1212 $ hg debugrename newdirname/newfile.py
1212 1213 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
1213 1214 $ hg debugindex newdirname/newfile.py
1214 1215 rev linkrev nodeid p1-nodeid p2-nodeid
1215 1216 0 3 34a4d536c0c0 000000000000 000000000000
1216 1217
1217 1218 #if execbit
1218 1219
1219 1220 Test if amend preserves executable bit changes
1220 1221 $ chmod +x newdirname/commonfile.py
1221 1222 $ hg ci -m chmod
1222 1223 $ hg ci --amend -m "chmod amended"
1223 1224 $ hg ci --amend -m "chmod amended second time"
1224 1225 $ hg log -p --git -r .
1225 1226 changeset: 7:b1326f52dddf
1226 1227 branch: newdirname
1227 1228 tag: tip
1228 1229 parent: 4:7fd235f7cb2f
1229 1230 user: test
1230 1231 date: Thu Jan 01 00:00:00 1970 +0000
1231 1232 summary: chmod amended second time
1232 1233
1233 1234 diff --git a/newdirname/commonfile.py b/newdirname/commonfile.py
1234 1235 old mode 100644
1235 1236 new mode 100755
1236 1237
1237 1238 #endif
1238 1239
1239 1240 Test amend with file inclusion options
1240 1241 --------------------------------------
1241 1242
1242 1243 These tests ensure that we are always amending some files that were part of the
1243 1244 pre-amend commit. We want to test that the remaining files in the pre-amend
1244 1245 commit were not changed in the amended commit. We do so by performing a diff of
1245 1246 the amended commit against its parent commit.
1246 1247 $ cd ..
1247 1248 $ hg init testfileinclusions
1248 1249 $ cd testfileinclusions
1249 1250 $ echo a > a
1250 1251 $ echo b > b
1251 1252 $ hg commit -Aqm "Adding a and b"
1252 1253
1253 1254 Only add changes to a particular file
1254 1255 $ echo a >> a
1255 1256 $ echo b >> b
1256 1257 $ hg commit --amend -I a
1257 1258 $ hg diff --git -r null -r .
1258 1259 diff --git a/a b/a
1259 1260 new file mode 100644
1260 1261 --- /dev/null
1261 1262 +++ b/a
1262 1263 @@ -0,0 +1,2 @@
1263 1264 +a
1264 1265 +a
1265 1266 diff --git a/b b/b
1266 1267 new file mode 100644
1267 1268 --- /dev/null
1268 1269 +++ b/b
1269 1270 @@ -0,0 +1,1 @@
1270 1271 +b
1271 1272
1272 1273 $ echo a >> a
1273 1274 $ hg commit --amend b
1274 1275 $ hg diff --git -r null -r .
1275 1276 diff --git a/a b/a
1276 1277 new file mode 100644
1277 1278 --- /dev/null
1278 1279 +++ b/a
1279 1280 @@ -0,0 +1,2 @@
1280 1281 +a
1281 1282 +a
1282 1283 diff --git a/b b/b
1283 1284 new file mode 100644
1284 1285 --- /dev/null
1285 1286 +++ b/b
1286 1287 @@ -0,0 +1,2 @@
1287 1288 +b
1288 1289 +b
1289 1290
1290 1291 Exclude changes to a particular file
1291 1292 $ echo b >> b
1292 1293 $ hg commit --amend -X a
1293 1294 $ hg diff --git -r null -r .
1294 1295 diff --git a/a b/a
1295 1296 new file mode 100644
1296 1297 --- /dev/null
1297 1298 +++ b/a
1298 1299 @@ -0,0 +1,2 @@
1299 1300 +a
1300 1301 +a
1301 1302 diff --git a/b b/b
1302 1303 new file mode 100644
1303 1304 --- /dev/null
1304 1305 +++ b/b
1305 1306 @@ -0,0 +1,3 @@
1306 1307 +b
1307 1308 +b
1308 1309 +b
1309 1310
1310 1311 Check the addremove flag
1311 1312 $ echo c > c
1312 1313 $ rm a
1313 1314 $ hg commit --amend -A
1314 1315 removing a
1315 1316 adding c
1316 1317 $ hg diff --git -r null -r .
1317 1318 diff --git a/b b/b
1318 1319 new file mode 100644
1319 1320 --- /dev/null
1320 1321 +++ b/b
1321 1322 @@ -0,0 +1,3 @@
1322 1323 +b
1323 1324 +b
1324 1325 +b
1325 1326 diff --git a/c b/c
1326 1327 new file mode 100644
1327 1328 --- /dev/null
1328 1329 +++ b/c
1329 1330 @@ -0,0 +1,1 @@
1330 1331 +c
@@ -1,422 +1,423 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3 $ cat << EOF > a
3 4 > Small Mathematical Series.
4 5 > One
5 6 > Two
6 7 > Three
7 8 > Four
8 9 > Five
9 10 > Hop we are done.
10 11 > EOF
11 12 $ hg add a
12 13 $ hg commit -m ancestor
13 14 $ cat << EOF > a
14 15 > Small Mathematical Series.
15 16 > 1
16 17 > 2
17 18 > 3
18 19 > 4
19 20 > 5
20 21 > Hop we are done.
21 22 > EOF
22 23 $ hg commit -m branch1
23 24 $ hg co 0
24 25 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
25 26 $ cat << EOF > a
26 27 > Small Mathematical Series.
27 28 > 1
28 29 > 2
29 30 > 3
30 31 > 6
31 32 > 8
32 33 > Hop we are done.
33 34 > EOF
34 35 $ hg commit -m branch2
35 36 created new head
36 37
37 38 $ hg merge 1
38 39 merging a
39 40 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
40 41 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
41 42 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
42 43 [1]
43 44
44 45 $ hg id
45 46 618808747361+c0c68e4fe667+ tip
46 47
47 48 $ echo "[commands]" >> $HGRCPATH
48 49 $ echo "status.verbose=true" >> $HGRCPATH
49 50 $ hg status
50 51 M a
51 52 ? a.orig
52 53 # The repository is in an unfinished *merge* state.
53 54
54 55 # Unresolved merge conflicts:
55 56 #
56 57 # a
57 58 #
58 59 # To mark files as resolved: hg resolve --mark FILE
59 60
60 61 # To continue: hg commit
61 62 # To abort: hg merge --abort
62 63
63 64 $ hg status -Tjson
64 65 [
65 66 {
66 67 "itemtype": "file",
67 68 "path": "a",
68 69 "status": "M",
69 70 "unresolved": true
70 71 },
71 72 {
72 73 "itemtype": "file",
73 74 "path": "a.orig",
74 75 "status": "?"
75 76 },
76 77 {
77 78 "itemtype": "morestatus",
78 79 "unfinished": "merge",
79 80 "unfinishedmsg": "To continue: hg commit\nTo abort: hg merge --abort"
80 81 }
81 82 ]
82 83
83 84 $ hg status -0
84 85 M a\x00? a.orig\x00 (no-eol) (esc)
85 86 $ cat a
86 87 Small Mathematical Series.
87 88 1
88 89 2
89 90 3
90 91 <<<<<<< working copy: 618808747361 - test: branch2
91 92 6
92 93 8
93 94 =======
94 95 4
95 96 5
96 97 >>>>>>> merge rev: c0c68e4fe667 - test: branch1
97 98 Hop we are done.
98 99
99 100 $ hg status --config commands.status.verbose=0
100 101 M a
101 102 ? a.orig
102 103
103 104 Verify custom conflict markers
104 105
105 106 $ hg up -q --clean .
106 107 $ cat <<EOF >> .hg/hgrc
107 108 > [command-templates]
108 109 > mergemarker = '{author} {rev}'
109 110 > EOF
110 111
111 112 $ hg merge 1
112 113 merging a
113 114 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
114 115 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
115 116 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
116 117 [1]
117 118
118 119 $ cat a
119 120 Small Mathematical Series.
120 121 1
121 122 2
122 123 3
123 124 <<<<<<< working copy: test 2
124 125 6
125 126 8
126 127 =======
127 128 4
128 129 5
129 130 >>>>>>> merge rev: test 1
130 131 Hop we are done.
131 132
132 133 Verify custom conflict markers with legacy config name
133 134
134 135 $ hg up -q --clean .
135 136 $ cat <<EOF >> .hg/hgrc
136 137 > [ui]
137 138 > mergemarkertemplate = '{author} {rev}'
138 139 > EOF
139 140
140 141 $ hg merge 1
141 142 merging a
142 143 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
143 144 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
144 145 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
145 146 [1]
146 147
147 148 $ cat a
148 149 Small Mathematical Series.
149 150 1
150 151 2
151 152 3
152 153 <<<<<<< working copy: test 2
153 154 6
154 155 8
155 156 =======
156 157 4
157 158 5
158 159 >>>>>>> merge rev: test 1
159 160 Hop we are done.
160 161
161 162 Verify line splitting of custom conflict marker which causes multiple lines
162 163
163 164 $ hg up -q --clean .
164 165 $ cat >> .hg/hgrc <<EOF
165 166 > [command-templates]
166 167 > mergemarker={author} {rev}\nfoo\nbar\nbaz
167 168 > EOF
168 169
169 170 $ hg -q merge 1
170 171 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
171 172 [1]
172 173
173 174 $ cat a
174 175 Small Mathematical Series.
175 176 1
176 177 2
177 178 3
178 179 <<<<<<< working copy: test 2
179 180 6
180 181 8
181 182 =======
182 183 4
183 184 5
184 185 >>>>>>> merge rev: test 1
185 186 Hop we are done.
186 187
187 188 Verify line trimming of custom conflict marker using multi-byte characters
188 189
189 190 $ hg up -q --clean .
190 191 $ "$PYTHON" <<EOF
191 192 > fp = open('logfile', 'wb')
192 193 > fp.write(b'12345678901234567890123456789012345678901234567890' +
193 194 > b'1234567890') # there are 5 more columns for 80 columns
194 195 >
195 196 > # 2 x 4 = 8 columns, but 3 x 4 = 12 bytes
196 197 > fp.write(u'\u3042\u3044\u3046\u3048'.encode('utf-8'))
197 198 >
198 199 > fp.close()
199 200 > EOF
200 201 $ hg add logfile
201 202 $ hg --encoding utf-8 commit --logfile logfile
202 203
203 204 $ cat >> .hg/hgrc <<EOF
204 205 > [command-templates]
205 206 > mergemarker={desc|firstline}
206 207 > EOF
207 208
208 209 $ hg -q --encoding utf-8 merge 1
209 210 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
210 211 [1]
211 212
212 213 $ cat a
213 214 Small Mathematical Series.
214 215 1
215 216 2
216 217 3
217 218 <<<<<<< working copy: 1234567890123456789012345678901234567890123456789012345...
218 219 6
219 220 8
220 221 =======
221 222 4
222 223 5
223 224 >>>>>>> merge rev: branch1
224 225 Hop we are done.
225 226
226 227 Verify basic conflict markers
227 228
228 229 $ hg up -q --clean 2
229 230 $ printf "\n[ui]\nmergemarkers=basic\n" >> .hg/hgrc
230 231
231 232 $ hg merge 1
232 233 merging a
233 234 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
234 235 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
235 236 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
236 237 [1]
237 238
238 239 $ cat a
239 240 Small Mathematical Series.
240 241 1
241 242 2
242 243 3
243 244 <<<<<<< working copy
244 245 6
245 246 8
246 247 =======
247 248 4
248 249 5
249 250 >>>>>>> merge rev
250 251 Hop we are done.
251 252
252 253 internal:merge3
253 254
254 255 $ hg up -q --clean .
255 256
256 257 $ hg merge 1 --tool internal:merge3
257 258 merging a
258 259 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
259 260 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
260 261 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
261 262 [1]
262 263 $ cat a
263 264 Small Mathematical Series.
264 265 <<<<<<< working copy
265 266 1
266 267 2
267 268 3
268 269 6
269 270 8
270 271 ||||||| common ancestor
271 272 One
272 273 Two
273 274 Three
274 275 Four
275 276 Five
276 277 =======
277 278 1
278 279 2
279 280 3
280 281 4
281 282 5
282 283 >>>>>>> merge rev
283 284 Hop we are done.
284 285
285 286 internal:mergediff
286 287
287 288 $ hg co -C 1
288 289 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
289 290 $ cat << EOF > a
290 291 > Small Mathematical Series.
291 292 > 1
292 293 > 2
293 294 > 3
294 295 > 4
295 296 > 4.5
296 297 > 5
297 298 > Hop we are done.
298 299 > EOF
299 300 $ hg co -m 2 -t internal:mergediff
300 301 merging a
301 302 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
302 303 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
303 304 use 'hg resolve' to retry unresolved file merges
304 305 [1]
305 306 $ cat a
306 307 Small Mathematical Series.
307 308 1
308 309 2
309 310 3
310 311 <<<<<<<
311 312 ------- working copy parent
312 313 +++++++ working copy
313 314 4
314 315 +4.5
315 316 5
316 317 ======= destination
317 318 6
318 319 8
319 320 >>>>>>>
320 321 Hop we are done.
321 322 Test the same thing as above but modify a bit more so we instead get the working
322 323 copy in full and the diff from base to destination.
323 324 $ hg co -C 1
324 325 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
325 326 $ cat << EOF > a
326 327 > Small Mathematical Series.
327 328 > 1
328 329 > 2
329 330 > 3.5
330 331 > 4.5
331 332 > 5.5
332 333 > Hop we are done.
333 334 > EOF
334 335 $ hg co -m 2 -t internal:mergediff
335 336 merging a
336 337 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
337 338 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
338 339 use 'hg resolve' to retry unresolved file merges
339 340 [1]
340 341 $ cat a
341 342 Small Mathematical Series.
342 343 1
343 344 2
344 345 <<<<<<<
345 346 ======= working copy
346 347 3.5
347 348 4.5
348 349 5.5
349 350 ------- working copy parent
350 351 +++++++ destination
351 352 3
352 353 -4
353 354 -5
354 355 +6
355 356 +8
356 357 >>>>>>>
357 358 Hop we are done.
358 359
359 360 Add some unconflicting changes on each head, to make sure we really
360 361 are merging, unlike :local and :other
361 362
362 363 $ hg up -C
363 364 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
364 365 updated to "e0693e20f496: 123456789012345678901234567890123456789012345678901234567890????"
365 366 1 other heads for branch "default"
366 367 $ printf "\n\nEnd of file\n" >> a
367 368 $ hg ci -m "Add some stuff at the end"
368 369 $ hg up -r 1
369 370 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
370 371 $ printf "Start of file\n\n\n" > tmp
371 372 $ cat a >> tmp
372 373 $ mv tmp a
373 374 $ hg ci -m "Add some stuff at the beginning"
374 375
375 376 Now test :merge-other and :merge-local
376 377
377 378 $ hg merge
378 379 merging a
379 380 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
380 381 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
381 382 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
382 383 [1]
383 384 $ hg resolve --tool :merge-other a
384 385 merging a
385 386 (no more unresolved files)
386 387 $ cat a
387 388 Start of file
388 389
389 390
390 391 Small Mathematical Series.
391 392 1
392 393 2
393 394 3
394 395 6
395 396 8
396 397 Hop we are done.
397 398
398 399
399 400 End of file
400 401
401 402 $ hg up -C
402 403 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
403 404 updated to "18b51d585961: Add some stuff at the beginning"
404 405 1 other heads for branch "default"
405 406 $ hg merge --tool :merge-local
406 407 merging a
407 408 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
408 409 (branch merge, don't forget to commit)
409 410 $ cat a
410 411 Start of file
411 412
412 413
413 414 Small Mathematical Series.
414 415 1
415 416 2
416 417 3
417 418 4
418 419 5
419 420 Hop we are done.
420 421
421 422
422 423 End of file
@@ -1,82 +1,83 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3 $ echo foo > a
3 4 $ hg add a
4 5 $ hg commit -m "1"
5 6
6 7 $ echo bar > b
7 8 $ hg add b
8 9 $ hg remove a
9 10
10 11 Should show a removed and b added:
11 12
12 13 $ hg status
13 14 A b
14 15 R a
15 16
16 17 $ hg revert --all
17 18 forgetting b
18 19 undeleting a
19 20
20 21 Should show b unknown and a back to normal:
21 22
22 23 $ hg status
23 24 ? b
24 25
25 26 $ rm b
26 27
27 28 $ hg co -C 0
28 29 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 30 $ echo foo-a > a
30 31 $ hg commit -m "2a"
31 32
32 33 $ hg co -C 0
33 34 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 35 $ echo foo-b > a
35 36 $ hg commit -m "2b"
36 37 created new head
37 38
38 39 $ HGMERGE=true hg merge 1
39 40 merging a
40 41 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
41 42 (branch merge, don't forget to commit)
42 43
43 44 Should show foo-b:
44 45
45 46 $ cat a
46 47 foo-b
47 48
48 49 $ echo bar > b
49 50 $ hg add b
50 51 $ rm a
51 52 $ hg remove a
52 53
53 54 Should show a removed and b added:
54 55
55 56 $ hg status
56 57 A b
57 58 R a
58 59
59 60 Revert should fail:
60 61
61 62 $ hg revert
62 63 abort: uncommitted merge with no revision specified
63 64 (use 'hg update' or see 'hg help revert')
64 65 [10]
65 66
66 67 Revert should be ok now:
67 68
68 69 $ hg revert -r2 --all
69 70 forgetting b
70 71 undeleting a
71 72
72 73 Should show b unknown and a marked modified (merged):
73 74
74 75 $ hg status
75 76 M a
76 77 ? b
77 78
78 79 Should show foo-b:
79 80
80 81 $ cat a
81 82 foo-b
82 83
@@ -1,67 +1,68 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3
3 4 $ cat > .hg/hgrc <<EOF
4 5 > [extensions]
5 6 > prefixfilter = prefix.py
6 7 > [encode]
7 8 > *.txt = stripprefix: Copyright 2046, The Masters
8 9 > [decode]
9 10 > *.txt = insertprefix: Copyright 2046, The Masters
10 11 > EOF
11 12
12 13 $ cat > prefix.py <<EOF
13 14 > from mercurial import error
14 15 > def stripprefix(s, cmd, filename, **kwargs):
15 16 > header = b'%s\n' % cmd
16 17 > if s[:len(header)] != header:
17 18 > raise error.Abort(b'missing header "%s" in %s' % (cmd, filename))
18 19 > return s[len(header):]
19 20 > def insertprefix(s, cmd):
20 21 > return b'%s\n%s' % (cmd, s)
21 22 > def reposetup(ui, repo):
22 23 > repo.adddatafilter(b'stripprefix:', stripprefix)
23 24 > repo.adddatafilter(b'insertprefix:', insertprefix)
24 25 > EOF
25 26
26 27 $ cat > .hgignore <<EOF
27 28 > .hgignore
28 29 > prefix.py
29 30 > prefix.pyc
30 31 > __pycache__/
31 32 > EOF
32 33
33 34 $ cat > stuff.txt <<EOF
34 35 > Copyright 2046, The Masters
35 36 > Some stuff to ponder very carefully.
36 37 > EOF
37 38 $ hg add stuff.txt
38 39 $ hg ci -m stuff
39 40
40 41 Repository data:
41 42
42 43 $ hg cat stuff.txt
43 44 Some stuff to ponder very carefully.
44 45
45 46 Fresh checkout:
46 47
47 48 $ rm stuff.txt
48 49 $ hg up -C
49 50 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
50 51 $ cat stuff.txt
51 52 Copyright 2046, The Masters
52 53 Some stuff to ponder very carefully.
53 54 $ echo "Very very carefully." >> stuff.txt
54 55 $ hg stat
55 56 M stuff.txt
56 57
57 58 $ echo "Unauthorized material subject to destruction." > morestuff.txt
58 59
59 60 Problem encoding:
60 61
61 62 $ hg add morestuff.txt
62 63 $ hg ci -m morestuff
63 64 abort: missing header "Copyright 2046, The Masters" in morestuff.txt
64 65 [255]
65 66 $ hg stat
66 67 M stuff.txt
67 68 A morestuff.txt
@@ -1,18 +1,19 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3 $ echo a > a
3 4 $ hg ci -Am t
4 5 adding a
5 6
6 7 $ hg mv a b
7 8 $ hg ci -Am t1
8 9 $ hg debugrename b
9 10 b renamed from a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
10 11
11 12 $ hg mv b a
12 13 $ hg ci -Am t2
13 14 $ hg debugrename a
14 15 a renamed from b:37d9b5d994eab34eda9c16b195ace52c7b129980
15 16
16 17 $ hg debugrename --rev 1 b
17 18 b renamed from a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
18 19
@@ -1,517 +1,518 b''
1 1 GNU diff is the reference for all of these results.
2 2
3 3 Prepare tests:
4 4
5 5 $ echo '[alias]' >> $HGRCPATH
6 6 $ echo 'ndiff = diff --nodates' >> $HGRCPATH
7 7
8 $ hg init
8 $ hg init repo
9 $ cd repo
9 10 $ printf 'hello world\ngoodbye world\n' >foo
10 11 $ hg ci -Amfoo -ufoo
11 12 adding foo
12 13
13 14
14 15 Test added blank lines:
15 16
16 17 $ printf '\nhello world\n\ngoodbye world\n\n' >foo
17 18
18 19 >>> two diffs showing three added lines <<<
19 20
20 21 $ hg ndiff
21 22 diff -r 540c40a65b78 foo
22 23 --- a/foo
23 24 +++ b/foo
24 25 @@ -1,2 +1,5 @@
25 26 +
26 27 hello world
27 28 +
28 29 goodbye world
29 30 +
30 31 $ hg ndiff -b
31 32 diff -r 540c40a65b78 foo
32 33 --- a/foo
33 34 +++ b/foo
34 35 @@ -1,2 +1,5 @@
35 36 +
36 37 hello world
37 38 +
38 39 goodbye world
39 40 +
40 41
41 42 >>> no diffs <<<
42 43
43 44 $ hg ndiff -B
44 45 $ hg ndiff -Bb
45 46
46 47
47 48 Test added horizontal space first on a line():
48 49
49 50 $ printf '\t hello world\ngoodbye world\n' >foo
50 51
51 52 >>> four diffs showing added space first on the first line <<<
52 53
53 54 $ hg ndiff
54 55 diff -r 540c40a65b78 foo
55 56 --- a/foo
56 57 +++ b/foo
57 58 @@ -1,2 +1,2 @@
58 59 -hello world
59 60 + hello world
60 61 goodbye world
61 62
62 63 $ hg ndiff -b
63 64 diff -r 540c40a65b78 foo
64 65 --- a/foo
65 66 +++ b/foo
66 67 @@ -1,2 +1,2 @@
67 68 -hello world
68 69 + hello world
69 70 goodbye world
70 71
71 72 $ hg ndiff -B
72 73 diff -r 540c40a65b78 foo
73 74 --- a/foo
74 75 +++ b/foo
75 76 @@ -1,2 +1,2 @@
76 77 -hello world
77 78 + hello world
78 79 goodbye world
79 80
80 81 $ hg ndiff -Bb
81 82 diff -r 540c40a65b78 foo
82 83 --- a/foo
83 84 +++ b/foo
84 85 @@ -1,2 +1,2 @@
85 86 -hello world
86 87 + hello world
87 88 goodbye world
88 89
89 90
90 91 Test added horizontal space last on a line:
91 92
92 93 $ printf 'hello world\t \ngoodbye world\n' >foo
93 94
94 95 >>> two diffs showing space appended to the first line <<<
95 96
96 97 $ hg ndiff
97 98 diff -r 540c40a65b78 foo
98 99 --- a/foo
99 100 +++ b/foo
100 101 @@ -1,2 +1,2 @@
101 102 -hello world
102 103 +hello world
103 104 goodbye world
104 105
105 106 $ hg ndiff -B
106 107 diff -r 540c40a65b78 foo
107 108 --- a/foo
108 109 +++ b/foo
109 110 @@ -1,2 +1,2 @@
110 111 -hello world
111 112 +hello world
112 113 goodbye world
113 114
114 115 >>> no diffs <<<
115 116
116 117 $ hg ndiff -b
117 118 $ hg ndiff -Bb
118 119
119 120
120 121 Test added horizontal space in the middle of a word:
121 122
122 123 $ printf 'hello world\ngood bye world\n' >foo
123 124
124 125 >>> four diffs showing space inserted into "goodbye" <<<
125 126
126 127 $ hg ndiff
127 128 diff -r 540c40a65b78 foo
128 129 --- a/foo
129 130 +++ b/foo
130 131 @@ -1,2 +1,2 @@
131 132 hello world
132 133 -goodbye world
133 134 +good bye world
134 135
135 136 $ hg ndiff -B
136 137 diff -r 540c40a65b78 foo
137 138 --- a/foo
138 139 +++ b/foo
139 140 @@ -1,2 +1,2 @@
140 141 hello world
141 142 -goodbye world
142 143 +good bye world
143 144
144 145 $ hg ndiff -b
145 146 diff -r 540c40a65b78 foo
146 147 --- a/foo
147 148 +++ b/foo
148 149 @@ -1,2 +1,2 @@
149 150 hello world
150 151 -goodbye world
151 152 +good bye world
152 153
153 154 $ hg ndiff -Bb
154 155 diff -r 540c40a65b78 foo
155 156 --- a/foo
156 157 +++ b/foo
157 158 @@ -1,2 +1,2 @@
158 159 hello world
159 160 -goodbye world
160 161 +good bye world
161 162
162 163
163 164 Test increased horizontal whitespace amount:
164 165
165 166 $ printf 'hello world\ngoodbye\t\t \tworld\n' >foo
166 167
167 168 >>> two diffs showing changed whitespace amount in the last line <<<
168 169
169 170 $ hg ndiff
170 171 diff -r 540c40a65b78 foo
171 172 --- a/foo
172 173 +++ b/foo
173 174 @@ -1,2 +1,2 @@
174 175 hello world
175 176 -goodbye world
176 177 +goodbye world
177 178
178 179 $ hg ndiff -B
179 180 diff -r 540c40a65b78 foo
180 181 --- a/foo
181 182 +++ b/foo
182 183 @@ -1,2 +1,2 @@
183 184 hello world
184 185 -goodbye world
185 186 +goodbye world
186 187
187 188 >>> no diffs <<<
188 189
189 190 $ hg ndiff -b
190 191 $ hg ndiff -Bb
191 192
192 193
193 194 Test added blank line with horizontal whitespace:
194 195
195 196 $ printf 'hello world\n \t\ngoodbye world\n' >foo
196 197
197 198 >>> three diffs showing added blank line with horizontal space <<<
198 199
199 200 $ hg ndiff
200 201 diff -r 540c40a65b78 foo
201 202 --- a/foo
202 203 +++ b/foo
203 204 @@ -1,2 +1,3 @@
204 205 hello world
205 206 +
206 207 goodbye world
207 208
208 209 $ hg ndiff -B
209 210 diff -r 540c40a65b78 foo
210 211 --- a/foo
211 212 +++ b/foo
212 213 @@ -1,2 +1,3 @@
213 214 hello world
214 215 +
215 216 goodbye world
216 217
217 218 $ hg ndiff -b
218 219 diff -r 540c40a65b78 foo
219 220 --- a/foo
220 221 +++ b/foo
221 222 @@ -1,2 +1,3 @@
222 223 hello world
223 224 +
224 225 goodbye world
225 226
226 227 >>> no diffs <<<
227 228
228 229 $ hg ndiff -Bb
229 230
230 231
231 232 Test added blank line with other whitespace:
232 233
233 234 $ printf 'hello world\n \t\ngoodbye world \n' >foo
234 235
235 236 >>> three diffs showing added blank line with other space <<<
236 237
237 238 $ hg ndiff
238 239 diff -r 540c40a65b78 foo
239 240 --- a/foo
240 241 +++ b/foo
241 242 @@ -1,2 +1,3 @@
242 243 -hello world
243 244 -goodbye world
244 245 +hello world
245 246 +
246 247 +goodbye world
247 248
248 249 $ hg ndiff -B
249 250 diff -r 540c40a65b78 foo
250 251 --- a/foo
251 252 +++ b/foo
252 253 @@ -1,2 +1,3 @@
253 254 -hello world
254 255 -goodbye world
255 256 +hello world
256 257 +
257 258 +goodbye world
258 259
259 260 $ hg ndiff -b
260 261 diff -r 540c40a65b78 foo
261 262 --- a/foo
262 263 +++ b/foo
263 264 @@ -1,2 +1,3 @@
264 265 hello world
265 266 +
266 267 goodbye world
267 268
268 269 >>> no diffs <<<
269 270
270 271 $ hg ndiff -Bb
271 272
272 273
273 274 Test whitespace changes:
274 275
275 276 $ printf 'helloworld\ngoodbye\tworld \n' >foo
276 277
277 278 >>> four diffs showing changed whitespace <<<
278 279
279 280 $ hg ndiff
280 281 diff -r 540c40a65b78 foo
281 282 --- a/foo
282 283 +++ b/foo
283 284 @@ -1,2 +1,2 @@
284 285 -hello world
285 286 -goodbye world
286 287 +helloworld
287 288 +goodbye world
288 289
289 290 $ hg ndiff -B
290 291 diff -r 540c40a65b78 foo
291 292 --- a/foo
292 293 +++ b/foo
293 294 @@ -1,2 +1,2 @@
294 295 -hello world
295 296 -goodbye world
296 297 +helloworld
297 298 +goodbye world
298 299
299 300 $ hg ndiff -b
300 301 diff -r 540c40a65b78 foo
301 302 --- a/foo
302 303 +++ b/foo
303 304 @@ -1,2 +1,2 @@
304 305 -hello world
305 306 +helloworld
306 307 goodbye world
307 308
308 309 $ hg ndiff -Bb
309 310 diff -r 540c40a65b78 foo
310 311 --- a/foo
311 312 +++ b/foo
312 313 @@ -1,2 +1,2 @@
313 314 -hello world
314 315 +helloworld
315 316 goodbye world
316 317
317 318 >>> no diffs <<<
318 319
319 320 $ hg ndiff -w
320 321
321 322
322 323 Test whitespace changes and blank lines:
323 324
324 325 $ printf 'helloworld\n\n\n\ngoodbye\tworld \n' >foo
325 326
326 327 >>> five diffs showing changed whitespace <<<
327 328
328 329 $ hg ndiff
329 330 diff -r 540c40a65b78 foo
330 331 --- a/foo
331 332 +++ b/foo
332 333 @@ -1,2 +1,5 @@
333 334 -hello world
334 335 -goodbye world
335 336 +helloworld
336 337 +
337 338 +
338 339 +
339 340 +goodbye world
340 341
341 342 $ hg ndiff -B
342 343 diff -r 540c40a65b78 foo
343 344 --- a/foo
344 345 +++ b/foo
345 346 @@ -1,2 +1,5 @@
346 347 -hello world
347 348 -goodbye world
348 349 +helloworld
349 350 +
350 351 +
351 352 +
352 353 +goodbye world
353 354
354 355 $ hg ndiff -b
355 356 diff -r 540c40a65b78 foo
356 357 --- a/foo
357 358 +++ b/foo
358 359 @@ -1,2 +1,5 @@
359 360 -hello world
360 361 +helloworld
361 362 +
362 363 +
363 364 +
364 365 goodbye world
365 366
366 367 $ hg ndiff -Bb
367 368 diff -r 540c40a65b78 foo
368 369 --- a/foo
369 370 +++ b/foo
370 371 @@ -1,2 +1,5 @@
371 372 -hello world
372 373 +helloworld
373 374 +
374 375 +
375 376 +
376 377 goodbye world
377 378
378 379 $ hg ndiff -w
379 380 diff -r 540c40a65b78 foo
380 381 --- a/foo
381 382 +++ b/foo
382 383 @@ -1,2 +1,5 @@
383 384 hello world
384 385 +
385 386 +
386 387 +
387 388 goodbye world
388 389
389 390 >>> no diffs <<<
390 391
391 392 $ hg ndiff -wB
392 393
393 394
394 395 Test \r (carriage return) as used in "DOS" line endings:
395 396
396 397 $ printf 'hello world\r\n\r\ngoodbye\rworld\n' >foo
397 398
398 399 $ hg ndiff
399 400 diff -r 540c40a65b78 foo
400 401 --- a/foo
401 402 +++ b/foo
402 403 @@ -1,2 +1,3 @@
403 404 -hello world
404 405 -goodbye world
405 406 +hello world\r (esc)
406 407 +\r (esc)
407 408 +goodbye\r (no-eol) (esc)
408 409 world
409 410
410 411 Test \r (carriage return) as used in "DOS" line endings:
411 412
412 413 $ printf 'hello world \r\n\t\ngoodbye world\n' >foo
413 414
414 415 $ hg ndiff --ignore-space-at-eol
415 416 diff -r 540c40a65b78 foo
416 417 --- a/foo
417 418 +++ b/foo
418 419 @@ -1,2 +1,3 @@
419 420 hello world
420 421 +\t (esc)
421 422 goodbye world
422 423
423 424 No completely blank lines to ignore:
424 425
425 426 $ printf 'hello world\r\n\r\ngoodbye\rworld\n' >foo
426 427
427 428 $ hg ndiff --ignore-blank-lines
428 429 diff -r 540c40a65b78 foo
429 430 --- a/foo
430 431 +++ b/foo
431 432 @@ -1,2 +1,3 @@
432 433 -hello world
433 434 -goodbye world
434 435 +hello world\r (esc)
435 436 +\r (esc)
436 437 +goodbye\r (no-eol) (esc)
437 438 world
438 439
439 440 Only new line noticed:
440 441
441 442 $ hg ndiff --ignore-space-change
442 443 diff -r 540c40a65b78 foo
443 444 --- a/foo
444 445 +++ b/foo
445 446 @@ -1,2 +1,3 @@
446 447 hello world
447 448 +\r (esc)
448 449 goodbye world
449 450
450 451 $ hg ndiff --ignore-all-space
451 452 diff -r 540c40a65b78 foo
452 453 --- a/foo
453 454 +++ b/foo
454 455 @@ -1,2 +1,3 @@
455 456 hello world
456 457 +\r (esc)
457 458 goodbye world
458 459
459 460 New line not noticed when space change ignored:
460 461
461 462 $ hg ndiff --ignore-blank-lines --ignore-all-space
462 463
463 464 Do not ignore all newlines, only blank lines
464 465
465 466 $ printf 'hello \nworld\ngoodbye world\n' > foo
466 467 $ hg ndiff --ignore-blank-lines
467 468 diff -r 540c40a65b78 foo
468 469 --- a/foo
469 470 +++ b/foo
470 471 @@ -1,2 +1,3 @@
471 472 -hello world
472 473 +hello
473 474 +world
474 475 goodbye world
475 476
476 477 Test hunk offsets adjustments with --ignore-blank-lines
477 478
478 479 $ hg revert -aC
479 480 reverting foo
480 481 $ printf '\nb\nx\nd\n' > a
481 482 $ printf 'b\ny\nd\n' > b
482 483 $ hg add a b
483 484 $ hg ci -m add
484 485 $ hg cat -r . a > b
485 486 $ hg cat -r . b > a
486 487 $ hg diff -B --nodates a > ../diffa
487 488 $ cat ../diffa
488 489 diff -r 0e66aa54f318 a
489 490 --- a/a
490 491 +++ b/a
491 492 @@ -1,4 +1,4 @@
492 493
493 494 b
494 495 -x
495 496 +y
496 497 d
497 498 $ hg diff -B --nodates b > ../diffb
498 499 $ cat ../diffb
499 500 diff -r 0e66aa54f318 b
500 501 --- a/b
501 502 +++ b/b
502 503 @@ -1,3 +1,3 @@
503 504 b
504 505 -y
505 506 +x
506 507 d
507 508 $ hg revert -aC
508 509 reverting a
509 510 reverting b
510 511 $ hg import --no-commit ../diffa
511 512 applying ../diffa
512 513 $ hg revert -aC
513 514 reverting a
514 515 $ hg import --no-commit ../diffb
515 516 applying ../diffb
516 517 $ hg revert -aC
517 518 reverting b
@@ -1,339 +1,340 b''
1 1 #testcases bdiff xdiff
2 2
3 3 #if xdiff
4 4 #require xdiff
5 5 $ cat >> $HGRCPATH <<EOF
6 6 > [experimental]
7 7 > xdiff = true
8 8 > EOF
9 9 #endif
10 10
11 $ hg init
11 $ hg init repo
12 $ cd repo
12 13
13 14 $ cat > a.c <<'EOF'
14 15 > /*
15 16 > * This function returns 1.
16 17 > */
17 18 > int f() {
18 19 > return 1;
19 20 > }
20 21 > /*
21 22 > * This function returns 2.
22 23 > */
23 24 > int g() {
24 25 > return 2;
25 26 > }
26 27 > /*
27 28 > * This function returns 3.
28 29 > */
29 30 > int h() {
30 31 > return 3;
31 32 > }
32 33 > EOF
33 34
34 35 $ cat > b.c <<'EOF'
35 36 > if (x) {
36 37 > do_something();
37 38 > }
38 39 >
39 40 > if (y) {
40 41 > do_something_else();
41 42 > }
42 43 > EOF
43 44
44 45 $ cat > c.rb <<'EOF'
45 46 > #!ruby
46 47 > ["foo", "bar", "baz"].map do |i|
47 48 > i.upcase
48 49 > end
49 50 > EOF
50 51
51 52 $ cat > d.py <<'EOF'
52 53 > try:
53 54 > import foo
54 55 > except ImportError:
55 56 > pass
56 57 > try:
57 58 > import bar
58 59 > except ImportError:
59 60 > pass
60 61 > EOF
61 62
62 63 The below two files are taken from git: t/t4061-diff-indent.sh
63 64
64 65 $ cat > spaces.txt <<'EOF'
65 66 > 1
66 67 > 2
67 68 > a
68 69 >
69 70 > b
70 71 > 3
71 72 > 4
72 73 > EOF
73 74
74 75 $ cat > functions.c <<'EOF'
75 76 > 1
76 77 > 2
77 78 > /* function */
78 79 > foo() {
79 80 > foo
80 81 > }
81 82 >
82 83 > 3
83 84 > 4
84 85 > EOF
85 86
86 87 $ hg commit -m 1 -A . -q
87 88
88 89 $ cat > a.c <<'EOF'
89 90 > /*
90 91 > * This function returns 1.
91 92 > */
92 93 > int f() {
93 94 > return 1;
94 95 > }
95 96 > /*
96 97 > * This function returns 3.
97 98 > */
98 99 > int h() {
99 100 > return 3;
100 101 > }
101 102 > EOF
102 103
103 104 $ cat > b.c <<'EOF'
104 105 > if (x) {
105 106 > do_something();
106 107 > }
107 108 >
108 109 > if (y) {
109 110 > do_another_thing();
110 111 > }
111 112 >
112 113 > if (y) {
113 114 > do_something_else();
114 115 > }
115 116 > EOF
116 117
117 118 $ cat > c.rb <<'EOF'
118 119 > #!ruby
119 120 > ["foo", "bar", "baz"].map do |i|
120 121 > i
121 122 > end
122 123 > ["foo", "bar", "baz"].map do |i|
123 124 > i.upcase
124 125 > end
125 126 > EOF
126 127
127 128 $ cat > d.py <<'EOF'
128 129 > try:
129 130 > import foo
130 131 > except ImportError:
131 132 > pass
132 133 > try:
133 134 > import baz
134 135 > except ImportError:
135 136 > pass
136 137 > try:
137 138 > import bar
138 139 > except ImportError:
139 140 > pass
140 141 > EOF
141 142
142 143 $ cat > spaces.txt <<'EOF'
143 144 > 1
144 145 > 2
145 146 > a
146 147 >
147 148 > b
148 149 > a
149 150 >
150 151 > b
151 152 > 3
152 153 > 4
153 154 > EOF
154 155
155 156 $ cat > functions.c <<'EOF'
156 157 > 1
157 158 > 2
158 159 > /* function */
159 160 > bar() {
160 161 > foo
161 162 > }
162 163 >
163 164 > /* function */
164 165 > foo() {
165 166 > foo
166 167 > }
167 168 >
168 169 > 3
169 170 > 4
170 171 > EOF
171 172
172 173 #if xdiff
173 174 $ hg diff --git
174 175 diff --git a/a.c b/a.c
175 176 --- a/a.c
176 177 +++ b/a.c
177 178 @@ -4,12 +4,6 @@
178 179 int f() {
179 180 return 1;
180 181 }
181 182 -/*
182 183 - * This function returns 2.
183 184 - */
184 185 -int g() {
185 186 - return 2;
186 187 -}
187 188 /*
188 189 * This function returns 3.
189 190 */
190 191 diff --git a/b.c b/b.c
191 192 --- a/b.c
192 193 +++ b/b.c
193 194 @@ -2,6 +2,10 @@
194 195 do_something();
195 196 }
196 197
197 198 +if (y) {
198 199 + do_another_thing();
199 200 +}
200 201 +
201 202 if (y) {
202 203 do_something_else();
203 204 }
204 205 diff --git a/c.rb b/c.rb
205 206 --- a/c.rb
206 207 +++ b/c.rb
207 208 @@ -1,4 +1,7 @@
208 209 #!ruby
209 210 +["foo", "bar", "baz"].map do |i|
210 211 + i
211 212 +end
212 213 ["foo", "bar", "baz"].map do |i|
213 214 i.upcase
214 215 end
215 216 diff --git a/d.py b/d.py
216 217 --- a/d.py
217 218 +++ b/d.py
218 219 @@ -2,6 +2,10 @@
219 220 import foo
220 221 except ImportError:
221 222 pass
222 223 +try:
223 224 + import baz
224 225 +except ImportError:
225 226 + pass
226 227 try:
227 228 import bar
228 229 except ImportError:
229 230 diff --git a/functions.c b/functions.c
230 231 --- a/functions.c
231 232 +++ b/functions.c
232 233 @@ -1,5 +1,10 @@
233 234 1
234 235 2
235 236 +/* function */
236 237 +bar() {
237 238 + foo
238 239 +}
239 240 +
240 241 /* function */
241 242 foo() {
242 243 foo
243 244 diff --git a/spaces.txt b/spaces.txt
244 245 --- a/spaces.txt
245 246 +++ b/spaces.txt
246 247 @@ -2,6 +2,9 @@
247 248 2
248 249 a
249 250
250 251 +b
251 252 +a
252 253 +
253 254 b
254 255 3
255 256 4
256 257 #else
257 258 $ hg diff --git
258 259 diff --git a/a.c b/a.c
259 260 --- a/a.c
260 261 +++ b/a.c
261 262 @@ -5,12 +5,6 @@
262 263 return 1;
263 264 }
264 265 /*
265 266 - * This function returns 2.
266 267 - */
267 268 -int g() {
268 269 - return 2;
269 270 -}
270 271 -/*
271 272 * This function returns 3.
272 273 */
273 274 int h() {
274 275 diff --git a/b.c b/b.c
275 276 --- a/b.c
276 277 +++ b/b.c
277 278 @@ -3,5 +3,9 @@
278 279 }
279 280
280 281 if (y) {
281 282 + do_another_thing();
282 283 +}
283 284 +
284 285 +if (y) {
285 286 do_something_else();
286 287 }
287 288 diff --git a/c.rb b/c.rb
288 289 --- a/c.rb
289 290 +++ b/c.rb
290 291 @@ -1,4 +1,7 @@
291 292 #!ruby
292 293 ["foo", "bar", "baz"].map do |i|
293 294 + i
294 295 +end
295 296 +["foo", "bar", "baz"].map do |i|
296 297 i.upcase
297 298 end
298 299 diff --git a/d.py b/d.py
299 300 --- a/d.py
300 301 +++ b/d.py
301 302 @@ -3,6 +3,10 @@
302 303 except ImportError:
303 304 pass
304 305 try:
305 306 + import baz
306 307 +except ImportError:
307 308 + pass
308 309 +try:
309 310 import bar
310 311 except ImportError:
311 312 pass
312 313 diff --git a/functions.c b/functions.c
313 314 --- a/functions.c
314 315 +++ b/functions.c
315 316 @@ -1,6 +1,11 @@
316 317 1
317 318 2
318 319 /* function */
319 320 +bar() {
320 321 + foo
321 322 +}
322 323 +
323 324 +/* function */
324 325 foo() {
325 326 foo
326 327 }
327 328 diff --git a/spaces.txt b/spaces.txt
328 329 --- a/spaces.txt
329 330 +++ b/spaces.txt
330 331 @@ -3,5 +3,8 @@
331 332 a
332 333
333 334 b
334 335 +a
335 336 +
336 337 +b
337 338 3
338 339 4
339 340 #endif
@@ -1,23 +1,24 b''
1 1 Test issue2761
2 2
3 $ hg init
3 $ hg init repo
4 $ cd repo
4 5
5 6 $ touch to-be-deleted
6 7 $ hg add
7 8 adding to-be-deleted
8 9 $ hg ci -m first
9 10 $ echo a > to-be-deleted
10 11 $ hg ci -m second
11 12 $ rm to-be-deleted
12 13 $ hg diff -r 0
13 14
14 15 Same issue, different code path
15 16
16 17 $ hg up -C
17 18 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
18 19 $ touch does-not-exist-in-1
19 20 $ hg add
20 21 adding does-not-exist-in-1
21 22 $ hg ci -m third
22 23 $ rm does-not-exist-in-1
23 24 $ hg diff -r 1
@@ -1,19 +1,20 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3
3 4 $ "$PYTHON" -c 'open("a", "wb").write(b"confuse str.splitlines\nembedded\rnewline\n")'
4 5 $ hg ci -Ama -d '1 0'
5 6 adding a
6 7
7 8 $ echo clean diff >> a
8 9 $ hg ci -mb -d '2 0'
9 10
10 11 $ hg diff -r0 -r1
11 12 diff -r 107ba6f817b5 -r 310ce7989cdc a
12 13 --- a/a Thu Jan 01 00:00:01 1970 +0000
13 14 +++ b/a Thu Jan 01 00:00:02 1970 +0000
14 15 @@ -1,2 +1,3 @@
15 16 confuse str.splitlines
16 17 embedded\r (no-eol) (esc)
17 18 newline
18 19 +clean diff
19 20
@@ -1,65 +1,66 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3
3 4 $ cat > a <<EOF
4 5 > a
5 6 > b
6 7 > c
7 8 > EOF
8 9 $ hg ci -Am adda
9 10 adding a
10 11
11 12 $ cat > a <<EOF
12 13 > d
13 14 > e
14 15 > f
15 16 > EOF
16 17 $ hg ci -m moda
17 18
18 19 $ hg diff --reverse -r0 -r1
19 20 diff -r 2855cdcfcbb7 -r 8e1805a3cf6e a
20 21 --- a/a Thu Jan 01 00:00:00 1970 +0000
21 22 +++ b/a Thu Jan 01 00:00:00 1970 +0000
22 23 @@ -1,3 +1,3 @@
23 24 -d
24 25 -e
25 26 -f
26 27 +a
27 28 +b
28 29 +c
29 30
30 31 $ cat >> a <<EOF
31 32 > g
32 33 > h
33 34 > EOF
34 35 $ hg diff --reverse --nodates
35 36 diff -r 2855cdcfcbb7 a
36 37 --- a/a
37 38 +++ b/a
38 39 @@ -1,5 +1,3 @@
39 40 d
40 41 e
41 42 f
42 43 -g
43 44 -h
44 45
45 46 should show removed file 'a' as being added
46 47 $ hg revert a
47 48 $ hg rm a
48 49 $ hg diff --reverse --nodates a
49 50 diff -r 2855cdcfcbb7 a
50 51 --- /dev/null
51 52 +++ b/a
52 53 @@ -0,0 +1,3 @@
53 54 +d
54 55 +e
55 56 +f
56 57
57 58 should show added file 'b' as being removed
58 59 $ echo b >> b
59 60 $ hg add b
60 61 $ hg diff --reverse --nodates b
61 62 diff -r 2855cdcfcbb7 b
62 63 --- a/b
63 64 +++ /dev/null
64 65 @@ -1,1 +0,0 @@
65 66 -b
@@ -1,64 +1,65 b''
1 1 Test temp file used with an editor has the expected suffix.
2 2
3 $ hg init
3 $ hg init repo
4 $ cd repo
4 5
5 6 Create an editor that writes its arguments to stdout and set it to $HGEDITOR.
6 7
7 8 $ cat > editor.sh << EOF
8 9 > echo "\$@"
9 10 > exit 1
10 11 > EOF
11 12 $ hg add editor.sh
12 $ HGEDITOR="sh $TESTTMP/editor.sh"
13 $ HGEDITOR="sh $TESTTMP/repo/editor.sh"
13 14 $ export HGEDITOR
14 15
15 16 Verify that the path for a commit editor has the expected suffix.
16 17
17 18 $ hg commit
18 19 *.commit.hg.txt (glob)
19 20 abort: edit failed: sh exited with status 1
20 21 [250]
21 22
22 23 Verify that the path for a histedit editor has the expected suffix.
23 24
24 25 $ cat >> $HGRCPATH <<EOF
25 26 > [extensions]
26 27 > rebase=
27 28 > histedit=
28 29 > EOF
29 30 $ hg commit --message 'At least one commit for histedit.'
30 31 $ hg histedit
31 32 *.histedit.hg.txt (glob)
32 33 abort: edit failed: sh exited with status 1
33 34 [250]
34 35
35 36 Verify that when performing an action that has the side-effect of creating an
36 37 editor for a diff, the file ends in .diff.
37 38
38 39 $ echo 1 > one
39 40 $ echo 2 > two
40 41 $ hg add
41 42 adding one
42 43 adding two
43 44 $ hg commit --interactive --config ui.interactive=true --config ui.interface=text << EOF
44 45 > y
45 46 > e
46 47 > q
47 48 > EOF
48 49 diff --git a/one b/one
49 50 new file mode 100644
50 51 examine changes to 'one'?
51 52 (enter ? for help) [Ynesfdaq?] y
52 53
53 54 @@ -0,0 +1,1 @@
54 55 +1
55 56 record change 1/2 to 'one'?
56 57 (enter ? for help) [Ynesfdaq?] e
57 58
58 59 *.diff (glob)
59 60 editor exited with exit code 1
60 61 record change 1/2 to 'one'?
61 62 (enter ? for help) [Ynesfdaq?] q
62 63
63 64 abort: user quit
64 65 [250]
@@ -1,72 +1,73 b''
1 1 Test encode/decode filters
2 2
3 $ hg init
3 $ hg init repo
4 $ cd repo
4 5 $ cat > .hg/hgrc <<EOF
5 6 > [encode]
6 7 > not.gz = tr [:lower:] [:upper:]
7 8 > *.gz = gzip -d
8 9 > [decode]
9 10 > not.gz = tr [:upper:] [:lower:]
10 11 > *.gz = gzip
11 12 > EOF
12 13 $ echo "this is a test" | gzip > a.gz
13 14 $ echo "this is a test" > not.gz
14 15 $ hg add *
15 16 $ hg ci -m "test"
16 17
17 18 no changes
18 19
19 20 $ hg status
20 21 $ touch *
21 22
22 23 no changes
23 24
24 25 $ hg status
25 26
26 27 check contents in repo are encoded
27 28
28 29 $ hg debugdata a.gz 0
29 30 this is a test
30 31 $ hg debugdata not.gz 0
31 32 THIS IS A TEST
32 33
33 34 check committed content was decoded
34 35
35 36 $ gunzip < a.gz
36 37 this is a test
37 38 $ cat not.gz
38 39 this is a test
39 40 $ rm *
40 41 $ hg co -C
41 42 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
42 43
43 44 check decoding of our new working dir copy
44 45
45 46 $ gunzip < a.gz
46 47 this is a test
47 48 $ cat not.gz
48 49 this is a test
49 50
50 51 check hg cat operation
51 52
52 53 $ hg cat a.gz
53 54 this is a test
54 55 $ hg cat --decode a.gz | gunzip
55 56 this is a test
56 57 $ mkdir subdir
57 58 $ cd subdir
58 59 $ hg -R .. cat ../a.gz
59 60 this is a test
60 61 $ hg -R .. cat --decode ../a.gz | gunzip
61 62 this is a test
62 63 $ cd ..
63 64
64 65 check tempfile filter
65 66
66 67 $ hg cat a.gz --decode --config 'decode.*.gz=tempfile:gzip -c INFILE > OUTFILE' | gunzip
67 68 this is a test
68 69 $ hg cat a.gz --decode --config 'decode.*.gz=tempfile:sh -c "exit 1"'
69 70 abort: command '*' failed: exited with status 1 (glob)
70 71 [255]
71 72
72 73 $ cd ..
@@ -1,28 +1,29 b''
1 1 #require execbit
2 2
3 $ hg init
3 $ hg init repo
4 $ cd repo
4 5 $ echo a > a
5 6 $ hg ci -Am'not executable'
6 7 adding a
7 8
8 9 $ chmod +x a
9 10 $ hg ci -m'executable'
10 11 $ hg id
11 12 79abf14474dc tip
12 13
13 14 Make sure we notice the change of mode if the cached size == -1:
14 15
15 16 $ hg rm a
16 17 $ hg revert -r 0 a
17 18 $ hg debugstate
18 19 n 0 -1 unset a
19 20 $ hg status
20 21 M a
21 22
22 23 $ hg up 0
23 24 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
24 25 $ hg id
25 26 d69afc33ff8a
26 27 $ test -x a && echo executable -- bad || echo not executable -- good
27 28 not executable -- good
28 29
@@ -1,21 +1,22 b''
1 1 Issue351: mq: qrefresh can create extra revlog entry
2 2
3 3 $ echo "[extensions]" >> $HGRCPATH
4 4 $ echo "mq=" >> $HGRCPATH
5 5
6 $ hg init
6 $ hg init repo
7 $ cd repo
7 8 $ hg qinit
8 9
9 10 $ echo b > b
10 11 $ hg ci -A -m foo
11 12 adding b
12 13
13 14 $ echo cc > b
14 15 $ hg qnew -f foo.diff
15 16 $ echo b > b
16 17 $ hg qrefresh
17 18
18 19 $ hg debugindex b
19 20 rev linkrev nodeid p1-nodeid p2-nodeid
20 21 0 0 1e88685f5dde 000000000000 000000000000
21 22
@@ -1,198 +1,199 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3
3 4 Set up history and working copy
4 5
5 6 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 1
6 7 $ hg addremove -q --similarity 0
7 8 $ hg commit -m first
8 9
9 10 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 2
10 11 $ hg addremove -q --similarity 0
11 12 $ hg commit -m second
12 13
13 14 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 wc
14 15 $ hg addremove -q --similarity 0
15 16 $ hg forget *_*_*-untracked
16 17 $ rm *_*_missing-*
17 18
18 19 Test status
19 20
20 21 $ hg st -A 'set:modified()'
21 22 M content1_content1_content3-tracked
22 23 M content1_content2_content1-tracked
23 24 M content1_content2_content3-tracked
24 25 M missing_content2_content3-tracked
25 26
26 27 $ hg st -A 'set:added()'
27 28 A content1_missing_content1-tracked
28 29 A content1_missing_content3-tracked
29 30 A missing_missing_content3-tracked
30 31
31 32 $ hg st -A 'set:removed()'
32 33 R content1_content1_content1-untracked
33 34 R content1_content1_content3-untracked
34 35 R content1_content1_missing-untracked
35 36 R content1_content2_content1-untracked
36 37 R content1_content2_content2-untracked
37 38 R content1_content2_content3-untracked
38 39 R content1_content2_missing-untracked
39 40 R missing_content2_content2-untracked
40 41 R missing_content2_content3-untracked
41 42 R missing_content2_missing-untracked
42 43
43 44 $ hg st -A 'set:deleted()'
44 45 ! content1_content1_missing-tracked
45 46 ! content1_content2_missing-tracked
46 47 ! content1_missing_missing-tracked
47 48 ! missing_content2_missing-tracked
48 49 ! missing_missing_missing-tracked
49 50
50 51 $ hg st -A 'set:missing()'
51 52 ! content1_content1_missing-tracked
52 53 ! content1_content2_missing-tracked
53 54 ! content1_missing_missing-tracked
54 55 ! missing_content2_missing-tracked
55 56 ! missing_missing_missing-tracked
56 57
57 58 $ hg st -A 'set:unknown()'
58 59 ? content1_missing_content1-untracked
59 60 ? content1_missing_content3-untracked
60 61 ? missing_missing_content3-untracked
61 62
62 63 $ hg st -A 'set:clean()'
63 64 C content1_content1_content1-tracked
64 65 C content1_content2_content2-tracked
65 66 C missing_content2_content2-tracked
66 67
67 68 Test log
68 69
69 70 $ hg log -T '{rev}\n' --stat 'set:modified()'
70 71 1
71 72 content1_content2_content1-tracked | 2 +-
72 73 content1_content2_content3-tracked | 2 +-
73 74 missing_content2_content3-tracked | 1 +
74 75 3 files changed, 3 insertions(+), 2 deletions(-)
75 76
76 77 0
77 78 content1_content1_content3-tracked | 1 +
78 79 content1_content2_content1-tracked | 1 +
79 80 content1_content2_content3-tracked | 1 +
80 81 3 files changed, 3 insertions(+), 0 deletions(-)
81 82
82 83 Largefiles doesn't crash
83 84 $ hg log -T '{rev}\n' --stat 'set:modified()' --config extensions.largefiles=
84 85 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
85 86 1
86 87 content1_content2_content1-tracked | 2 +-
87 88 content1_content2_content3-tracked | 2 +-
88 89 missing_content2_content3-tracked | 1 +
89 90 3 files changed, 3 insertions(+), 2 deletions(-)
90 91
91 92 0
92 93 content1_content1_content3-tracked | 1 +
93 94 content1_content2_content1-tracked | 1 +
94 95 content1_content2_content3-tracked | 1 +
95 96 3 files changed, 3 insertions(+), 0 deletions(-)
96 97
97 98 $ hg log -T '{rev}\n' --stat 'set:added()'
98 99 1
99 100 content1_missing_content1-tracked | 1 -
100 101 content1_missing_content3-tracked | 1 -
101 102 2 files changed, 0 insertions(+), 2 deletions(-)
102 103
103 104 0
104 105 content1_missing_content1-tracked | 1 +
105 106 content1_missing_content3-tracked | 1 +
106 107 2 files changed, 2 insertions(+), 0 deletions(-)
107 108
108 109 $ hg log -T '{rev}\n' --stat 'set:removed()'
109 110 1
110 111 content1_content2_content1-untracked | 2 +-
111 112 content1_content2_content2-untracked | 2 +-
112 113 content1_content2_content3-untracked | 2 +-
113 114 content1_content2_missing-untracked | 2 +-
114 115 missing_content2_content2-untracked | 1 +
115 116 missing_content2_content3-untracked | 1 +
116 117 missing_content2_missing-untracked | 1 +
117 118 7 files changed, 7 insertions(+), 4 deletions(-)
118 119
119 120 0
120 121 content1_content1_content1-untracked | 1 +
121 122 content1_content1_content3-untracked | 1 +
122 123 content1_content1_missing-untracked | 1 +
123 124 content1_content2_content1-untracked | 1 +
124 125 content1_content2_content2-untracked | 1 +
125 126 content1_content2_content3-untracked | 1 +
126 127 content1_content2_missing-untracked | 1 +
127 128 7 files changed, 7 insertions(+), 0 deletions(-)
128 129
129 130 $ hg log -T '{rev}\n' --stat 'set:deleted()'
130 131 1
131 132 content1_content2_missing-tracked | 2 +-
132 133 content1_missing_missing-tracked | 1 -
133 134 missing_content2_missing-tracked | 1 +
134 135 3 files changed, 2 insertions(+), 2 deletions(-)
135 136
136 137 0
137 138 content1_content1_missing-tracked | 1 +
138 139 content1_content2_missing-tracked | 1 +
139 140 content1_missing_missing-tracked | 1 +
140 141 3 files changed, 3 insertions(+), 0 deletions(-)
141 142
142 143 $ hg log -T '{rev}\n' --stat 'set:unknown()'
143 144 1
144 145 content1_missing_content1-untracked | 1 -
145 146 content1_missing_content3-untracked | 1 -
146 147 2 files changed, 0 insertions(+), 2 deletions(-)
147 148
148 149 0
149 150 content1_missing_content1-untracked | 1 +
150 151 content1_missing_content3-untracked | 1 +
151 152 2 files changed, 2 insertions(+), 0 deletions(-)
152 153
153 154 $ hg log -T '{rev}\n' --stat 'set:clean()'
154 155 1
155 156 content1_content2_content2-tracked | 2 +-
156 157 missing_content2_content2-tracked | 1 +
157 158 2 files changed, 2 insertions(+), 1 deletions(-)
158 159
159 160 0
160 161 content1_content1_content1-tracked | 1 +
161 162 content1_content2_content2-tracked | 1 +
162 163 2 files changed, 2 insertions(+), 0 deletions(-)
163 164
164 165 Test revert
165 166
166 167 $ hg revert 'set:modified()'
167 168 reverting content1_content1_content3-tracked
168 169 reverting content1_content2_content1-tracked
169 170 reverting content1_content2_content3-tracked
170 171 reverting missing_content2_content3-tracked
171 172
172 173 $ hg revert 'set:added()'
173 174 forgetting content1_missing_content1-tracked
174 175 forgetting content1_missing_content3-tracked
175 176 forgetting missing_missing_content3-tracked
176 177
177 178 $ hg revert 'set:removed()'
178 179 undeleting content1_content1_content1-untracked
179 180 undeleting content1_content1_content3-untracked
180 181 undeleting content1_content1_missing-untracked
181 182 undeleting content1_content2_content1-untracked
182 183 undeleting content1_content2_content2-untracked
183 184 undeleting content1_content2_content3-untracked
184 185 undeleting content1_content2_missing-untracked
185 186 undeleting missing_content2_content2-untracked
186 187 undeleting missing_content2_content3-untracked
187 188 undeleting missing_content2_missing-untracked
188 189
189 190 $ hg revert 'set:deleted()'
190 191 forgetting content1_missing_missing-tracked
191 192 forgetting missing_missing_missing-tracked
192 193 reverting content1_content1_missing-tracked
193 194 reverting content1_content2_missing-tracked
194 195 reverting missing_content2_missing-tracked
195 196
196 197 $ hg revert 'set:unknown()'
197 198
198 199 $ hg revert 'set:clean()'
@@ -1,615 +1,616 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3 $ echo start > start
3 4 $ hg ci -Amstart
4 5 adding start
5 6
6 7 New file:
7 8
8 9 $ mkdir dir1
9 10 $ echo new > dir1/new
10 11 $ hg ci -Amnew
11 12 adding dir1/new
12 13 $ hg diff --git -r 0
13 14 diff --git a/dir1/new b/dir1/new
14 15 new file mode 100644
15 16 --- /dev/null
16 17 +++ b/dir1/new
17 18 @@ -0,0 +1,1 @@
18 19 +new
19 20
20 21 Copy:
21 22
22 23 $ mkdir dir2
23 24 $ hg cp dir1/new dir1/copy
24 25 $ echo copy1 >> dir1/copy
25 26 $ hg cp dir1/new dir2/copy
26 27 $ echo copy2 >> dir2/copy
27 28 $ hg ci -mcopy
28 29 $ hg diff --git -r 1:tip
29 30 diff --git a/dir1/new b/dir1/copy
30 31 copy from dir1/new
31 32 copy to dir1/copy
32 33 --- a/dir1/new
33 34 +++ b/dir1/copy
34 35 @@ -1,1 +1,2 @@
35 36 new
36 37 +copy1
37 38 diff --git a/dir1/new b/dir2/copy
38 39 copy from dir1/new
39 40 copy to dir2/copy
40 41 --- a/dir1/new
41 42 +++ b/dir2/copy
42 43 @@ -1,1 +1,2 @@
43 44 new
44 45 +copy2
45 46
46 47 Cross and same-directory copies with a relative root:
47 48
48 49 $ hg diff --git --root .. -r 1:tip
49 abort: .. not under root '$TESTTMP'
50 abort: .. not under root '$TESTTMP/repo'
50 51 [255]
51 52 $ hg diff --git --root doesnotexist -r 1:tip
52 53 $ hg diff --git --root . -r 1:tip
53 54 diff --git a/dir1/new b/dir1/copy
54 55 copy from dir1/new
55 56 copy to dir1/copy
56 57 --- a/dir1/new
57 58 +++ b/dir1/copy
58 59 @@ -1,1 +1,2 @@
59 60 new
60 61 +copy1
61 62 diff --git a/dir1/new b/dir2/copy
62 63 copy from dir1/new
63 64 copy to dir2/copy
64 65 --- a/dir1/new
65 66 +++ b/dir2/copy
66 67 @@ -1,1 +1,2 @@
67 68 new
68 69 +copy2
69 70 $ hg diff --git --root dir1 -r 1:tip
70 71 diff --git a/new b/copy
71 72 copy from new
72 73 copy to copy
73 74 --- a/new
74 75 +++ b/copy
75 76 @@ -1,1 +1,2 @@
76 77 new
77 78 +copy1
78 79
79 80 $ hg diff --git --root dir2/ -r 1:tip
80 81 diff --git a/copy b/copy
81 82 new file mode 100644
82 83 --- /dev/null
83 84 +++ b/copy
84 85 @@ -0,0 +1,2 @@
85 86 +new
86 87 +copy2
87 88
88 89 $ hg diff --git --root dir1 -r 1:tip -I '**/copy'
89 90 diff --git a/new b/copy
90 91 copy from new
91 92 copy to copy
92 93 --- a/new
93 94 +++ b/copy
94 95 @@ -1,1 +1,2 @@
95 96 new
96 97 +copy1
97 98
98 99 $ hg diff --git --root dir1 -r 1:tip dir2
99 100 warning: dir2 not inside relative root dir1
100 101
101 102 $ hg diff --git --root dir1 -r 1:tip 'dir2/{copy}'
102 103 warning: dir2/{copy} not inside relative root dir1
103 104
104 105 $ cd dir1
105 106 $ hg diff --git --root .. -r 1:tip
106 107 diff --git a/dir1/new b/dir1/copy
107 108 copy from dir1/new
108 109 copy to dir1/copy
109 110 --- a/dir1/new
110 111 +++ b/dir1/copy
111 112 @@ -1,1 +1,2 @@
112 113 new
113 114 +copy1
114 115 diff --git a/dir1/new b/dir2/copy
115 116 copy from dir1/new
116 117 copy to dir2/copy
117 118 --- a/dir1/new
118 119 +++ b/dir2/copy
119 120 @@ -1,1 +1,2 @@
120 121 new
121 122 +copy2
122 123
123 124 $ hg diff --git --root ../.. -r 1:tip
124 abort: ../.. not under root '$TESTTMP'
125 abort: ../.. not under root '$TESTTMP/repo'
125 126 [255]
126 127 $ hg diff --git --root ../doesnotexist -r 1:tip
127 128 $ hg diff --git --root .. -r 1:tip
128 129 diff --git a/dir1/new b/dir1/copy
129 130 copy from dir1/new
130 131 copy to dir1/copy
131 132 --- a/dir1/new
132 133 +++ b/dir1/copy
133 134 @@ -1,1 +1,2 @@
134 135 new
135 136 +copy1
136 137 diff --git a/dir1/new b/dir2/copy
137 138 copy from dir1/new
138 139 copy to dir2/copy
139 140 --- a/dir1/new
140 141 +++ b/dir2/copy
141 142 @@ -1,1 +1,2 @@
142 143 new
143 144 +copy2
144 145
145 146 $ hg diff --git --root . -r 1:tip
146 147 diff --git a/new b/copy
147 148 copy from new
148 149 copy to copy
149 150 --- a/new
150 151 +++ b/copy
151 152 @@ -1,1 +1,2 @@
152 153 new
153 154 +copy1
154 155 $ hg diff --git --root . -r 1:tip copy
155 156 diff --git a/new b/copy
156 157 copy from new
157 158 copy to copy
158 159 --- a/new
159 160 +++ b/copy
160 161 @@ -1,1 +1,2 @@
161 162 new
162 163 +copy1
163 164 $ hg diff --git --root . -r 1:tip ../dir2
164 165 warning: ../dir2 not inside relative root .
165 166 $ hg diff --git --root . -r 1:tip '../dir2/*'
166 167 warning: ../dir2/* not inside relative root . (glob)
167 168 $ cd ..
168 169
169 170 Rename:
170 171
171 172 $ hg mv dir1/copy dir1/rename1
172 173 $ echo rename1 >> dir1/rename1
173 174 $ hg mv dir2/copy dir1/rename2
174 175 $ echo rename2 >> dir1/rename2
175 176 $ hg ci -mrename
176 177 $ hg diff --git -r 2:tip
177 178 diff --git a/dir1/copy b/dir1/rename1
178 179 rename from dir1/copy
179 180 rename to dir1/rename1
180 181 --- a/dir1/copy
181 182 +++ b/dir1/rename1
182 183 @@ -1,2 +1,3 @@
183 184 new
184 185 copy1
185 186 +rename1
186 187 diff --git a/dir2/copy b/dir1/rename2
187 188 rename from dir2/copy
188 189 rename to dir1/rename2
189 190 --- a/dir2/copy
190 191 +++ b/dir1/rename2
191 192 @@ -1,2 +1,3 @@
192 193 new
193 194 copy2
194 195 +rename2
195 196
196 197 Cross and same-directory renames with a relative root:
197 198
198 199 $ hg diff --root dir1 --git -r 2:tip
199 200 diff --git a/copy b/rename1
200 201 rename from copy
201 202 rename to rename1
202 203 --- a/copy
203 204 +++ b/rename1
204 205 @@ -1,2 +1,3 @@
205 206 new
206 207 copy1
207 208 +rename1
208 209 diff --git a/rename2 b/rename2
209 210 new file mode 100644
210 211 --- /dev/null
211 212 +++ b/rename2
212 213 @@ -0,0 +1,3 @@
213 214 +new
214 215 +copy2
215 216 +rename2
216 217
217 218 $ hg diff --root dir2 --git -r 2:tip
218 219 diff --git a/copy b/copy
219 220 deleted file mode 100644
220 221 --- a/copy
221 222 +++ /dev/null
222 223 @@ -1,2 +0,0 @@
223 224 -new
224 225 -copy2
225 226
226 227 $ hg diff --root dir1 --git -r 2:tip -I '**/copy'
227 228 diff --git a/copy b/copy
228 229 deleted file mode 100644
229 230 --- a/copy
230 231 +++ /dev/null
231 232 @@ -1,2 +0,0 @@
232 233 -new
233 234 -copy1
234 235
235 236 $ hg diff --root dir1 --git -r 2:tip -I '**/rename*'
236 237 diff --git a/copy b/rename1
237 238 copy from copy
238 239 copy to rename1
239 240 --- a/copy
240 241 +++ b/rename1
241 242 @@ -1,2 +1,3 @@
242 243 new
243 244 copy1
244 245 +rename1
245 246 diff --git a/rename2 b/rename2
246 247 new file mode 100644
247 248 --- /dev/null
248 249 +++ b/rename2
249 250 @@ -0,0 +1,3 @@
250 251 +new
251 252 +copy2
252 253 +rename2
253 254
254 255 Delete:
255 256
256 257 $ hg rm dir1/*
257 258 $ hg ci -mdelete
258 259 $ hg diff --git -r 3:tip
259 260 diff --git a/dir1/new b/dir1/new
260 261 deleted file mode 100644
261 262 --- a/dir1/new
262 263 +++ /dev/null
263 264 @@ -1,1 +0,0 @@
264 265 -new
265 266 diff --git a/dir1/rename1 b/dir1/rename1
266 267 deleted file mode 100644
267 268 --- a/dir1/rename1
268 269 +++ /dev/null
269 270 @@ -1,3 +0,0 @@
270 271 -new
271 272 -copy1
272 273 -rename1
273 274 diff --git a/dir1/rename2 b/dir1/rename2
274 275 deleted file mode 100644
275 276 --- a/dir1/rename2
276 277 +++ /dev/null
277 278 @@ -1,3 +0,0 @@
278 279 -new
279 280 -copy2
280 281 -rename2
281 282
282 283 $ cat > src <<EOF
283 284 > 1
284 285 > 2
285 286 > 3
286 287 > 4
287 288 > 5
288 289 > EOF
289 290 $ hg ci -Amsrc
290 291 adding src
291 292
292 293 #if execbit
293 294
294 295 chmod 644:
295 296
296 297 $ chmod +x src
297 298 $ hg ci -munexec
298 299 $ hg diff --git -r 5:tip
299 300 diff --git a/src b/src
300 301 old mode 100644
301 302 new mode 100755
302 303
303 304 Rename+mod+chmod:
304 305
305 306 $ hg mv src dst
306 307 $ chmod -x dst
307 308 $ echo a >> dst
308 309 $ hg ci -mrenamemod
309 310 $ hg diff --git -r 6:tip
310 311 diff --git a/src b/dst
311 312 old mode 100755
312 313 new mode 100644
313 314 rename from src
314 315 rename to dst
315 316 --- a/src
316 317 +++ b/dst
317 318 @@ -3,3 +3,4 @@
318 319 3
319 320 4
320 321 5
321 322 +a
322 323
323 324 Nonexistent in tip+chmod:
324 325
325 326 $ hg diff --git -r 5:6
326 327 diff --git a/src b/src
327 328 old mode 100644
328 329 new mode 100755
329 330
330 331 #else
331 332
332 333 Dummy changes when no exec bit, mocking the execbit commit structure
333 334
334 335 $ echo change >> src
335 336 $ hg ci -munexec
336 337 $ hg mv src dst
337 338 $ hg ci -mrenamemod
338 339
339 340 #endif
340 341
341 342 Binary diff:
342 343
343 344 $ cp "$TESTDIR/binfile.bin" .
344 345 $ hg add binfile.bin
345 346 $ hg diff --git > b.diff
346 347 $ cat b.diff
347 348 diff --git a/binfile.bin b/binfile.bin
348 349 new file mode 100644
349 350 index 0000000000000000000000000000000000000000..37ba3d1c6f17137d9c5f5776fa040caf5fe73ff9
350 351 GIT binary patch
351 352 literal 593
352 353 zc$@)I0<QguP)<h;3K|Lk000e1NJLTq000mG000mO0ssI2kdbIM00009a7bBm000XU
353 354 z000XU0RWnu7ytkO2XskIMF-Uh9TW;VpMjwv0005-Nkl<ZD9@FWPs=e;7{<>W$NUkd
354 355 zX$nnYLt$-$V!?uy+1V%`z&Eh=ah|duER<4|QWhju3gb^nF*8iYobxWG-qqXl=2~5M
355 356 z*IoDB)sG^CfNuoBmqLTVU^<;@nwHP!1wrWd`{(mHo6VNXWtyh{alzqmsH*yYzpvLT
356 357 zLdY<T=ks|woh-`&01!ej#(xbV1f|pI*=%;d-%F*E*X#ZH`4I%6SS+$EJDE&ct=8po
357 358 ziN#{?_j|kD%Cd|oiqds`xm@;oJ-^?NG3Gdqrs?5u*zI;{nogxsx~^|Fn^Y?Gdc6<;
358 359 zfMJ+iF1J`LMx&A2?dEwNW8ClebzPTbIh{@$hS6*`kH@1d%Lo7fA#}N1)oN7`gm$~V
359 360 z+wDx#)OFqMcE{s!JN0-xhG8ItAjVkJwEcb`3WWlJfU2r?;Pd%dmR+q@mSri5q9_W-
360 361 zaR2~ECX?B2w+zELozC0s*6Z~|QG^f{3I#<`?)Q7U-JZ|q5W;9Q8i_=pBuSzunx=U;
361 362 z9C)5jBoYw9^?EHyQl(M}1OlQcCX>lXB*ODN003Z&P17_@)3Pi=i0wb04<W?v-u}7K
362 363 zXmmQA+wDgE!qR9o8jr`%=ab_&uh(l?R=r;Tjiqon91I2-hIu?57~@*4h7h9uORK#=
363 364 fQItJW-{SoTm)8|5##k|m00000NkvXXu0mjf{mKw4
364 365
365 366
366 367 Import binary diff:
367 368
368 369 $ hg revert binfile.bin
369 370 $ rm binfile.bin
370 371 $ hg import -mfoo b.diff
371 372 applying b.diff
372 373 $ cmp binfile.bin "$TESTDIR/binfile.bin"
373 374
374 375 Rename binary file:
375 376
376 377 $ hg mv binfile.bin renamed.bin
377 378 $ hg diff --git
378 379 diff --git a/binfile.bin b/renamed.bin
379 380 rename from binfile.bin
380 381 rename to renamed.bin
381 382
382 383 Diff across many revisions:
383 384
384 385 $ hg mv dst dst2
385 386 $ hg ci -m 'mv dst dst2'
386 387
387 388 $ echo >> start
388 389 $ hg ci -m 'change start'
389 390
390 391 $ hg revert -r -2 start
391 392 $ hg mv dst2 dst3
392 393 $ hg ci -m 'mv dst2 dst3; revert start'
393 394
394 395 $ hg diff --git -r 9:11
395 396 diff --git a/dst2 b/dst3
396 397 rename from dst2
397 398 rename to dst3
398 399
399 400 Reversed:
400 401
401 402 $ hg diff --git -r 11:9
402 403 diff --git a/dst3 b/dst2
403 404 rename from dst3
404 405 rename to dst2
405 406
406 407
407 408 $ echo a >> foo
408 409 $ hg add foo
409 410 $ hg ci -m 'add foo'
410 411 $ echo b >> foo
411 412 $ hg ci -m 'change foo'
412 413 $ hg mv foo bar
413 414 $ hg ci -m 'mv foo bar'
414 415 $ echo c >> bar
415 416 $ hg ci -m 'change bar'
416 417
417 418 File created before r1 and renamed before r2:
418 419
419 420 $ hg diff --git -r -3:-1
420 421 diff --git a/foo b/bar
421 422 rename from foo
422 423 rename to bar
423 424 --- a/foo
424 425 +++ b/bar
425 426 @@ -1,2 +1,3 @@
426 427 a
427 428 b
428 429 +c
429 430
430 431 Reversed:
431 432
432 433 $ hg diff --git -r -1:-3
433 434 diff --git a/bar b/foo
434 435 rename from bar
435 436 rename to foo
436 437 --- a/bar
437 438 +++ b/foo
438 439 @@ -1,3 +1,2 @@
439 440 a
440 441 b
441 442 -c
442 443
443 444 File created in r1 and renamed before r2:
444 445
445 446 $ hg diff --git -r -4:-1
446 447 diff --git a/foo b/bar
447 448 rename from foo
448 449 rename to bar
449 450 --- a/foo
450 451 +++ b/bar
451 452 @@ -1,1 +1,3 @@
452 453 a
453 454 +b
454 455 +c
455 456
456 457 Reversed:
457 458
458 459 $ hg diff --git -r -1:-4
459 460 diff --git a/bar b/foo
460 461 rename from bar
461 462 rename to foo
462 463 --- a/bar
463 464 +++ b/foo
464 465 @@ -1,3 +1,1 @@
465 466 a
466 467 -b
467 468 -c
468 469
469 470 File created after r1 and renamed before r2:
470 471
471 472 $ hg diff --git -r -5:-1
472 473 diff --git a/bar b/bar
473 474 new file mode 100644
474 475 --- /dev/null
475 476 +++ b/bar
476 477 @@ -0,0 +1,3 @@
477 478 +a
478 479 +b
479 480 +c
480 481
481 482 Reversed:
482 483
483 484 $ hg diff --git -r -1:-5
484 485 diff --git a/bar b/bar
485 486 deleted file mode 100644
486 487 --- a/bar
487 488 +++ /dev/null
488 489 @@ -1,3 +0,0 @@
489 490 -a
490 491 -b
491 492 -c
492 493
493 494
494 495 Comparing with the working dir:
495 496
496 497 $ echo >> start
497 498 $ hg ci -m 'change start again'
498 499
499 500 $ echo > created
500 501 $ hg add created
501 502 $ hg ci -m 'add created'
502 503
503 504 $ hg mv created created2
504 505 $ hg ci -m 'mv created created2'
505 506
506 507 $ hg mv created2 created3
507 508
508 509 There's a copy in the working dir:
509 510
510 511 $ hg diff --git
511 512 diff --git a/created2 b/created3
512 513 rename from created2
513 514 rename to created3
514 515
515 516 There's another copy between the original rev and the wd:
516 517
517 518 $ hg diff --git -r -2
518 519 diff --git a/created b/created3
519 520 rename from created
520 521 rename to created3
521 522
522 523 The source of the copy was created after the original rev:
523 524
524 525 $ hg diff --git -r -3
525 526 diff --git a/created3 b/created3
526 527 new file mode 100644
527 528 --- /dev/null
528 529 +++ b/created3
529 530 @@ -0,0 +1,1 @@
530 531 +
531 532 $ hg ci -m 'mv created2 created3'
532 533
533 534
534 535 $ echo > brand-new
535 536 $ hg add brand-new
536 537 $ hg ci -m 'add brand-new'
537 538 $ hg mv brand-new brand-new2
538 539
539 540 Created in parent of wd; renamed in the wd:
540 541
541 542 $ hg diff --git
542 543 diff --git a/brand-new b/brand-new2
543 544 rename from brand-new
544 545 rename to brand-new2
545 546
546 547 Created between r1 and parent of wd; renamed in the wd:
547 548
548 549 $ hg diff --git -r -2
549 550 diff --git a/brand-new2 b/brand-new2
550 551 new file mode 100644
551 552 --- /dev/null
552 553 +++ b/brand-new2
553 554 @@ -0,0 +1,1 @@
554 555 +
555 556 $ hg ci -m 'mv brand-new brand-new2'
556 557
557 558 One file is copied to many destinations and removed:
558 559
559 560 $ hg cp brand-new2 brand-new3
560 561 $ hg mv brand-new2 brand-new3-2
561 562 $ hg ci -m 'multiple renames/copies'
562 563 $ hg diff --git -r -2 -r -1
563 564 diff --git a/brand-new2 b/brand-new3
564 565 rename from brand-new2
565 566 rename to brand-new3
566 567 diff --git a/brand-new2 b/brand-new3-2
567 568 copy from brand-new2
568 569 copy to brand-new3-2
569 570
570 571 Reversed:
571 572
572 573 $ hg diff --git -r -1 -r -2
573 574 diff --git a/brand-new3-2 b/brand-new2
574 575 rename from brand-new3-2
575 576 rename to brand-new2
576 577 diff --git a/brand-new3 b/brand-new3
577 578 deleted file mode 100644
578 579 --- a/brand-new3
579 580 +++ /dev/null
580 581 @@ -1,1 +0,0 @@
581 582 -
582 583
583 584 There should be a trailing TAB if there are spaces in the file name:
584 585
585 586 $ echo foo > 'with spaces'
586 587 $ hg add 'with spaces'
587 588 $ hg diff --git
588 589 diff --git a/with spaces b/with spaces
589 590 new file mode 100644
590 591 --- /dev/null
591 592 +++ b/with spaces
592 593 @@ -0,0 +1,1 @@
593 594 +foo
594 595 $ hg ci -m 'add filename with spaces'
595 596
596 597 Additions should be properly marked even in the middle of a merge
597 598
598 599 $ hg up -r -2
599 600 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
600 601 $ echo "New File" >> inmerge
601 602 $ hg add inmerge
602 603 $ hg ci -m "file in merge"
603 604 created new head
604 605 $ hg up 23
605 606 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
606 607 $ hg merge
607 608 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
608 609 (branch merge, don't forget to commit)
609 610 $ hg diff -g
610 611 diff --git a/inmerge b/inmerge
611 612 new file mode 100644
612 613 --- /dev/null
613 614 +++ b/inmerge
614 615 @@ -0,0 +1,1 @@
615 616 +New File
@@ -1,26 +1,27 b''
1 1 https://bz.mercurial-scm.org/1089
2 2
3 $ hg init
3 $ hg init repo
4 $ cd repo
4 5 $ mkdir a
5 6 $ echo a > a/b
6 7 $ hg ci -Am m
7 8 adding a/b
8 9
9 10 $ hg rm a
10 11 removing a/b
11 12 $ hg ci -m m a
12 13
13 14 $ mkdir a b
14 15 $ echo a > a/b
15 16 $ hg ci -Am m
16 17 adding a/b
17 18
18 19 $ hg rm a
19 20 removing a/b
20 21 $ cd b
21 22
22 23 Relative delete:
23 24
24 25 $ hg ci -m m ../a
25 26
26 27 $ cd ..
@@ -1,96 +1,97 b''
1 1 https://bz.mercurial-scm.org/1175
2 2
3 $ hg init
3 $ hg init repo
4 $ cd repo
4 5 $ touch a
5 6 $ hg ci -Am0
6 7 adding a
7 8
8 9 $ hg mv a a1
9 10 $ hg ci -m1
10 11
11 12 $ hg co 0
12 13 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
13 14
14 15 $ hg mv a a2
15 16 $ hg up
16 17 note: possible conflict - a was renamed multiple times to:
17 18 a1
18 19 a2
19 20 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
20 21
21 22 $ hg ci -m2
22 23
23 24 $ touch a
24 25 $ hg ci -Am3
25 26 adding a
26 27
27 28 $ hg mv a b
28 29 $ hg ci -Am4 a
29 30
30 31 $ hg ci --debug --traceback -Am5 b
31 32 committing files:
32 33 b
33 34 warning: can't find ancestor for 'b' copied from 'a'!
34 35 committing manifest
35 36 committing changelog
36 37 updating the branch cache
37 38 committed changeset 5:83a687e8a97c80992ba385bbfd766be181bfb1d1
38 39
39 40 $ hg verify
40 41 checking changesets
41 42 checking manifests
42 43 crosschecking files in changesets and manifests
43 44 checking files
44 45 checked 6 changesets with 4 changes to 4 files
45 46
46 47 $ hg export --git tip
47 48 # HG changeset patch
48 49 # User test
49 50 # Date 0 0
50 51 # Thu Jan 01 00:00:00 1970 +0000
51 52 # Node ID 83a687e8a97c80992ba385bbfd766be181bfb1d1
52 53 # Parent 1d1625283f71954f21d14c3d44d0ad3c019c597f
53 54 5
54 55
55 56 diff --git a/b b/b
56 57 new file mode 100644
57 58
58 59 https://bz.mercurial-scm.org/show_bug.cgi?id=4476
59 60
60 61 $ hg init foo
61 62 $ cd foo
62 63 $ touch a && hg ci -Aqm a
63 64 $ hg mv a b
64 65 $ echo b1 >> b
65 66 $ hg ci -Aqm b1
66 67 $ hg up 0
67 68 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
68 69 $ hg mv a b
69 70 $ echo b2 >> b
70 71 $ hg ci -Aqm b2
71 72 $ hg graft 1
72 73 grafting 1:5974126fad84 "b1"
73 74 merging b
74 75 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
75 76 abort: unresolved conflicts, can't continue
76 77 (use 'hg resolve' and 'hg graft --continue')
77 78 [1]
78 79 $ echo a > b
79 80 $ echo b3 >> b
80 81 $ hg resolve --mark b
81 82 (no more unresolved files)
82 83 continue: hg graft --continue
83 84 $ hg graft --continue
84 85 grafting 1:5974126fad84 "b1"
85 86 $ hg log -f b -T 'changeset: {rev}:{node|short}\nsummary: {desc}\n\n'
86 87 changeset: 3:376d30ccffc0
87 88 summary: b1
88 89
89 90 changeset: 2:416baaa2e5e4
90 91 summary: b2
91 92
92 93 changeset: 0:3903775176ed
93 94 summary: a
94 95
95 96
96 97
@@ -1,23 +1,24 b''
1 1 #require symlink
2 2
3 3 https://bz.mercurial-scm.org/1438
4 4
5 $ hg init
5 $ hg init repo
6 $ cd repo
6 7
7 8 $ ln -s foo link
8 9 $ hg add link
9 10 $ hg ci -mbad link
10 11 $ hg rm link
11 12 $ hg ci -mok
12 13 $ hg diff -g -r 0:1 > bad.patch
13 14
14 15 $ hg up 0
15 16 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
16 17
17 18 $ hg import --no-commit bad.patch
18 19 applying bad.patch
19 20
20 21 $ hg status
21 22 R link
22 23 ? bad.patch
23 24
@@ -1,52 +1,53 b''
1 1 https://bz.mercurial-scm.org/522
2 2
3 3 In the merge below, the file "foo" has the same contents in both
4 4 parents, but if we look at the file-level history, we'll notice that
5 5 the version in p1 is an ancestor of the version in p2. This test makes
6 6 sure that we'll use the version from p2 in the manifest of the merge
7 7 revision.
8 8
9 $ hg init
9 $ hg init repo
10 $ cd repo
10 11
11 12 $ echo foo > foo
12 13 $ hg ci -qAm 'add foo'
13 14
14 15 $ echo bar >> foo
15 16 $ hg ci -m 'change foo'
16 17
17 18 $ hg backout -r tip -m 'backout changed foo'
18 19 reverting foo
19 20 changeset 2:4d9e78aaceee backs out changeset 1:b515023e500e
20 21
21 22 $ hg up -C 0
22 23 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
23 24
24 25 $ touch bar
25 26 $ hg ci -qAm 'add bar'
26 27
27 28 $ hg merge --debug
28 29 resolving manifests
29 30 branchmerge: True, force: False, partial: False
30 31 ancestor: bbd179dfa0a7, local: 71766447bdbb+, remote: 4d9e78aaceee
31 32 foo: remote is newer -> g
32 33 getting foo
33 34 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 35 (branch merge, don't forget to commit)
35 36
36 37 $ hg debugstate | grep foo
37 38 m 0 -2 unset foo
38 39
39 40 $ hg st -A foo
40 41 M foo
41 42
42 43 $ hg ci -m 'merge'
43 44
44 45 $ hg manifest --debug | grep foo
45 46 c6fc755d7e68f49f880599da29f15add41f42f5a 644 foo
46 47
47 48 $ hg debugindex foo
48 49 rev linkrev nodeid p1-nodeid p2-nodeid
49 50 0 0 2ed2a3912a0b 000000000000 000000000000
50 51 1 1 6f4310b00b9a 2ed2a3912a0b 000000000000
51 52 2 2 c6fc755d7e68 6f4310b00b9a 000000000000
52 53
@@ -1,34 +1,35 b''
1 1 https://bz.mercurial-scm.org/612
2 2
3 $ hg init
3 $ hg init repo
4 $ cd repo
4 5 $ mkdir src
5 6 $ echo a > src/a.c
6 7 $ hg ci -Ama
7 8 adding src/a.c
8 9
9 10 $ hg mv src source
10 11 moving src/a.c to source/a.c
11 12
12 13 $ hg ci -Ammove
13 14
14 15 $ hg co -C 0
15 16 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
16 17
17 18 $ echo new > src/a.c
18 19 $ echo compiled > src/a.o
19 20 $ hg ci -mupdate
20 21 created new head
21 22
22 23 $ hg status
23 24 ? src/a.o
24 25
25 26 $ hg merge
26 27 merging src/a.c and source/a.c to source/a.c
27 28 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
28 29 (branch merge, don't forget to commit)
29 30
30 31 $ hg status
31 32 M source/a.c
32 33 R src/a.c
33 34 ? src/a.o
34 35
@@ -1,36 +1,37 b''
1 1 https://bz.mercurial-scm.org/619
2 2
3 $ hg init
3 $ hg init repo
4 $ cd repo
4 5 $ echo a > a
5 6 $ hg ci -Ama
6 7 adding a
7 8
8 9 $ echo b > b
9 10 $ hg branch b
10 11 marked working directory as branch b
11 12 (branches are permanent and global, did you want a bookmark?)
12 13 $ hg ci -Amb
13 14 adding b
14 15
15 16 $ hg co -C 0
16 17 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
17 18
18 19 Fast-forward:
19 20
20 21 $ hg merge b
21 22 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
22 23 (branch merge, don't forget to commit)
23 24 $ hg ci -Ammerge
24 25
25 26 Bogus fast-forward should fail:
26 27
27 28 $ hg merge b
28 29 abort: merging with a working directory ancestor has no effect
29 30 [255]
30 31
31 32 Even with strange revset (issue4465)
32 33
33 34 $ hg merge ::.
34 35 abort: merging with a working directory ancestor has no effect
35 36 [255]
36 37
@@ -1,99 +1,100 b''
1 1 https://bz.mercurial-scm.org/672
2 2
3 3 # 0-2-4
4 4 # \ \ \
5 5 # 1-3-5
6 6 #
7 7 # rename in #1, content change in #4.
8 8
9 $ hg init
9 $ hg init repo
10 $ cd repo
10 11
11 12 $ touch 1
12 13 $ touch 2
13 14 $ hg commit -Am init # 0
14 15 adding 1
15 16 adding 2
16 17
17 18 $ hg rename 1 1a
18 19 $ hg commit -m rename # 1
19 20
20 21 $ hg co -C 0
21 22 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
22 23
23 24 $ echo unrelated >> 2
24 25 $ hg ci -m unrelated1 # 2
25 26 created new head
26 27
27 28 $ hg merge --debug 1
28 29 unmatched files in other:
29 30 1a
30 31 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
31 32 on remote side:
32 33 src: '1' -> dst: '1a'
33 34 checking for directory renames
34 35 resolving manifests
35 36 branchmerge: True, force: False, partial: False
36 37 ancestor: 81f4b099af3d, local: c64f439569a9+, remote: c12dcd37c90a
37 38 1: other deleted -> r
38 39 removing 1
39 40 1a: remote created -> g
40 41 getting 1a
41 42 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
42 43 (branch merge, don't forget to commit)
43 44
44 45 $ hg ci -m merge1 # 3
45 46
46 47 $ hg co -C 2
47 48 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
48 49
49 50 $ echo hello >> 1
50 51 $ hg ci -m unrelated2 # 4
51 52 created new head
52 53
53 54 $ hg co -C 3
54 55 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
55 56
56 57 $ hg merge -y --debug 4
57 58 unmatched files in local:
58 59 1a
59 60 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
60 61 on local side:
61 62 src: '1' -> dst: '1a' *
62 63 checking for directory renames
63 64 resolving manifests
64 65 branchmerge: True, force: False, partial: False
65 66 ancestor: c64f439569a9, local: f4a9cff3cd0b+, remote: 746e9549ea96
66 67 starting 4 threads for background file closing (?)
67 68 preserving 1a for resolve of 1a
68 69 1a: local copied/moved from 1 -> m
69 70 picked tool ':merge' for 1a (binary False symlink False changedelete False)
70 71 merging 1a and 1 to 1a
71 72 my 1a@f4a9cff3cd0b+ other 1@746e9549ea96 ancestor 1@c64f439569a9
72 73 premerge successful
73 74 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
74 75 (branch merge, don't forget to commit)
75 76
76 77 $ hg co -C 4
77 78 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
78 79
79 80 $ hg merge -y --debug 3
80 81 unmatched files in other:
81 82 1a
82 83 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
83 84 on remote side:
84 85 src: '1' -> dst: '1a' *
85 86 checking for directory renames
86 87 resolving manifests
87 88 branchmerge: True, force: False, partial: False
88 89 ancestor: c64f439569a9, local: 746e9549ea96+, remote: f4a9cff3cd0b
89 90 starting 4 threads for background file closing (?)
90 91 preserving 1 for resolve of 1a
91 92 removing 1
92 93 1a: remote moved from 1 -> m
93 94 picked tool ':merge' for 1a (binary False symlink False changedelete False)
94 95 merging 1 and 1a to 1a
95 96 my 1a@746e9549ea96+ other 1a@f4a9cff3cd0b ancestor 1@c64f439569a9
96 97 premerge successful
97 98 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
98 99 (branch merge, don't forget to commit)
99 100
@@ -1,39 +1,40 b''
1 1 https://bz.mercurial-scm.org/842
2 2
3 $ hg init
3 $ hg init repo
4 $ cd repo
4 5 $ echo foo > a
5 6 $ hg ci -Ama
6 7 adding a
7 8
8 9 $ hg up -r0000
9 10 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
10 11
11 12 $ echo bar > a
12 13
13 14 Should issue new head warning:
14 15
15 16 $ hg ci -Amb
16 17 adding a
17 18 created new head
18 19
19 20 $ hg up -r0000
20 21 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
21 22
22 23 $ echo stuffy > a
23 24
24 25 Should not issue new head warning:
25 26
26 27 $ hg ci -q -Amc
27 28
28 29 $ hg up -r0000
29 30 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
30 31
31 32 $ echo crap > a
32 33 $ hg branch testing
33 34 marked working directory as branch testing
34 35 (branches are permanent and global, did you want a bookmark?)
35 36
36 37 Should not issue warning:
37 38
38 39 $ hg ci -q -Amd
39 40
@@ -1,60 +1,61 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3 $ echo a > a
3 4 $ hg ci -Am0
4 5 adding a
5 6
6 7 $ hg -q clone . foo
7 8
8 9 $ touch .hg/store/journal
9 10
10 11 $ echo foo > a
11 12 $ hg ci -Am0
12 13 abort: abandoned transaction found
13 14 (run 'hg recover' to clean up transaction)
14 15 [255]
15 16
16 17 $ hg recover
17 18 rolling back interrupted transaction
18 19 (verify step skipped, run `hg verify` to check your repository content)
19 20
20 21 recover, explicit verify
21 22
22 23 $ touch .hg/store/journal
23 24 $ hg ci -Am0
24 25 abort: abandoned transaction found
25 26 (run 'hg recover' to clean up transaction)
26 27 [255]
27 28 $ hg recover --verify
28 29 rolling back interrupted transaction
29 30 checking changesets
30 31 checking manifests
31 32 crosschecking files in changesets and manifests
32 33 checking files
33 34 checked 1 changesets with 1 changes to 1 files
34 35
35 36 recover, no verify
36 37
37 38 $ touch .hg/store/journal
38 39 $ hg ci -Am0
39 40 abort: abandoned transaction found
40 41 (run 'hg recover' to clean up transaction)
41 42 [255]
42 43 $ hg recover --no-verify
43 44 rolling back interrupted transaction
44 45 (verify step skipped, run `hg verify` to check your repository content)
45 46
46 47
47 48 Check that zero-size journals are correctly aborted:
48 49
49 50 #if unix-permissions no-root
50 51 $ hg bundle -qa repo.hg
51 52 $ chmod -w foo/.hg/store/00changelog.i
52 53
53 54 $ hg -R foo unbundle repo.hg
54 55 adding changesets
55 abort: Permission denied: '$TESTTMP/foo/.hg/store/.00changelog.i-*' (glob)
56 abort: Permission denied: '$TESTTMP/repo/foo/.hg/store/.00changelog.i-*' (glob)
56 57 [255]
57 58
58 59 $ if test -f foo/.hg/store/journal; then echo 'journal exists :-('; fi
59 60 #endif
60 61
@@ -1,49 +1,50 b''
1 1 Tests that the exit code is as expected when ui.detailed-exit-code is *not*
2 2 enabled.
3 3
4 4 $ cat >> $HGRCPATH << EOF
5 5 > [ui]
6 6 > detailed-exit-code=no
7 7 > EOF
8 8
9 $ hg init
9 $ hg init repo
10 $ cd repo
10 11 $ echo a > a
11 12 Expect exit code 0 on success
12 13 $ hg ci -Aqm initial
13 14
14 15 $ hg co nonexistent
15 16 abort: unknown revision 'nonexistent'
16 17 [255]
17 18
18 19 $ hg co 'none()'
19 20 abort: empty revision set
20 21 [255]
21 22
22 23 $ hg co 'invalid('
23 24 hg: parse error at 8: not a prefix: end
24 25 (invalid(
25 26 ^ here)
26 27 [255]
27 28
28 29 $ hg co 'invalid('
29 30 hg: parse error at 8: not a prefix: end
30 31 (invalid(
31 32 ^ here)
32 33 [255]
33 34
34 35 $ hg continue
35 36 abort: no operation in progress
36 37 [255]
37 38
38 39 $ hg st --config a=b
39 40 abort: malformed --config option: 'a=b' (use --config section.name=value)
40 41 [255]
41 42
42 43 $ echo b > a
43 44 $ hg ci -m second
44 45 $ echo c > a
45 46 $ hg ci -m third
46 47 $ hg --config extensions.rebase= rebase -r . -d 0 -q
47 48 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
48 49 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
49 50 [1]
@@ -1,1153 +1,1154 b''
1 1 $ cat >> $HGRCPATH << EOF
2 2 > [diff]
3 3 > git = true
4 4 > EOF
5 5
6 $ hg init
6 $ hg init repo
7 $ cd repo
7 8 $ cat > foo << EOF
8 9 > 0
9 10 > 1
10 11 > 2
11 12 > 3
12 13 > 4
13 14 > EOF
14 15 $ hg ci -Am init
15 16 adding foo
16 17 $ cat > foo << EOF
17 18 > 0
18 19 > 0
19 20 > 0
20 21 > 0
21 22 > 1
22 23 > 2
23 24 > 3
24 25 > 4
25 26 > EOF
26 27 $ hg ci -m 'more 0'
27 28 $ sed 's/2/2+/' foo > foo.new
28 29 $ mv foo.new foo
29 30 $ cat > bar << EOF
30 31 > a
31 32 > b
32 33 > c
33 34 > d
34 35 > e
35 36 > EOF
36 37 $ hg add bar
37 38 $ hg ci -Am "2 -> 2+; added bar"
38 39 $ cat >> foo << EOF
39 40 > 5
40 41 > 6
41 42 > 7
42 43 > 8
43 44 > 9
44 45 > 10
45 46 > 11
46 47 > EOF
47 48 $ hg ci -m "to 11"
48 49
49 50 Add some changes with two diff hunks
50 51
51 52 $ sed 's/^1$/ 1/' foo > foo.new
52 53 $ mv foo.new foo
53 54 $ sed 's/^11$/11+/' foo > foo.new
54 55 $ mv foo.new foo
55 56 $ hg ci -m '11 -> 11+; leading space before "1"'
56 57 (make sure there are two hunks in "foo")
57 58 $ hg diff -c .
58 59 diff --git a/foo b/foo
59 60 --- a/foo
60 61 +++ b/foo
61 62 @@ -2,7 +2,7 @@
62 63 0
63 64 0
64 65 0
65 66 -1
66 67 + 1
67 68 2+
68 69 3
69 70 4
70 71 @@ -12,4 +12,4 @@
71 72 8
72 73 9
73 74 10
74 75 -11
75 76 +11+
76 77 $ sed 's/3/3+/' foo > foo.new
77 78 $ mv foo.new foo
78 79 $ sed 's/^11+$/11-/' foo > foo.new
79 80 $ mv foo.new foo
80 81 $ sed 's/a/a+/' bar > bar.new
81 82 $ mv bar.new bar
82 83 $ hg ci -m 'foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+'
83 84 (make sure there are two hunks in "foo")
84 85 $ hg diff -c . foo
85 86 diff --git a/foo b/foo
86 87 --- a/foo
87 88 +++ b/foo
88 89 @@ -4,7 +4,7 @@
89 90 0
90 91 1
91 92 2+
92 93 -3
93 94 +3+
94 95 4
95 96 5
96 97 6
97 98 @@ -12,4 +12,4 @@
98 99 8
99 100 9
100 101 10
101 102 -11+
102 103 +11-
103 104
104 105 $ hg log -f -L foo,5:7 -p
105 106 changeset: 5:cfdf972b3971
106 107 tag: tip
107 108 user: test
108 109 date: Thu Jan 01 00:00:00 1970 +0000
109 110 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
110 111
111 112 diff --git a/foo b/foo
112 113 --- a/foo
113 114 +++ b/foo
114 115 @@ -4,7 +4,7 @@
115 116 0
116 117 1
117 118 2+
118 119 -3
119 120 +3+
120 121 4
121 122 5
122 123 6
123 124
124 125 changeset: 4:eaec41c1a0c9
125 126 user: test
126 127 date: Thu Jan 01 00:00:00 1970 +0000
127 128 summary: 11 -> 11+; leading space before "1"
128 129
129 130 diff --git a/foo b/foo
130 131 --- a/foo
131 132 +++ b/foo
132 133 @@ -2,7 +2,7 @@
133 134 0
134 135 0
135 136 0
136 137 -1
137 138 + 1
138 139 2+
139 140 3
140 141 4
141 142
142 143 changeset: 2:63a884426fd0
143 144 user: test
144 145 date: Thu Jan 01 00:00:00 1970 +0000
145 146 summary: 2 -> 2+; added bar
146 147
147 148 diff --git a/foo b/foo
148 149 --- a/foo
149 150 +++ b/foo
150 151 @@ -3,6 +3,6 @@
151 152 0
152 153 0
153 154 1
154 155 -2
155 156 +2+
156 157 3
157 158 4
158 159
159 160 changeset: 0:5ae1f82b9a00
160 161 user: test
161 162 date: Thu Jan 01 00:00:00 1970 +0000
162 163 summary: init
163 164
164 165 diff --git a/foo b/foo
165 166 new file mode 100644
166 167 --- /dev/null
167 168 +++ b/foo
168 169 @@ -0,0 +1,5 @@
169 170 +0
170 171 +1
171 172 +2
172 173 +3
173 174 +4
174 175
175 176 $ hg log -f --graph -L foo,5:7 -p
176 177 @ changeset: 5:cfdf972b3971
177 178 | tag: tip
178 179 | user: test
179 180 | date: Thu Jan 01 00:00:00 1970 +0000
180 181 | summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
181 182 |
182 183 | diff --git a/foo b/foo
183 184 | --- a/foo
184 185 | +++ b/foo
185 186 | @@ -4,7 +4,7 @@
186 187 | 0
187 188 | 1
188 189 | 2+
189 190 | -3
190 191 | +3+
191 192 | 4
192 193 | 5
193 194 | 6
194 195 |
195 196 o changeset: 4:eaec41c1a0c9
196 197 : user: test
197 198 : date: Thu Jan 01 00:00:00 1970 +0000
198 199 : summary: 11 -> 11+; leading space before "1"
199 200 :
200 201 : diff --git a/foo b/foo
201 202 : --- a/foo
202 203 : +++ b/foo
203 204 : @@ -2,7 +2,7 @@
204 205 : 0
205 206 : 0
206 207 : 0
207 208 : -1
208 209 : + 1
209 210 : 2+
210 211 : 3
211 212 : 4
212 213 :
213 214 o changeset: 2:63a884426fd0
214 215 : user: test
215 216 : date: Thu Jan 01 00:00:00 1970 +0000
216 217 : summary: 2 -> 2+; added bar
217 218 :
218 219 : diff --git a/foo b/foo
219 220 : --- a/foo
220 221 : +++ b/foo
221 222 : @@ -3,6 +3,6 @@
222 223 : 0
223 224 : 0
224 225 : 1
225 226 : -2
226 227 : +2+
227 228 : 3
228 229 : 4
229 230 :
230 231 o changeset: 0:5ae1f82b9a00
231 232 user: test
232 233 date: Thu Jan 01 00:00:00 1970 +0000
233 234 summary: init
234 235
235 236 diff --git a/foo b/foo
236 237 new file mode 100644
237 238 --- /dev/null
238 239 +++ b/foo
239 240 @@ -0,0 +1,5 @@
240 241 +0
241 242 +1
242 243 +2
243 244 +3
244 245 +4
245 246
246 247
247 248 With --template.
248 249
249 250 $ hg log -f -L foo,5:7 -T '{rev}:{node|short} {desc|firstline}\n'
250 251 5:cfdf972b3971 foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
251 252 4:eaec41c1a0c9 11 -> 11+; leading space before "1"
252 253 2:63a884426fd0 2 -> 2+; added bar
253 254 0:5ae1f82b9a00 init
254 255 $ hg log -f -L foo,5:7 -T json
255 256 [
256 257 {
257 258 "bookmarks": [],
258 259 "branch": "default",
259 260 "date": [0, 0],
260 261 "desc": "foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+",
261 262 "node": "cfdf972b3971a2a59638bf9583c0debbffee5404",
262 263 "parents": ["eaec41c1a0c9ad0a5e999611d0149d171beffb8c"],
263 264 "phase": "draft",
264 265 "rev": 5,
265 266 "tags": ["tip"],
266 267 "user": "test"
267 268 },
268 269 {
269 270 "bookmarks": [],
270 271 "branch": "default",
271 272 "date": [0, 0],
272 273 "desc": "11 -> 11+; leading space before \"1\"",
273 274 "node": "eaec41c1a0c9ad0a5e999611d0149d171beffb8c",
274 275 "parents": ["730a61fbaecf426c17c2c66bc42d195b5d5b0ba8"],
275 276 "phase": "draft",
276 277 "rev": 4,
277 278 "tags": [],
278 279 "user": "test"
279 280 },
280 281 {
281 282 "bookmarks": [],
282 283 "branch": "default",
283 284 "date": [0, 0],
284 285 "desc": "2 -> 2+; added bar",
285 286 "node": "63a884426fd0b277fcd55895bbb2f230434576eb",
286 287 "parents": ["29a1e7c6b80024f63f310a2d71de979e9d2996d7"],
287 288 "phase": "draft",
288 289 "rev": 2,
289 290 "tags": [],
290 291 "user": "test"
291 292 },
292 293 {
293 294 "bookmarks": [],
294 295 "branch": "default",
295 296 "date": [0, 0],
296 297 "desc": "init",
297 298 "node": "5ae1f82b9a000ff1e0967d0dac1c58b9d796e1b4",
298 299 "parents": ["0000000000000000000000000000000000000000"],
299 300 "phase": "draft",
300 301 "rev": 0,
301 302 "tags": [],
302 303 "user": "test"
303 304 }
304 305 ]
305 306
306 307 With some white-space diff option, respective revisions are skipped.
307 308
308 309 $ hg log -f -L foo,5:7 -p --config diff.ignorews=true
309 310 changeset: 5:cfdf972b3971
310 311 tag: tip
311 312 user: test
312 313 date: Thu Jan 01 00:00:00 1970 +0000
313 314 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
314 315
315 316 diff --git a/foo b/foo
316 317 --- a/foo
317 318 +++ b/foo
318 319 @@ -4,7 +4,7 @@
319 320 0
320 321 1
321 322 2+
322 323 -3
323 324 +3+
324 325 4
325 326 5
326 327 6
327 328
328 329 changeset: 2:63a884426fd0
329 330 user: test
330 331 date: Thu Jan 01 00:00:00 1970 +0000
331 332 summary: 2 -> 2+; added bar
332 333
333 334 diff --git a/foo b/foo
334 335 --- a/foo
335 336 +++ b/foo
336 337 @@ -3,6 +3,6 @@
337 338 0
338 339 0
339 340 1
340 341 -2
341 342 +2+
342 343 3
343 344 4
344 345
345 346 changeset: 0:5ae1f82b9a00
346 347 user: test
347 348 date: Thu Jan 01 00:00:00 1970 +0000
348 349 summary: init
349 350
350 351 diff --git a/foo b/foo
351 352 new file mode 100644
352 353 --- /dev/null
353 354 +++ b/foo
354 355 @@ -0,0 +1,5 @@
355 356 +0
356 357 +1
357 358 +2
358 359 +3
359 360 +4
360 361
361 362
362 363 Regular file patterns are not allowed.
363 364
364 365 $ hg log -f -L foo,5:7 -p bar
365 366 abort: FILE arguments are not compatible with --line-range option
366 367 [10]
367 368
368 369 Option --rev acts as a restriction.
369 370
370 371 $ hg log -f -L foo,5:7 -p -r 'desc(2)'
371 372 changeset: 2:63a884426fd0
372 373 user: test
373 374 date: Thu Jan 01 00:00:00 1970 +0000
374 375 summary: 2 -> 2+; added bar
375 376
376 377 diff --git a/foo b/foo
377 378 --- a/foo
378 379 +++ b/foo
379 380 @@ -3,6 +3,6 @@
380 381 0
381 382 0
382 383 1
383 384 -2
384 385 +2+
385 386 3
386 387 4
387 388
388 389 changeset: 0:5ae1f82b9a00
389 390 user: test
390 391 date: Thu Jan 01 00:00:00 1970 +0000
391 392 summary: init
392 393
393 394 diff --git a/foo b/foo
394 395 new file mode 100644
395 396 --- /dev/null
396 397 +++ b/foo
397 398 @@ -0,0 +1,5 @@
398 399 +0
399 400 +1
400 401 +2
401 402 +3
402 403 +4
403 404
404 405
405 406 With several -L patterns, changes touching any files in their respective line
406 407 range are show.
407 408
408 409 $ hg log -f -L foo,5:7 -L bar,1:2 -p
409 410 changeset: 5:cfdf972b3971
410 411 tag: tip
411 412 user: test
412 413 date: Thu Jan 01 00:00:00 1970 +0000
413 414 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
414 415
415 416 diff --git a/bar b/bar
416 417 --- a/bar
417 418 +++ b/bar
418 419 @@ -1,4 +1,4 @@
419 420 -a
420 421 +a+
421 422 b
422 423 c
423 424 d
424 425 diff --git a/foo b/foo
425 426 --- a/foo
426 427 +++ b/foo
427 428 @@ -4,7 +4,7 @@
428 429 0
429 430 1
430 431 2+
431 432 -3
432 433 +3+
433 434 4
434 435 5
435 436 6
436 437
437 438 changeset: 4:eaec41c1a0c9
438 439 user: test
439 440 date: Thu Jan 01 00:00:00 1970 +0000
440 441 summary: 11 -> 11+; leading space before "1"
441 442
442 443 diff --git a/foo b/foo
443 444 --- a/foo
444 445 +++ b/foo
445 446 @@ -2,7 +2,7 @@
446 447 0
447 448 0
448 449 0
449 450 -1
450 451 + 1
451 452 2+
452 453 3
453 454 4
454 455
455 456 changeset: 2:63a884426fd0
456 457 user: test
457 458 date: Thu Jan 01 00:00:00 1970 +0000
458 459 summary: 2 -> 2+; added bar
459 460
460 461 diff --git a/bar b/bar
461 462 new file mode 100644
462 463 --- /dev/null
463 464 +++ b/bar
464 465 @@ -0,0 +1,5 @@
465 466 +a
466 467 +b
467 468 +c
468 469 +d
469 470 +e
470 471 diff --git a/foo b/foo
471 472 --- a/foo
472 473 +++ b/foo
473 474 @@ -3,6 +3,6 @@
474 475 0
475 476 0
476 477 1
477 478 -2
478 479 +2+
479 480 3
480 481 4
481 482
482 483 changeset: 0:5ae1f82b9a00
483 484 user: test
484 485 date: Thu Jan 01 00:00:00 1970 +0000
485 486 summary: init
486 487
487 488 diff --git a/foo b/foo
488 489 new file mode 100644
489 490 --- /dev/null
490 491 +++ b/foo
491 492 @@ -0,0 +1,5 @@
492 493 +0
493 494 +1
494 495 +2
495 496 +3
496 497 +4
497 498
498 499
499 500 Multiple -L options with the same file yields changes touching any of
500 501 specified line ranges.
501 502
502 503 $ hg log -f -L foo,5:7 -L foo,14:15 -p
503 504 changeset: 5:cfdf972b3971
504 505 tag: tip
505 506 user: test
506 507 date: Thu Jan 01 00:00:00 1970 +0000
507 508 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
508 509
509 510 diff --git a/foo b/foo
510 511 --- a/foo
511 512 +++ b/foo
512 513 @@ -4,7 +4,7 @@
513 514 0
514 515 1
515 516 2+
516 517 -3
517 518 +3+
518 519 4
519 520 5
520 521 6
521 522 @@ -12,4 +12,4 @@
522 523 8
523 524 9
524 525 10
525 526 -11+
526 527 +11-
527 528
528 529 changeset: 4:eaec41c1a0c9
529 530 user: test
530 531 date: Thu Jan 01 00:00:00 1970 +0000
531 532 summary: 11 -> 11+; leading space before "1"
532 533
533 534 diff --git a/foo b/foo
534 535 --- a/foo
535 536 +++ b/foo
536 537 @@ -2,7 +2,7 @@
537 538 0
538 539 0
539 540 0
540 541 -1
541 542 + 1
542 543 2+
543 544 3
544 545 4
545 546 @@ -12,4 +12,4 @@
546 547 8
547 548 9
548 549 10
549 550 -11
550 551 +11+
551 552
552 553 changeset: 3:730a61fbaecf
553 554 user: test
554 555 date: Thu Jan 01 00:00:00 1970 +0000
555 556 summary: to 11
556 557
557 558 diff --git a/foo b/foo
558 559 --- a/foo
559 560 +++ b/foo
560 561 @@ -6,3 +6,10 @@
561 562 2+
562 563 3
563 564 4
564 565 +5
565 566 +6
566 567 +7
567 568 +8
568 569 +9
569 570 +10
570 571 +11
571 572
572 573 changeset: 2:63a884426fd0
573 574 user: test
574 575 date: Thu Jan 01 00:00:00 1970 +0000
575 576 summary: 2 -> 2+; added bar
576 577
577 578 diff --git a/foo b/foo
578 579 --- a/foo
579 580 +++ b/foo
580 581 @@ -3,6 +3,6 @@
581 582 0
582 583 0
583 584 1
584 585 -2
585 586 +2+
586 587 3
587 588 4
588 589
589 590 changeset: 0:5ae1f82b9a00
590 591 user: test
591 592 date: Thu Jan 01 00:00:00 1970 +0000
592 593 summary: init
593 594
594 595 diff --git a/foo b/foo
595 596 new file mode 100644
596 597 --- /dev/null
597 598 +++ b/foo
598 599 @@ -0,0 +1,5 @@
599 600 +0
600 601 +1
601 602 +2
602 603 +3
603 604 +4
604 605
605 606
606 607 A file with a comma in its name.
607 608
608 609 $ cat > ba,z << EOF
609 610 > q
610 611 > w
611 612 > e
612 613 > r
613 614 > t
614 615 > y
615 616 > EOF
616 617 $ hg ci -Am 'querty'
617 618 adding ba,z
618 619 $ cat >> ba,z << EOF
619 620 > u
620 621 > i
621 622 > o
622 623 > p
623 624 > EOF
624 625 $ hg ci -m 'more keys'
625 626 $ cat > ba,z << EOF
626 627 > a
627 628 > z
628 629 > e
629 630 > r
630 631 > t
631 632 > y
632 633 > u
633 634 > i
634 635 > o
635 636 > p
636 637 > EOF
637 638 $ hg ci -m 'azerty'
638 639 $ hg log -f -L ba,z,1:2 -p
639 640 changeset: 8:52373265138b
640 641 tag: tip
641 642 user: test
642 643 date: Thu Jan 01 00:00:00 1970 +0000
643 644 summary: azerty
644 645
645 646 diff --git a/ba,z b/ba,z
646 647 --- a/ba,z
647 648 +++ b/ba,z
648 649 @@ -1,5 +1,5 @@
649 650 -q
650 651 -w
651 652 +a
652 653 +z
653 654 e
654 655 r
655 656 t
656 657
657 658 changeset: 6:96ba8850f316
658 659 user: test
659 660 date: Thu Jan 01 00:00:00 1970 +0000
660 661 summary: querty
661 662
662 663 diff --git a/ba,z b/ba,z
663 664 new file mode 100644
664 665 --- /dev/null
665 666 +++ b/ba,z
666 667 @@ -0,0 +1,6 @@
667 668 +q
668 669 +w
669 670 +e
670 671 +r
671 672 +t
672 673 +y
673 674
674 675
675 676 Exact prefix kinds work in -L options.
676 677
677 678 $ mkdir dir
678 679 $ cd dir
679 680 $ hg log -f -L path:foo,5:7 -p
680 681 changeset: 5:cfdf972b3971
681 682 user: test
682 683 date: Thu Jan 01 00:00:00 1970 +0000
683 684 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
684 685
685 686 diff --git a/foo b/foo
686 687 --- a/foo
687 688 +++ b/foo
688 689 @@ -4,7 +4,7 @@
689 690 0
690 691 1
691 692 2+
692 693 -3
693 694 +3+
694 695 4
695 696 5
696 697 6
697 698
698 699 changeset: 4:eaec41c1a0c9
699 700 user: test
700 701 date: Thu Jan 01 00:00:00 1970 +0000
701 702 summary: 11 -> 11+; leading space before "1"
702 703
703 704 diff --git a/foo b/foo
704 705 --- a/foo
705 706 +++ b/foo
706 707 @@ -2,7 +2,7 @@
707 708 0
708 709 0
709 710 0
710 711 -1
711 712 + 1
712 713 2+
713 714 3
714 715 4
715 716
716 717 changeset: 2:63a884426fd0
717 718 user: test
718 719 date: Thu Jan 01 00:00:00 1970 +0000
719 720 summary: 2 -> 2+; added bar
720 721
721 722 diff --git a/foo b/foo
722 723 --- a/foo
723 724 +++ b/foo
724 725 @@ -3,6 +3,6 @@
725 726 0
726 727 0
727 728 1
728 729 -2
729 730 +2+
730 731 3
731 732 4
732 733
733 734 changeset: 0:5ae1f82b9a00
734 735 user: test
735 736 date: Thu Jan 01 00:00:00 1970 +0000
736 737 summary: init
737 738
738 739 diff --git a/foo b/foo
739 740 new file mode 100644
740 741 --- /dev/null
741 742 +++ b/foo
742 743 @@ -0,0 +1,5 @@
743 744 +0
744 745 +1
745 746 +2
746 747 +3
747 748 +4
748 749
749 750
750 751 Renames are followed.
751 752
752 753 $ hg mv ../foo baz
753 754 $ sed 's/1/1+/' baz > baz.new
754 755 $ mv baz.new baz
755 756 $ hg ci -m 'foo -> dir/baz; 1-1+'
756 757 $ hg diff -c .
757 758 diff --git a/foo b/dir/baz
758 759 rename from foo
759 760 rename to dir/baz
760 761 --- a/foo
761 762 +++ b/dir/baz
762 763 @@ -2,7 +2,7 @@
763 764 0
764 765 0
765 766 0
766 767 - 1
767 768 + 1+
768 769 2+
769 770 3+
770 771 4
771 772 @@ -11,5 +11,5 @@
772 773 7
773 774 8
774 775 9
775 776 -10
776 777 -11-
777 778 +1+0
778 779 +1+1-
779 780 $ hg log -f -L relpath:baz,5:7 -p
780 781 changeset: 9:6af29c3a778f
781 782 tag: tip
782 783 user: test
783 784 date: Thu Jan 01 00:00:00 1970 +0000
784 785 summary: foo -> dir/baz; 1-1+
785 786
786 787 diff --git a/foo b/dir/baz
787 788 copy from foo
788 789 copy to dir/baz
789 790 --- a/foo
790 791 +++ b/dir/baz
791 792 @@ -2,7 +2,7 @@
792 793 0
793 794 0
794 795 0
795 796 - 1
796 797 + 1+
797 798 2+
798 799 3+
799 800 4
800 801
801 802 changeset: 5:cfdf972b3971
802 803 user: test
803 804 date: Thu Jan 01 00:00:00 1970 +0000
804 805 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
805 806
806 807 diff --git a/foo b/foo
807 808 --- a/foo
808 809 +++ b/foo
809 810 @@ -4,7 +4,7 @@
810 811 0
811 812 1
812 813 2+
813 814 -3
814 815 +3+
815 816 4
816 817 5
817 818 6
818 819
819 820 changeset: 4:eaec41c1a0c9
820 821 user: test
821 822 date: Thu Jan 01 00:00:00 1970 +0000
822 823 summary: 11 -> 11+; leading space before "1"
823 824
824 825 diff --git a/foo b/foo
825 826 --- a/foo
826 827 +++ b/foo
827 828 @@ -2,7 +2,7 @@
828 829 0
829 830 0
830 831 0
831 832 -1
832 833 + 1
833 834 2+
834 835 3
835 836 4
836 837
837 838 changeset: 2:63a884426fd0
838 839 user: test
839 840 date: Thu Jan 01 00:00:00 1970 +0000
840 841 summary: 2 -> 2+; added bar
841 842
842 843 diff --git a/foo b/foo
843 844 --- a/foo
844 845 +++ b/foo
845 846 @@ -3,6 +3,6 @@
846 847 0
847 848 0
848 849 1
849 850 -2
850 851 +2+
851 852 3
852 853 4
853 854
854 855 changeset: 0:5ae1f82b9a00
855 856 user: test
856 857 date: Thu Jan 01 00:00:00 1970 +0000
857 858 summary: init
858 859
859 860 diff --git a/foo b/foo
860 861 new file mode 100644
861 862 --- /dev/null
862 863 +++ b/foo
863 864 @@ -0,0 +1,5 @@
864 865 +0
865 866 +1
866 867 +2
867 868 +3
868 869 +4
869 870
870 871
871 872 Uncommitted changes with a rename
872 873
873 874 $ hg mv baz bazn
874 875 $ hg log -f -L bazn,5:7
875 876 changeset: 9:6af29c3a778f
876 877 tag: tip
877 878 user: test
878 879 date: Thu Jan 01 00:00:00 1970 +0000
879 880 summary: foo -> dir/baz; 1-1+
880 881
881 882 changeset: 5:cfdf972b3971
882 883 user: test
883 884 date: Thu Jan 01 00:00:00 1970 +0000
884 885 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
885 886
886 887 changeset: 4:eaec41c1a0c9
887 888 user: test
888 889 date: Thu Jan 01 00:00:00 1970 +0000
889 890 summary: 11 -> 11+; leading space before "1"
890 891
891 892 changeset: 2:63a884426fd0
892 893 user: test
893 894 date: Thu Jan 01 00:00:00 1970 +0000
894 895 summary: 2 -> 2+; added bar
895 896
896 897 changeset: 0:5ae1f82b9a00
897 898 user: test
898 899 date: Thu Jan 01 00:00:00 1970 +0000
899 900 summary: init
900 901
901 902
902 903 Uncommitted changes in requested line range
903 904
904 905 $ sed 's/2/ /' bazn > bazn.new
905 906 $ mv bazn.new bazn
906 907 $ hg diff
907 908 diff --git a/dir/baz b/dir/bazn
908 909 rename from dir/baz
909 910 rename to dir/bazn
910 911 --- a/dir/baz
911 912 +++ b/dir/bazn
912 913 @@ -3,7 +3,7 @@
913 914 0
914 915 0
915 916 1+
916 917 -2+
917 918 + +
918 919 3+
919 920 4
920 921 5
921 922 $ hg log -f -L bazn,5:7
922 923 changeset: 9:6af29c3a778f
923 924 tag: tip
924 925 user: test
925 926 date: Thu Jan 01 00:00:00 1970 +0000
926 927 summary: foo -> dir/baz; 1-1+
927 928
928 929 changeset: 5:cfdf972b3971
929 930 user: test
930 931 date: Thu Jan 01 00:00:00 1970 +0000
931 932 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
932 933
933 934 changeset: 4:eaec41c1a0c9
934 935 user: test
935 936 date: Thu Jan 01 00:00:00 1970 +0000
936 937 summary: 11 -> 11+; leading space before "1"
937 938
938 939 changeset: 2:63a884426fd0
939 940 user: test
940 941 date: Thu Jan 01 00:00:00 1970 +0000
941 942 summary: 2 -> 2+; added bar
942 943
943 944 changeset: 0:5ae1f82b9a00
944 945 user: test
945 946 date: Thu Jan 01 00:00:00 1970 +0000
946 947 summary: init
947 948
948 949
949 950 Uncommitted changes in line-range + wdir()
950 951
951 952 $ hg log -r 'wdir()' -f -L bazn,5:7 --limit 2 -p
952 953 changeset: 2147483647:ffffffffffff
953 954 parent: 9:6af29c3a778f
954 955 user: test
955 956 date: Thu Jan 01 00:00:00 1970 +0000
956 957
957 958 diff --git a/dir/baz b/dir/bazn
958 959 copy from dir/baz
959 960 copy to dir/bazn
960 961 --- a/dir/baz
961 962 +++ b/dir/bazn
962 963 @@ -3,7 +3,7 @@
963 964 0
964 965 0
965 966 1+
966 967 -2+
967 968 + +
968 969 3+
969 970 4
970 971 5
971 972
972 973 changeset: 9:6af29c3a778f
973 974 tag: tip
974 975 user: test
975 976 date: Thu Jan 01 00:00:00 1970 +0000
976 977 summary: foo -> dir/baz; 1-1+
977 978
978 979 diff --git a/foo b/dir/baz
979 980 copy from foo
980 981 copy to dir/baz
981 982 --- a/foo
982 983 +++ b/dir/baz
983 984 @@ -2,7 +2,7 @@
984 985 0
985 986 0
986 987 0
987 988 - 1
988 989 + 1+
989 990 2+
990 991 3+
991 992 4
992 993
993 994
994 995 $ hg revert -a -C -q
995 996
996 997 Copies.
997 998
998 999 $ hg copy baz bbaz
999 1000 $ sed 's/6/6+/' bbaz > bbaz.new
1000 1001 $ mv bbaz.new bbaz
1001 1002 $ hg commit -m 'cp baz bbaz; 6-6+'
1002 1003 $ hg diff -c .
1003 1004 diff --git a/dir/baz b/dir/bbaz
1004 1005 copy from dir/baz
1005 1006 copy to dir/bbaz
1006 1007 --- a/dir/baz
1007 1008 +++ b/dir/bbaz
1008 1009 @@ -7,7 +7,7 @@
1009 1010 3+
1010 1011 4
1011 1012 5
1012 1013 -6
1013 1014 +6+
1014 1015 7
1015 1016 8
1016 1017 9
1017 1018 $ hg log --copies -f -L bbaz,10:11 -p
1018 1019 changeset: 10:91a3d3b6c546
1019 1020 tag: tip
1020 1021 user: test
1021 1022 date: Thu Jan 01 00:00:00 1970 +0000
1022 1023 summary: cp baz bbaz; 6-6+
1023 1024
1024 1025 diff --git a/dir/baz b/dir/bbaz
1025 1026 copy from dir/baz
1026 1027 copy to dir/bbaz
1027 1028 --- a/dir/baz
1028 1029 +++ b/dir/bbaz
1029 1030 @@ -7,7 +7,7 @@
1030 1031 3+
1031 1032 4
1032 1033 5
1033 1034 -6
1034 1035 +6+
1035 1036 7
1036 1037 8
1037 1038 9
1038 1039
1039 1040 changeset: 3:730a61fbaecf
1040 1041 user: test
1041 1042 date: Thu Jan 01 00:00:00 1970 +0000
1042 1043 summary: to 11
1043 1044
1044 1045 diff --git a/foo b/foo
1045 1046 --- a/foo
1046 1047 +++ b/foo
1047 1048 @@ -6,3 +6,10 @@
1048 1049 2+
1049 1050 3
1050 1051 4
1051 1052 +5
1052 1053 +6
1053 1054 +7
1054 1055 +8
1055 1056 +9
1056 1057 +10
1057 1058 +11
1058 1059
1059 1060 $ hg log -f -L bbaz,10:11 -p
1060 1061 changeset: 10:91a3d3b6c546
1061 1062 tag: tip
1062 1063 user: test
1063 1064 date: Thu Jan 01 00:00:00 1970 +0000
1064 1065 summary: cp baz bbaz; 6-6+
1065 1066
1066 1067 diff --git a/dir/baz b/dir/bbaz
1067 1068 copy from dir/baz
1068 1069 copy to dir/bbaz
1069 1070 --- a/dir/baz
1070 1071 +++ b/dir/bbaz
1071 1072 @@ -7,7 +7,7 @@
1072 1073 3+
1073 1074 4
1074 1075 5
1075 1076 -6
1076 1077 +6+
1077 1078 7
1078 1079 8
1079 1080 9
1080 1081
1081 1082 changeset: 3:730a61fbaecf
1082 1083 user: test
1083 1084 date: Thu Jan 01 00:00:00 1970 +0000
1084 1085 summary: to 11
1085 1086
1086 1087 diff --git a/foo b/foo
1087 1088 --- a/foo
1088 1089 +++ b/foo
1089 1090 @@ -6,3 +6,10 @@
1090 1091 2+
1091 1092 3
1092 1093 4
1093 1094 +5
1094 1095 +6
1095 1096 +7
1096 1097 +8
1097 1098 +9
1098 1099 +10
1099 1100 +11
1100 1101
1101 1102
1102 1103 Binary files work but without diff hunks filtering.
1103 1104 (Checking w/ and w/o diff.git option.)
1104 1105
1105 1106 >>> open('binary', 'wb').write(b'this\nis\na\nbinary\0') and None
1106 1107 $ hg add binary
1107 1108 $ hg ci -m 'add a binary file' --quiet
1108 1109 $ hg log -f -L binary,1:2 -p
1109 1110 changeset: 11:dc865b608edf
1110 1111 tag: tip
1111 1112 user: test
1112 1113 date: Thu Jan 01 00:00:00 1970 +0000
1113 1114 summary: add a binary file
1114 1115
1115 1116 diff --git a/dir/binary b/dir/binary
1116 1117 new file mode 100644
1117 1118 index 0000000000000000000000000000000000000000..c2e1fbed209fe919b3f189a6a31950e9adf61e45
1118 1119 GIT binary patch
1119 1120 literal 17
1120 1121 Wc$_QA$SmdpqC~Ew%)G>+N(KNlNClYy
1121 1122
1122 1123
1123 1124 $ hg log -f -L binary,1:2 -p --config diff.git=false
1124 1125 changeset: 11:dc865b608edf
1125 1126 tag: tip
1126 1127 user: test
1127 1128 date: Thu Jan 01 00:00:00 1970 +0000
1128 1129 summary: add a binary file
1129 1130
1130 1131 diff -r 91a3d3b6c546 -r dc865b608edf dir/binary
1131 1132 Binary file dir/binary has changed
1132 1133
1133 1134
1134 1135 Option --follow is required.
1135 1136
1136 1137 $ hg log -L foo,5:7
1137 1138 abort: --line-range requires --follow
1138 1139 [10]
1139 1140
1140 1141 Non-exact pattern kinds are not allowed.
1141 1142
1142 1143 $ cd ..
1143 1144 $ hg log -f -L glob:*a*,1:2
1144 1145 hg: parse error: line range pattern 'glob:*a*' must match exactly one file
1145 1146 [10]
1146 1147
1147 1148 We get an error for removed files.
1148 1149
1149 1150 $ hg rm dir/baz
1150 1151 $ hg ci -m 'remove baz' --quiet
1151 1152 $ hg log -f -L dir/baz,5:7 -p
1152 1153 abort: cannot follow file not in parent revision: "dir/baz"
1153 1154 [20]
@@ -1,190 +1,191 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3 $ echo a > a
3 4 $ hg commit -A -ma
4 5 adding a
5 6
6 7 $ echo b >> a
7 8 $ hg commit -mb
8 9
9 10 $ echo c >> a
10 11 $ hg commit -mc
11 12
12 13 $ hg up 1
13 14 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
14 15 $ echo d >> a
15 16 $ hg commit -md
16 17 created new head
17 18
18 19 $ hg up 1
19 20 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
20 21 $ echo e >> a
21 22 $ hg commit -me
22 23 created new head
23 24
24 25 $ hg up 1
25 26 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
26 27
27 28 Should fail because not at a head:
28 29
29 30 $ hg merge
30 31 abort: working directory not at a head revision
31 32 (use 'hg update' or merge with an explicit revision)
32 33 [255]
33 34
34 35 $ hg up
35 36 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36 37 updated to "f25cbe84d8b3: e"
37 38 2 other heads for branch "default"
38 39
39 40 Should fail because > 2 heads:
40 41
41 42 $ HGMERGE=internal:other; export HGMERGE
42 43 $ hg merge
43 44 abort: branch 'default' has 3 heads - please merge with an explicit rev
44 45 (run 'hg heads .' to see heads, specify rev with -r)
45 46 [255]
46 47
47 48 Should succeed (we're specifying commands.merge.require-rev=True just to test
48 49 that it allows merge to succeed if we specify a revision):
49 50
50 51 $ hg merge 2 --config commands.merge.require-rev=True
51 52 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
52 53 (branch merge, don't forget to commit)
53 54 $ hg id -Tjson
54 55 [
55 56 {
56 57 "bookmarks": [],
57 58 "branch": "default",
58 59 "dirty": "+",
59 60 "id": "f25cbe84d8b320e298e7703f18a25a3959518c23+2d95304fed5d89bc9d70b2a0d02f0d567469c3ab+",
60 61 "node": "ffffffffffffffffffffffffffffffffffffffff",
61 62 "parents": ["f25cbe84d8b320e298e7703f18a25a3959518c23", "2d95304fed5d89bc9d70b2a0d02f0d567469c3ab"],
62 63 "tags": ["tip"]
63 64 }
64 65 ]
65 66 $ hg commit -mm1
66 67
67 68 Should fail because we didn't specify a revision (even though it would have
68 69 succeeded without this):
69 70
70 71 $ hg merge --config commands.merge.require-rev=True
71 72 abort: configuration requires specifying revision to merge with
72 73 [10]
73 74
74 75 Should succeed - 2 heads:
75 76
76 77 $ hg merge -P
77 78 changeset: 3:ea9ff125ff88
78 79 parent: 1:1846eede8b68
79 80 user: test
80 81 date: Thu Jan 01 00:00:00 1970 +0000
81 82 summary: d
82 83
83 84 $ hg merge
84 85 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
85 86 (branch merge, don't forget to commit)
86 87 $ hg commit -mm2
87 88
88 89 $ hg id -r 1 -Tjson
89 90 [
90 91 {
91 92 "bookmarks": [],
92 93 "branch": "default",
93 94 "id": "1846eede8b6886d8cc8a88c96a687b7fe8f3b9d1",
94 95 "node": "1846eede8b6886d8cc8a88c96a687b7fe8f3b9d1",
95 96 "tags": []
96 97 }
97 98 ]
98 99
99 100 Should fail because we didn't specify a revision (even though it would have
100 101 failed without this due to being on tip, but this check comes first):
101 102
102 103 $ hg merge --config commands.merge.require-rev=True
103 104 abort: configuration requires specifying revision to merge with
104 105 [10]
105 106
106 107 Should fail because at tip:
107 108
108 109 $ hg merge
109 110 abort: nothing to merge
110 111 [255]
111 112
112 113 $ hg up 0
113 114 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
114 115
115 116 Should fail because there is only one head:
116 117
117 118 $ hg merge
118 119 abort: nothing to merge
119 120 (use 'hg update' instead)
120 121 [255]
121 122
122 123 $ hg up 3
123 124 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
124 125
125 126 $ echo f >> a
126 127 $ hg branch foobranch
127 128 marked working directory as branch foobranch
128 129 (branches are permanent and global, did you want a bookmark?)
129 130 $ hg commit -mf
130 131
131 132 Should fail because merge with other branch:
132 133
133 134 $ hg merge
134 135 abort: branch 'foobranch' has one head - please merge with an explicit rev
135 136 (run 'hg heads' to see all heads, specify rev with -r)
136 137 [255]
137 138
138 139
139 140 Test for issue2043: ensure that 'merge -P' shows ancestors of 6 that
140 141 are not ancestors of 7, regardless of where their common ancestors are.
141 142
142 143 Merge preview not affected by common ancestor:
143 144
144 145 $ hg up -q 7
145 146 $ hg merge -q -P 6
146 147 2:2d95304fed5d
147 148 4:f25cbe84d8b3
148 149 5:a431fabd6039
149 150 6:e88e33f3bf62
150 151
151 152 Test experimental destination revset
152 153
153 154 $ hg log -r '_destmerge()'
154 155 abort: branch 'foobranch' has one head - please merge with an explicit rev
155 156 (run 'hg heads' to see all heads, specify rev with -r)
156 157 [255]
157 158
158 159 (on a branch with a two heads)
159 160
160 161 $ hg up 5
161 162 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
162 163 $ echo f >> a
163 164 $ hg commit -mf
164 165 created new head
165 166 $ hg log -r '_destmerge()'
166 167 changeset: 6:e88e33f3bf62
167 168 parent: 5:a431fabd6039
168 169 parent: 3:ea9ff125ff88
169 170 user: test
170 171 date: Thu Jan 01 00:00:00 1970 +0000
171 172 summary: m2
172 173
173 174
174 175 (from the other head)
175 176
176 177 $ hg log -r '_destmerge(e88e33f3bf62)'
177 178 changeset: 8:b613918999e2
178 179 tag: tip
179 180 parent: 5:a431fabd6039
180 181 user: test
181 182 date: Thu Jan 01 00:00:00 1970 +0000
182 183 summary: f
183 184
184 185
185 186 (from unrelated branch)
186 187
187 188 $ hg log -r '_destmerge(foobranch)'
188 189 abort: branch 'foobranch' has one head - please merge with an explicit rev
189 190 (run 'hg heads' to see all heads, specify rev with -r)
190 191 [255]
@@ -1,141 +1,142 b''
1 1 Make sure that the internal merge tools (internal:fail, internal:local,
2 2 internal:union and internal:other) are used when matched by a
3 3 merge-pattern in hgrc
4 4
5 5 Make sure HGMERGE doesn't interfere with the test:
6 6
7 7 $ unset HGMERGE
8 8
9 $ hg init
9 $ hg init repo
10 $ cd repo
10 11
11 12 Initial file contents:
12 13
13 14 $ echo "line 1" > f
14 15 $ echo "line 2" >> f
15 16 $ echo "line 3" >> f
16 17 $ hg ci -Am "revision 0"
17 18 adding f
18 19
19 20 $ cat f
20 21 line 1
21 22 line 2
22 23 line 3
23 24
24 25 Branch 1: editing line 1:
25 26
26 27 $ sed 's/line 1/first line/' f > f.new
27 28 $ mv f.new f
28 29 $ hg ci -Am "edited first line"
29 30
30 31 Branch 2: editing line 3:
31 32
32 33 $ hg update 0
33 34 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 35 $ sed 's/line 3/third line/' f > f.new
35 36 $ mv f.new f
36 37 $ hg ci -Am "edited third line"
37 38 created new head
38 39
39 40 Merge using internal:fail tool:
40 41
41 42 $ echo "[merge-patterns]" > .hg/hgrc
42 43 $ echo "* = internal:fail" >> .hg/hgrc
43 44
44 45 $ hg merge
45 46 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
46 47 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
47 48 [1]
48 49
49 50 $ cat f
50 51 line 1
51 52 line 2
52 53 third line
53 54
54 55 $ hg stat
55 56 M f
56 57
57 58 Merge using internal:local tool:
58 59
59 60 $ hg update -C 2
60 61 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
61 62 $ sed 's/internal:fail/internal:local/' .hg/hgrc > .hg/hgrc.new
62 63 $ mv .hg/hgrc.new .hg/hgrc
63 64
64 65 $ hg merge
65 66 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
66 67 (branch merge, don't forget to commit)
67 68
68 69 $ cat f
69 70 line 1
70 71 line 2
71 72 third line
72 73
73 74 $ hg stat
74 75 M f
75 76
76 77 Merge using internal:other tool:
77 78
78 79 $ hg update -C 2
79 80 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
80 81 $ sed 's/internal:local/internal:other/' .hg/hgrc > .hg/hgrc.new
81 82 $ mv .hg/hgrc.new .hg/hgrc
82 83
83 84 $ hg merge
84 85 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
85 86 (branch merge, don't forget to commit)
86 87
87 88 $ cat f
88 89 first line
89 90 line 2
90 91 line 3
91 92
92 93 $ hg stat
93 94 M f
94 95
95 96 Merge using default tool:
96 97
97 98 $ hg update -C 2
98 99 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
99 100 $ rm .hg/hgrc
100 101
101 102 $ hg merge
102 103 merging f
103 104 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
104 105 (branch merge, don't forget to commit)
105 106
106 107 $ cat f
107 108 first line
108 109 line 2
109 110 third line
110 111
111 112 $ hg stat
112 113 M f
113 114
114 115 Merge using internal:union tool:
115 116
116 117 $ hg update -C 2
117 118 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
118 119
119 120 $ echo "line 4a" >>f
120 121 $ hg ci -Am "Adding fourth line (commit 4)"
121 122 $ hg update 2
122 123 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
123 124
124 125 $ echo "line 4b" >>f
125 126 $ hg ci -Am "Adding fourth line v2 (commit 5)"
126 127 created new head
127 128
128 129 $ echo "[merge-patterns]" > .hg/hgrc
129 130 $ echo "* = internal:union" >> .hg/hgrc
130 131
131 132 $ hg merge 3
132 133 merging f
133 134 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
134 135 (branch merge, don't forget to commit)
135 136
136 137 $ cat f
137 138 line 1
138 139 line 2
139 140 third line
140 141 line 4b
141 142 line 4a
@@ -1,151 +1,152 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3
3 4 Revision 0:
4 5
5 6 $ echo "unchanged" > unchanged
6 7 $ echo "remove me" > remove
7 8 $ echo "copy me" > copy
8 9 $ echo "move me" > move
9 10 $ for i in 1 2 3 4 5 6 7 8 9; do
10 11 > echo "merge ok $i" >> zzz1_merge_ok
11 12 > done
12 13 $ echo "merge bad" > zzz2_merge_bad
13 14 $ hg ci -Am "revision 0"
14 15 adding copy
15 16 adding move
16 17 adding remove
17 18 adding unchanged
18 19 adding zzz1_merge_ok
19 20 adding zzz2_merge_bad
20 21
21 22 Revision 1:
22 23
23 24 $ hg rm remove
24 25 $ hg mv move moved
25 26 $ hg cp copy copied
26 27 $ echo "added" > added
27 28 $ hg add added
28 29 $ echo "new first line" > zzz1_merge_ok
29 30 $ hg cat zzz1_merge_ok >> zzz1_merge_ok
30 31 $ echo "new last line" >> zzz2_merge_bad
31 32 $ hg ci -m "revision 1"
32 33
33 34 Local changes to revision 0:
34 35
35 36 $ hg co 0
36 37 4 files updated, 0 files merged, 3 files removed, 0 files unresolved
37 38 $ echo "new last line" >> zzz1_merge_ok
38 39 $ echo "another last line" >> zzz2_merge_bad
39 40
40 41 $ hg diff --nodates | grep "^[+-][^<>]"
41 42 --- a/zzz1_merge_ok
42 43 +++ b/zzz1_merge_ok
43 44 +new last line
44 45 --- a/zzz2_merge_bad
45 46 +++ b/zzz2_merge_bad
46 47 +another last line
47 48
48 49 $ hg st
49 50 M zzz1_merge_ok
50 51 M zzz2_merge_bad
51 52
52 53 Local merge with bad merge tool:
53 54
54 55 $ HGMERGE=false hg co
55 56 merging zzz1_merge_ok
56 57 merging zzz2_merge_bad
57 58 merging zzz2_merge_bad failed!
58 59 3 files updated, 1 files merged, 2 files removed, 1 files unresolved
59 60 use 'hg resolve' to retry unresolved file merges
60 61 [1]
61 62
62 63 $ hg resolve -m
63 64 (no more unresolved files)
64 65
65 66 $ hg co 0
66 67 merging zzz1_merge_ok
67 68 merging zzz2_merge_bad
68 69 warning: conflicts while merging zzz2_merge_bad! (edit, then use 'hg resolve --mark')
69 70 2 files updated, 1 files merged, 3 files removed, 1 files unresolved
70 71 use 'hg resolve' to retry unresolved file merges
71 72 [1]
72 73
73 74 $ hg diff --nodates | grep "^[+-][^<>]"
74 75 --- a/zzz1_merge_ok
75 76 +++ b/zzz1_merge_ok
76 77 +new last line
77 78 --- a/zzz2_merge_bad
78 79 +++ b/zzz2_merge_bad
79 80 +another last line
80 81 +=======
81 82
82 83 $ hg st
83 84 M zzz1_merge_ok
84 85 M zzz2_merge_bad
85 86 ? zzz2_merge_bad.orig
86 87
87 88 Local merge with conflicts:
88 89
89 90 $ hg resolve -m
90 91 (no more unresolved files)
91 92
92 93 $ hg co
93 94 merging zzz1_merge_ok
94 95 merging zzz2_merge_bad
95 96 warning: conflicts while merging zzz2_merge_bad! (edit, then use 'hg resolve --mark')
96 97 3 files updated, 1 files merged, 2 files removed, 1 files unresolved
97 98 use 'hg resolve' to retry unresolved file merges
98 99 [1]
99 100
100 101 $ hg resolve -m
101 102 (no more unresolved files)
102 103
103 104 $ hg co 0 --config 'ui.origbackuppath=.hg/origbackups'
104 105 merging zzz1_merge_ok
105 106 merging zzz2_merge_bad
106 107 warning: conflicts while merging zzz2_merge_bad! (edit, then use 'hg resolve --mark')
107 108 2 files updated, 1 files merged, 3 files removed, 1 files unresolved
108 109 use 'hg resolve' to retry unresolved file merges
109 110 [1]
110 111
111 112 Are orig files from the last commit where we want them?
112 113 $ ls .hg/origbackups
113 114 zzz2_merge_bad
114 115
115 116 $ hg diff --nodates | grep "^[+-][^<>]"
116 117 --- a/zzz1_merge_ok
117 118 +++ b/zzz1_merge_ok
118 119 +new last line
119 120 --- a/zzz2_merge_bad
120 121 +++ b/zzz2_merge_bad
121 122 +another last line
122 123 +=======
123 124 +=======
124 125 +new last line
125 126 +=======
126 127
127 128 $ hg st
128 129 M zzz1_merge_ok
129 130 M zzz2_merge_bad
130 131 ? zzz2_merge_bad.orig
131 132
132 133 Local merge without conflicts:
133 134
134 135 $ hg revert zzz2_merge_bad
135 136
136 137 $ hg resolve -m
137 138 (no more unresolved files)
138 139
139 140 $ hg co
140 141 merging zzz1_merge_ok
141 142 4 files updated, 1 files merged, 2 files removed, 0 files unresolved
142 143
143 144 $ hg diff --nodates | grep "^[+-][^<>]"
144 145 --- a/zzz1_merge_ok
145 146 +++ b/zzz1_merge_ok
146 147 +new last line
147 148
148 149 $ hg st
149 150 M zzz1_merge_ok
150 151 ? zzz2_merge_bad.orig
151 152
@@ -1,116 +1,117 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3
3 4 $ echo foo > foo
4 5 $ echo bar > bar
5 6 $ hg ci -qAm 'add foo bar'
6 7
7 8 $ echo foo2 >> foo
8 9 $ echo bleh > bar
9 10 $ hg ci -m 'change foo bar'
10 11
11 12 $ hg up -qC 0
12 13 $ hg mv foo foo1
13 14 $ echo foo1 > foo1
14 15 $ hg cat foo >> foo1
15 16 $ hg ci -m 'mv foo foo1'
16 17 created new head
17 18
18 19 $ hg merge
19 20 merging foo1 and foo to foo1
20 21 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
21 22 (branch merge, don't forget to commit)
22 23
23 24 $ hg debugstate --no-dates
24 25 m 0 -2 unset bar
25 26 m 0 -2 unset foo1
26 27 copy: foo -> foo1
27 28
28 29 $ hg st -q
29 30 M bar
30 31 M foo1
31 32
32 33
33 34 Removing foo1 and bar:
34 35
35 36 $ cp foo1 F
36 37 $ cp bar B
37 38 $ hg rm -f foo1 bar
38 39
39 40 $ hg debugstate --no-dates
40 41 r 0 -1 set bar
41 42 r 0 -1 set foo1
42 43 copy: foo -> foo1
43 44
44 45 $ hg st -qC
45 46 R bar
46 47 R foo1
47 48
48 49
49 50 Re-adding foo1 and bar:
50 51
51 52 $ cp F foo1
52 53 $ cp B bar
53 54 $ hg add -v foo1 bar
54 55 adding bar
55 56 adding foo1
56 57
57 58 $ hg debugstate --no-dates
58 59 m 0 -2 unset bar
59 60 m 0 -2 unset foo1
60 61 copy: foo -> foo1
61 62
62 63 $ hg st -qC
63 64 M bar
64 65 M foo1
65 66 foo
66 67
67 68
68 69 Reverting foo1 and bar:
69 70
70 71 $ hg revert -vr . foo1 bar
71 72 saving current version of bar as bar.orig
72 73 saving current version of foo1 as foo1.orig
73 74 reverting bar
74 75 reverting foo1
75 76
76 77 $ hg debugstate --no-dates
77 78 m 0 -2 unset bar
78 79 m 0 -2 unset foo1
79 80 copy: foo -> foo1
80 81
81 82 $ hg st -qC
82 83 M bar
83 84 M foo1
84 85 foo
85 86
86 87 $ hg diff
87 88
88 89 Merge should not overwrite local file that is untracked after remove
89 90
90 91 $ rm *
91 92 $ hg up -qC
92 93 $ hg rm bar
93 94 $ hg ci -m 'remove bar'
94 95 $ echo 'memories of buried pirate treasure' > bar
95 96 $ hg merge
96 97 bar: untracked file differs
97 98 abort: untracked files in working directory differ from files in requested revision
98 99 [20]
99 100 $ cat bar
100 101 memories of buried pirate treasure
101 102
102 103 Those who use force will lose
103 104
104 105 $ hg merge -f
105 106 file 'bar' was deleted in local [working copy] but was modified in other [merge rev].
106 107 You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
107 108 What do you want to do? u
108 109 merging foo1 and foo to foo1
109 110 0 files updated, 1 files merged, 0 files removed, 1 files unresolved
110 111 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
111 112 [1]
112 113 $ cat bar
113 114 bleh
114 115 $ hg st
115 116 M bar
116 117 M foo1
@@ -1,74 +1,75 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3
3 4 $ echo "added file1" > file1
4 5 $ echo "added file2" > file2
5 6 $ hg add file1 file2
6 7 $ hg commit -m "added file1 and file2"
7 8
8 9 $ echo "changed file1" >> file1
9 10 $ hg commit -m "changed file1"
10 11
11 12 $ hg -q log
12 13 1:08a16e8e4408
13 14 0:d29c767a4b52
14 15 $ hg id
15 16 08a16e8e4408 tip
16 17
17 18 $ hg update -C 0
18 19 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
19 20 $ hg id
20 21 d29c767a4b52
21 22 $ echo "changed file1" >> file1
22 23 $ hg id
23 24 d29c767a4b52+
24 25
25 26 $ hg revert --all
26 27 reverting file1
27 28 $ hg diff
28 29 $ hg status
29 30 ? file1.orig
30 31 $ hg id
31 32 d29c767a4b52
32 33
33 34 $ hg update
34 35 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
35 36 $ hg diff
36 37 $ hg status
37 38 ? file1.orig
38 39 $ hg id
39 40 08a16e8e4408 tip
40 41
41 42 $ hg update -C 0
42 43 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 44 $ echo "changed file1" >> file1
44 45
45 46 $ hg update
46 47 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
47 48 $ hg diff
48 49 $ hg status
49 50 ? file1.orig
50 51 $ hg id
51 52 08a16e8e4408 tip
52 53
53 54 $ hg revert --all
54 55 $ hg diff
55 56 $ hg status
56 57 ? file1.orig
57 58 $ hg id
58 59 08a16e8e4408 tip
59 60
60 61 $ hg revert -r tip --all
61 62 $ hg diff
62 63 $ hg status
63 64 ? file1.orig
64 65 $ hg id
65 66 08a16e8e4408 tip
66 67
67 68 $ hg update -C
68 69 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
69 70 $ hg diff
70 71 $ hg status
71 72 ? file1.orig
72 73 $ hg id
73 74 08a16e8e4408 tip
74 75
@@ -1,93 +1,94 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3
3 4 $ echo "added file1" > file1
4 5 $ echo "another line of text" >> file1
5 6 $ echo "added file2" > file2
6 7 $ hg add file1 file2
7 8 $ hg commit -m "added file1 and file2"
8 9
9 10 $ echo "changed file1" >> file1
10 11 $ hg commit -m "changed file1"
11 12
12 13 $ hg -q log
13 14 1:dfab7f3c2efb
14 15 0:c3fa057dd86f
15 16 $ hg id
16 17 dfab7f3c2efb tip
17 18
18 19 $ hg update -C 0
19 20 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
20 21 $ hg id
21 22 c3fa057dd86f
22 23
23 24 $ echo "changed file1" >> file1
24 25 $ hg id
25 26 c3fa057dd86f+
26 27
27 28 $ hg revert --no-backup --all
28 29 reverting file1
29 30 $ hg diff
30 31 $ hg status
31 32 $ hg id
32 33 c3fa057dd86f
33 34
34 35 $ hg update
35 36 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36 37 $ hg diff
37 38 $ hg status
38 39 $ hg id
39 40 dfab7f3c2efb tip
40 41
41 42 $ hg update -C 0
42 43 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 44 $ echo "changed file1 different" >> file1
44 45
45 46 $ hg update
46 47 merging file1
47 48 warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
48 49 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
49 50 use 'hg resolve' to retry unresolved file merges
50 51 [1]
51 52
52 53 $ hg diff --nodates
53 54 diff -r dfab7f3c2efb file1
54 55 --- a/file1
55 56 +++ b/file1
56 57 @@ -1,3 +1,7 @@
57 58 added file1
58 59 another line of text
59 60 +<<<<<<< working copy: c3fa057dd86f - test: added file1 and file2
60 61 +changed file1 different
61 62 +=======
62 63 changed file1
63 64 +>>>>>>> destination: dfab7f3c2efb - test: changed file1
64 65
65 66 $ hg status
66 67 M file1
67 68 ? file1.orig
68 69 $ hg id
69 70 dfab7f3c2efb+ tip
70 71
71 72 $ hg revert --no-backup --all
72 73 reverting file1
73 74 $ hg diff
74 75 $ hg status
75 76 ? file1.orig
76 77 $ hg id
77 78 dfab7f3c2efb tip
78 79
79 80 $ hg revert -r tip --no-backup --all
80 81 $ hg diff
81 82 $ hg status
82 83 ? file1.orig
83 84 $ hg id
84 85 dfab7f3c2efb tip
85 86
86 87 $ hg update -C
87 88 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
88 89 $ hg diff
89 90 $ hg status
90 91 ? file1.orig
91 92 $ hg id
92 93 dfab7f3c2efb tip
93 94
@@ -1,148 +1,149 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3
3 4 $ echo a > a
4 5 $ hg ci -qAm 'add a'
5 6
6 7 $ hg init subrepo
7 8 $ echo 'subrepo = http://example.net/libfoo' > .hgsub
8 9 $ hg ci -qAm 'added subrepo'
9 10
10 11 $ hg up -qC 0
11 12 $ echo ax > a
12 13 $ hg ci -m 'changed a'
13 14 created new head
14 15
15 16 $ hg up -qC 1
16 17 $ cd subrepo
17 18 $ echo b > b
18 19 $ hg add b
19 20 $ cd ..
20 21
21 22 Should fail, since there are added files to subrepo:
22 23
23 24 $ hg merge
24 25 abort: uncommitted changes in subrepository "subrepo"
25 26 [255]
26 27
27 28 Deleted files trigger a '+' marker in top level repos. Deleted files are also
28 29 noticed by `update --check` in the top level repo.
29 30
30 31 $ hg ci -Sqm 'add b'
31 32 $ echo change > subrepo/b
32 33
33 34 $ hg ci -Sm 'change b'
34 35 committing subrepository subrepo
35 36
36 37 $ rm a
37 38 $ hg id
38 39 9bfe45a197d7+ tip
39 40 $ hg sum
40 41 parent: 4:9bfe45a197d7 tip
41 42 change b
42 43 branch: default
43 44 commit: 1 deleted (clean)
44 45 update: 1 new changesets, 2 branch heads (merge)
45 46 phases: 5 draft
46 47
47 48 $ hg up --check -r '.^'
48 49 abort: uncommitted changes
49 50 [20]
50 51 $ hg st -S
51 52 ! a
52 53 $ hg up -Cq .
53 54
54 55 Test that dirty is consistent through subrepos
55 56
56 57 $ rm subrepo/b
57 58
58 59 A deleted subrepo file is flagged as dirty, like the top level repo
59 60
60 61 $ hg id --config extensions.blackbox= --config blackbox.dirty=True \
61 62 > --config blackbox.track='command commandfinish'
62 63 9bfe45a197d7+ tip
63 64 $ cat .hg/blackbox.log
64 65 * @9bfe45a197d7b0ab09bf287729dd57e9619c9da5+ (*)> serve --no-profile --cmdserver chgunix * (glob) (chg !)
65 66 * @9bfe45a197d7b0ab09bf287729dd57e9619c9da5+ (*)> id --config *extensions.blackbox=* --config *blackbox.dirty=True* (glob)
66 67 * @9bfe45a197d7b0ab09bf287729dd57e9619c9da5+ (*)> id --config *extensions.blackbox=* --config *blackbox.dirty=True* exited 0 * (glob)
67 68
68 69 TODO: a deleted file should be listed as such, like the top level repo
69 70
70 71 $ hg sum
71 72 parent: 4:9bfe45a197d7 tip
72 73 change b
73 74 branch: default
74 75 commit: (clean)
75 76 update: 1 new changesets, 2 branch heads (merge)
76 77 phases: 5 draft
77 78
78 79 Modified subrepo files are noticed by `update --check` and `summary`
79 80
80 81 $ echo mod > subrepo/b
81 82 $ hg st -S
82 83 M subrepo/b
83 84
84 85 $ hg up -r '.^' --check
85 86 abort: uncommitted changes in subrepository "subrepo"
86 87 [255]
87 88
88 89 $ hg sum
89 90 parent: 4:9bfe45a197d7 tip
90 91 change b
91 92 branch: default
92 93 commit: 1 subrepos
93 94 update: 1 new changesets, 2 branch heads (merge)
94 95 phases: 5 draft
95 96
96 97 TODO: why is -R needed here? If it's because the subrepo is treated as a
97 98 discrete unit, then this should probably warn or something.
98 99 $ hg revert -R subrepo --no-backup subrepo/b -r .
99 100
100 101 $ rm subrepo/b
101 102 $ hg st -S
102 103 ! subrepo/b
103 104
104 105 `hg update --check` notices a subrepo with a missing file, like it notices a
105 106 missing file in the top level repo.
106 107
107 108 $ hg up -r '.^' --check
108 109 abort: uncommitted changes in subrepository "subrepo"
109 110 [255]
110 111
111 112 $ hg up -r '.^' --config ui.interactive=True << EOF
112 113 > d
113 114 > EOF
114 115 file 'b' was deleted in local [working copy] but was modified in other [destination].
115 116 You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
116 117 What do you want to do? d
117 118 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
118 119
119 120 XXX: There's a difference between wdir() and '.', so there should be a status.
120 121 `hg files -S` from the top is also missing 'subrepo/b'. The files should be
121 122 seen as deleted (and, maybe even missing? in which case `hg files` should list
122 123 it)
123 124
124 125 $ hg st -S
125 126 R subrepo/b (missing-correct-output !)
126 127 $ hg st -R subrepo
127 128 R subrepo/b (missing-correct-output !)
128 129
129 130 (note: return [1] because no files "match" since the list is empty)
130 131
131 132 $ hg files -R subrepo
132 133 [1]
133 134 $ hg files -R subrepo -r '.'
134 135 subrepo/b
135 136
136 137 $ hg bookmark -r tip @other
137 138 $ echo xyz > subrepo/c
138 139 $ hg ci -SAm 'add c'
139 140 adding subrepo/c
140 141 committing subrepository subrepo
141 142 created new head
142 143 $ rm subrepo/c
143 144
144 145 Merge sees deleted subrepo files as an uncommitted change
145 146
146 147 $ hg merge @other
147 148 abort: uncommitted changes in subrepository "subrepo"
148 149 [255]
@@ -1,59 +1,60 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3 $ echo This is file a1 > a
3 4 $ hg add a
4 5 $ hg commit -m "commit #0"
5 6 $ echo This is file b1 > b
6 7 $ hg add b
7 8 $ hg commit -m "commit #1"
8 9 $ hg update 0
9 10 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
10 11 $ echo This is file c1 > c
11 12 $ hg add c
12 13 $ hg commit -m "commit #2"
13 14 created new head
14 15 $ hg merge 1
15 16 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
16 17 (branch merge, don't forget to commit)
17 18 $ rm b
18 19 $ echo This is file c22 > c
19 20
20 21 Test hg behaves when committing with a missing file added by a merge
21 22
22 23 $ hg commit -m "commit #3"
23 24 abort: cannot commit merge with missing files
24 25 [255]
25 26
26 27
27 28 Test conflict*() revsets
28 29
29 30 # Bad usage
30 31 $ hg log -r 'conflictlocal(foo)'
31 32 hg: parse error: conflictlocal takes no arguments
32 33 [10]
33 34 $ hg log -r 'conflictother(foo)'
34 35 hg: parse error: conflictother takes no arguments
35 36 [10]
36 37 $ hg co -C .
37 38 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
38 39 # No merge parents when not merging
39 40 $ hg log -r 'conflictlocal() + conflictother()'
40 41 # No merge parents when there is no conflict
41 42 $ hg merge 1
42 43 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 44 (branch merge, don't forget to commit)
44 45 $ hg log -r 'conflictlocal() + conflictother()'
45 46 $ hg co -C .
46 47 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
47 48 $ echo conflict > b
48 49 $ hg ci -Aqm 'conflicting change to b'
49 50 $ hg merge 1
50 51 merging b
51 52 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
52 53 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
53 54 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
54 55 [1]
55 56 # Shows merge parents when there is a conflict
56 57 $ hg log -r 'conflictlocal()' -T '{rev} {desc}\n'
57 58 3 conflicting change to b
58 59 $ hg log -r 'conflictother()' -T '{rev} {desc}\n'
59 60 1 commit #1
@@ -1,36 +1,37 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3 $ echo This is file a1 > a
3 4 $ echo This is file b1 > b
4 5 $ hg add a b
5 6 $ hg commit -m "commit #0"
6 7 $ echo This is file b22 > b
7 8 $ hg commit -m "comment #1"
8 9 $ hg update 0
9 10 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
10 11 $ rm b
11 12 $ hg commit -A -m "comment #2"
12 13 removing b
13 14 created new head
14 15 $ hg update 1
15 16 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
16 17 $ rm b
17 18 $ hg update -c 2
18 19 abort: uncommitted changes
19 20 [20]
20 21 $ hg revert b
21 22 $ hg update -c 2
22 23 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
23 24 $ mv a c
24 25
25 26 Should abort:
26 27
27 28 $ hg update 1
28 29 abort: uncommitted changes
29 30 (commit or update --clean to discard changes)
30 31 [255]
31 32 $ mv c a
32 33
33 34 Should succeed:
34 35
35 36 $ hg update 1
36 37 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -1,593 +1,594 b''
1 1 $ echo "[extensions]" >> $HGRCPATH
2 2 $ echo "mq=" >> $HGRCPATH
3 3
4 $ hg init
4 $ hg init repo
5 $ cd repo
5 6 $ hg qinit
6 7
7 8 $ echo x > x
8 9 $ hg ci -Ama
9 10 adding x
10 11
11 12 $ hg qnew a.patch
12 13 $ echo a > a
13 14 $ hg add a
14 15 $ hg qrefresh
15 16
16 17 $ hg qnew b.patch
17 18 $ echo b > b
18 19 $ hg add b
19 20 $ hg qrefresh
20 21
21 22 $ hg qnew c.patch
22 23 $ echo c > c
23 24 $ hg add c
24 25 $ hg qrefresh
25 26
26 27 $ hg qpop -a
27 28 popping c.patch
28 29 popping b.patch
29 30 popping a.patch
30 31 patch queue now empty
31 32
32 33
33 34 should fail
34 35
35 36 $ hg qguard does-not-exist.patch +bleh
36 37 abort: no patch named does-not-exist.patch
37 38 [255]
38 39
39 40
40 41 should fail
41 42
42 43 $ hg qguard +fail
43 44 abort: no patches applied
44 45 [255]
45 46
46 47 $ hg qpush
47 48 applying a.patch
48 49 now at: a.patch
49 50
50 51 should guard a.patch
51 52
52 53 $ hg qguard +a
53 54
54 55 should print +a
55 56
56 57 $ hg qguard
57 58 a.patch: +a
58 59 $ hg qpop
59 60 popping a.patch
60 61 patch queue now empty
61 62
62 63
63 64 should fail
64 65
65 66 $ hg qpush a.patch
66 67 cannot push 'a.patch' - guarded by '+a'
67 68 [1]
68 69
69 70 $ hg qguard a.patch
70 71 a.patch: +a
71 72
72 73 should push b.patch
73 74
74 75 $ hg qpush
75 76 applying b.patch
76 77 now at: b.patch
77 78
78 79 $ hg qpop
79 80 popping b.patch
80 81 patch queue now empty
81 82
82 83 test selection of an empty guard
83 84
84 85 $ hg qselect ""
85 86 abort: guard cannot be an empty string
86 87 [255]
87 88 $ hg qselect a
88 89 number of unguarded, unapplied patches has changed from 2 to 3
89 90
90 91 should push a.patch
91 92
92 93 $ hg qpush
93 94 applying a.patch
94 95 now at: a.patch
95 96
96 97 $ hg qguard -- c.patch -a
97 98
98 99 should print -a
99 100
100 101 $ hg qguard c.patch
101 102 c.patch: -a
102 103
103 104
104 105 should skip c.patch
105 106
106 107 $ hg qpush -a
107 108 applying b.patch
108 109 skipping c.patch - guarded by '-a'
109 110 now at: b.patch
110 111 $ hg qnext
111 112 all patches applied
112 113 [1]
113 114
114 115 should display b.patch
115 116
116 117 $ hg qtop
117 118 b.patch
118 119
119 120 $ hg qguard -n c.patch
120 121
121 122 should push c.patch
122 123
123 124 $ hg qpush -a
124 125 applying c.patch
125 126 now at: c.patch
126 127
127 128 $ hg qpop -a
128 129 popping c.patch
129 130 popping b.patch
130 131 popping a.patch
131 132 patch queue now empty
132 133 $ hg qselect -n
133 134 guards deactivated
134 135 number of unguarded, unapplied patches has changed from 3 to 2
135 136
136 137 should push all
137 138
138 139 $ hg qpush -a
139 140 applying b.patch
140 141 applying c.patch
141 142 now at: c.patch
142 143
143 144 $ hg qpop -a
144 145 popping c.patch
145 146 popping b.patch
146 147 patch queue now empty
147 148 $ hg qguard a.patch +1
148 149 $ hg qguard b.patch +2
149 150 $ hg qselect 1
150 151 number of unguarded, unapplied patches has changed from 1 to 2
151 152
152 153 should push a.patch, not b.patch
153 154
154 155 $ hg qpush
155 156 applying a.patch
156 157 now at: a.patch
157 158 $ hg qpush
158 159 applying c.patch
159 160 now at: c.patch
160 161 $ hg qpop -a
161 162 popping c.patch
162 163 popping a.patch
163 164 patch queue now empty
164 165
165 166 $ hg qselect 2
166 167
167 168 should push b.patch
168 169
169 170 $ hg qpush
170 171 applying b.patch
171 172 now at: b.patch
172 173 $ hg qpush -a
173 174 applying c.patch
174 175 now at: c.patch
175 176 $ hg qprev
176 177 b.patch
177 178
178 179 Used to be an issue with holes in the patch sequence
179 180 So, put one hole on the base and ask for topmost patch.
180 181
181 182 $ hg qtop
182 183 c.patch
183 184 $ hg qpop -a
184 185 popping c.patch
185 186 popping b.patch
186 187 patch queue now empty
187 188
188 189 $ hg qselect 1 2
189 190 number of unguarded, unapplied patches has changed from 2 to 3
190 191
191 192 should push a.patch, b.patch
192 193
193 194 $ hg qpush
194 195 applying a.patch
195 196 now at: a.patch
196 197 $ hg qpush
197 198 applying b.patch
198 199 now at: b.patch
199 200 $ hg qpop -a
200 201 popping b.patch
201 202 popping a.patch
202 203 patch queue now empty
203 204
204 205 $ hg qguard -- a.patch +1 +2 -3
205 206 $ hg qselect 1 2 3
206 207 number of unguarded, unapplied patches has changed from 3 to 2
207 208
208 209
209 210 list patches and guards
210 211
211 212 $ hg qguard -l
212 213 a.patch: +1 +2 -3
213 214 b.patch: +2
214 215 c.patch: unguarded
215 216
216 217 have at least one patch applied to test coloring
217 218
218 219 $ hg qpush
219 220 applying b.patch
220 221 now at: b.patch
221 222
222 223 list patches and guards with color
223 224
224 225 $ hg --config extensions.color= qguard --config color.mode=ansi \
225 226 > -l --color=always
226 227 \x1b[0;30;1ma.patch\x1b[0m: \x1b[0;33m+1\x1b[0m \x1b[0;33m+2\x1b[0m \x1b[0;31m-3\x1b[0m (esc)
227 228 \x1b[0;34;1;4mb.patch\x1b[0m: \x1b[0;33m+2\x1b[0m (esc)
228 229 \x1b[0;30;1mc.patch\x1b[0m: \x1b[0;32munguarded\x1b[0m (esc)
229 230
230 231 should pop b.patch
231 232
232 233 $ hg qpop
233 234 popping b.patch
234 235 patch queue now empty
235 236
236 237 list series
237 238
238 239 $ hg qseries -v
239 240 0 G a.patch
240 241 1 U b.patch
241 242 2 U c.patch
242 243
243 244 list guards
244 245
245 246 $ hg qselect
246 247 1
247 248 2
248 249 3
249 250
250 251 should push b.patch
251 252
252 253 $ hg qpush
253 254 applying b.patch
254 255 now at: b.patch
255 256
256 257 $ hg qpush -a
257 258 applying c.patch
258 259 now at: c.patch
259 260 $ hg qselect -n --reapply -v
260 261 guards deactivated
261 262 popping guarded patches
262 263 popping c.patch
263 264 popping b.patch
264 265 patch queue now empty
265 266 reapplying unguarded patches
266 267 skipping a.patch - guarded by '+1' '+2'
267 268 skipping b.patch - guarded by '+2'
268 269 skipping a.patch - guarded by '+1' '+2'
269 270 skipping b.patch - guarded by '+2'
270 271 applying c.patch
271 272 patching file c
272 273 adding c
273 274 committing files:
274 275 c
275 276 committing manifest
276 277 committing changelog
277 278 now at: c.patch
278 279
279 280 guards in series file: +1 +2 -3
280 281
281 282 $ hg qselect -s
282 283 +1
283 284 +2
284 285 -3
285 286
286 287 should show c.patch
287 288
288 289 $ hg qapplied
289 290 c.patch
290 291
291 292 $ hg qrename a.patch new.patch
292 293
293 294 should show :
294 295
295 296
296 297 new.patch: +1 +2 -3
297 298
298 299
299 300 b.patch: +2
300 301
301 302
302 303 c.patch: unguarded
303 304
304 305 $ hg qguard -l
305 306 new.patch: +1 +2 -3
306 307 b.patch: +2
307 308 c.patch: unguarded
308 309
309 310 $ hg qnew d.patch
310 311 $ hg qpop
311 312 popping d.patch
312 313 now at: c.patch
313 314
314 315 should show new.patch and b.patch as Guarded, c.patch as Applied
315 316
316 317
317 318 and d.patch as Unapplied
318 319
319 320 $ hg qseries -v
320 321 0 G new.patch
321 322 1 G b.patch
322 323 2 A c.patch
323 324 3 U d.patch
324 325
325 326 qseries again, but with color
326 327
327 328 $ hg --config extensions.color= --config color.mode=ansi qseries -v --color=always
328 329 0 G \x1b[0;30;1mnew.patch\x1b[0m (esc)
329 330 1 G \x1b[0;30;1mb.patch\x1b[0m (esc)
330 331 2 A \x1b[0;34;1;4mc.patch\x1b[0m (esc)
331 332 3 U \x1b[0;30;1md.patch\x1b[0m (esc)
332 333
333 334 $ hg qguard d.patch +2
334 335
335 336 new.patch, b.patch: Guarded. c.patch: Applied. d.patch: Guarded.
336 337
337 338 $ hg qseries -v
338 339 0 G new.patch
339 340 1 G b.patch
340 341 2 A c.patch
341 342 3 G d.patch
342 343
343 344 $ qappunappv()
344 345 > {
345 346 > for command in qapplied "qapplied -v" qunapplied "qunapplied -v"; do
346 347 > echo % hg $command
347 348 > hg $command
348 349 > done
349 350 > }
350 351
351 352 $ hg qpop -a
352 353 popping c.patch
353 354 patch queue now empty
354 355 $ hg qguard -l
355 356 new.patch: +1 +2 -3
356 357 b.patch: +2
357 358 c.patch: unguarded
358 359 d.patch: +2
359 360 $ qappunappv
360 361 % hg qapplied
361 362 % hg qapplied -v
362 363 % hg qunapplied
363 364 c.patch
364 365 % hg qunapplied -v
365 366 0 G new.patch
366 367 1 G b.patch
367 368 2 U c.patch
368 369 3 G d.patch
369 370 $ hg qselect 1
370 371 number of unguarded, unapplied patches has changed from 1 to 2
371 372 $ qappunappv
372 373 % hg qapplied
373 374 % hg qapplied -v
374 375 % hg qunapplied
375 376 new.patch
376 377 c.patch
377 378 % hg qunapplied -v
378 379 0 U new.patch
379 380 1 G b.patch
380 381 2 U c.patch
381 382 3 G d.patch
382 383 $ hg qpush -a
383 384 applying new.patch
384 385 skipping b.patch - guarded by '+2'
385 386 applying c.patch
386 387 skipping d.patch - guarded by '+2'
387 388 now at: c.patch
388 389 $ qappunappv
389 390 % hg qapplied
390 391 new.patch
391 392 c.patch
392 393 % hg qapplied -v
393 394 0 A new.patch
394 395 1 G b.patch
395 396 2 A c.patch
396 397 % hg qunapplied
397 398 % hg qunapplied -v
398 399 3 G d.patch
399 400 $ hg qselect 2
400 401 number of unguarded, unapplied patches has changed from 0 to 1
401 402 $ qappunappv
402 403 % hg qapplied
403 404 new.patch
404 405 c.patch
405 406 % hg qapplied -v
406 407 0 A new.patch
407 408 1 U b.patch
408 409 2 A c.patch
409 410 % hg qunapplied
410 411 d.patch
411 412 % hg qunapplied -v
412 413 3 U d.patch
413 414
414 415 $ for patch in `hg qseries`; do
415 416 > echo % hg qapplied $patch
416 417 > hg qapplied $patch
417 418 > echo % hg qunapplied $patch
418 419 > hg qunapplied $patch
419 420 > done
420 421 % hg qapplied new.patch
421 422 new.patch
422 423 % hg qunapplied new.patch
423 424 b.patch
424 425 d.patch
425 426 % hg qapplied b.patch
426 427 new.patch
427 428 % hg qunapplied b.patch
428 429 d.patch
429 430 % hg qapplied c.patch
430 431 new.patch
431 432 c.patch
432 433 % hg qunapplied c.patch
433 434 d.patch
434 435 % hg qapplied d.patch
435 436 new.patch
436 437 c.patch
437 438 % hg qunapplied d.patch
438 439
439 440
440 441 hg qseries -m: only b.patch should be shown
441 442 the guards file was not ignored in the past
442 443
443 444 $ hg qdelete -k b.patch
444 445 $ hg qseries -m
445 446 b.patch
446 447
447 448 hg qseries -m with color
448 449
449 450 $ hg --config extensions.color= --config color.mode=ansi qseries -m --color=always
450 451 \x1b[0;31;1mb.patch\x1b[0m (esc)
451 452
452 453
453 454 excercise corner cases in "qselect --reapply"
454 455
455 456 $ hg qpop -a
456 457 popping c.patch
457 458 popping new.patch
458 459 patch queue now empty
459 460 $ hg qguard -- new.patch -not-new
460 461 $ hg qguard -- c.patch -not-c
461 462 $ hg qguard -- d.patch -not-d
462 463 $ hg qpush -a
463 464 applying new.patch
464 465 applying c.patch
465 466 applying d.patch
466 467 patch d.patch is empty
467 468 now at: d.patch
468 469 $ hg qguard -l
469 470 new.patch: -not-new
470 471 c.patch: -not-c
471 472 d.patch: -not-d
472 473 $ hg qselect --reapply not-d
473 474 popping guarded patches
474 475 popping d.patch
475 476 now at: c.patch
476 477 reapplying unguarded patches
477 478 cannot push 'd.patch' - guarded by '-not-d'
478 479 $ hg qser -v
479 480 0 A new.patch
480 481 1 A c.patch
481 482 2 G d.patch
482 483 $ hg qselect --reapply -n
483 484 guards deactivated
484 485 $ hg qpush
485 486 applying d.patch
486 487 patch d.patch is empty
487 488 now at: d.patch
488 489 $ hg qser -v
489 490 0 A new.patch
490 491 1 A c.patch
491 492 2 A d.patch
492 493 $ hg qselect --reapply not-c
493 494 popping guarded patches
494 495 popping d.patch
495 496 popping c.patch
496 497 now at: new.patch
497 498 reapplying unguarded patches
498 499 applying d.patch
499 500 patch d.patch is empty
500 501 now at: d.patch
501 502 $ hg qser -v
502 503 0 A new.patch
503 504 1 G c.patch
504 505 2 A d.patch
505 506 $ hg qselect --reapply not-new
506 507 popping guarded patches
507 508 popping d.patch
508 509 popping new.patch
509 510 patch queue now empty
510 511 reapplying unguarded patches
511 512 applying c.patch
512 513 applying d.patch
513 514 patch d.patch is empty
514 515 now at: d.patch
515 516 $ hg qser -v
516 517 0 G new.patch
517 518 1 A c.patch
518 519 2 A d.patch
519 520
520 521 test that qselect shows "number of guarded, applied patches" correctly
521 522
522 523 $ hg qimport -q -e b.patch
523 524 adding b.patch to series file
524 525 $ hg qguard -- b.patch -not-b
525 526 $ hg qpop -a -q
526 527 patch queue now empty
527 528 $ hg qunapplied -v
528 529 0 G new.patch
529 530 1 U c.patch
530 531 2 U d.patch
531 532 3 U b.patch
532 533 $ hg qselect not-new not-c
533 534 number of unguarded, unapplied patches has changed from 3 to 2
534 535 $ hg qpush -q -a
535 536 patch d.patch is empty
536 537 now at: b.patch
537 538
538 539 $ hg qapplied -v
539 540 0 G new.patch
540 541 1 G c.patch
541 542 2 A d.patch
542 543 3 A b.patch
543 544 $ hg qselect --none
544 545 guards deactivated
545 546 $ hg qselect not-new not-c not-d
546 547 number of guarded, applied patches has changed from 0 to 1
547 548
548 549 test that "qselect --reapply" reapplies patches successfully when the
549 550 already applied patch becomes unguarded and it follows the already
550 551 guarded (= not yet applied) one.
551 552
552 553 $ hg qpop -q -a
553 554 patch queue now empty
554 555 $ hg qselect not-new not-c
555 556 number of unguarded, unapplied patches has changed from 1 to 2
556 557 $ hg qpush -q -a
557 558 patch d.patch is empty
558 559 now at: b.patch
559 560 $ hg qapplied -v
560 561 0 G new.patch
561 562 1 G c.patch
562 563 2 A d.patch
563 564 3 A b.patch
564 565 $ hg qselect -q --reapply not-c not-b
565 566 now at: d.patch
566 567 cannot push 'b.patch' - guarded by '-not-b'
567 568 $ hg qseries -v
568 569 0 U new.patch
569 570 1 G c.patch
570 571 2 A d.patch
571 572 3 G b.patch
572 573
573 574 test that "qselect --reapply" checks applied patches correctly when no
574 575 applied patches becomes guarded but some of unapplied ones become
575 576 unguarded.
576 577
577 578 $ hg qpop -q -a
578 579 patch queue now empty
579 580 $ hg qselect not-new not-c not-d
580 581 number of unguarded, unapplied patches has changed from 2 to 1
581 582 $ hg qpush -q -a
582 583 now at: b.patch
583 584 $ hg qapplied -v
584 585 0 G new.patch
585 586 1 G c.patch
586 587 2 G d.patch
587 588 3 A b.patch
588 589 $ hg qselect -q --reapply not-new not-c
589 590 $ hg qseries -v
590 591 0 G new.patch
591 592 1 G c.patch
592 593 2 U d.patch
593 594 3 A b.patch
@@ -1,15 +1,16 b''
1 1 $ echo "[extensions]" >> $HGRCPATH
2 2 $ echo "mq=" >> $HGRCPATH
3 3
4 $ hg init
4 $ hg init repo
5 $ cd repo
5 6
6 7 $ echo 'base' > base
7 8 $ hg ci -Ambase
8 9 adding base
9 10
10 11 $ hg qnew -mmqbase mqbase
11 12
12 13 $ hg qsave
13 14 $ hg qrestore 2
14 15 restoring status: hg patches saved state
15 16
@@ -1,112 +1,113 b''
1 1 #require symlink
2 2
3 3 $ echo "[extensions]" >> $HGRCPATH
4 4 $ echo "mq=" >> $HGRCPATH
5 5
6 $ hg init
6 $ hg init repo
7 $ cd repo
7 8 $ hg qinit
8 9 $ hg qnew base.patch
9 10 $ echo aaa > a
10 11 $ echo bbb > b
11 12 $ echo ccc > c
12 13 $ hg add a b c
13 14 $ hg qrefresh
14 15 $ readlink.py a
15 16 a -> a not a symlink
16 17
17 18
18 19 test replacing a file with a symlink
19 20
20 21 $ hg qnew symlink.patch
21 22 $ rm a
22 23 $ ln -s b a
23 24 $ hg qrefresh --git
24 25 $ readlink.py a
25 26 a -> b
26 27
27 28 $ hg qpop
28 29 popping symlink.patch
29 30 now at: base.patch
30 31 $ hg qpush
31 32 applying symlink.patch
32 33 now at: symlink.patch
33 34 $ readlink.py a
34 35 a -> b
35 36
36 37
37 38 test updating a symlink
38 39
39 40 $ rm a
40 41 $ ln -s c a
41 42 $ hg qnew --git -f updatelink
42 43 $ readlink.py a
43 44 a -> c
44 45 $ hg qpop
45 46 popping updatelink
46 47 now at: symlink.patch
47 48 $ hg qpush --debug
48 49 applying updatelink
49 50 patching file a
50 51 committing files:
51 52 a
52 53 committing manifest
53 54 committing changelog
54 55 updating the branch cache
55 56 now at: updatelink
56 57 $ readlink.py a
57 58 a -> c
58 59 $ hg st
59 60
60 61
61 62 test replacing a symlink with a file
62 63
63 64 $ ln -s c s
64 65 $ hg add s
65 66 $ hg qnew --git -f addlink
66 67 $ rm s
67 68 $ echo sss > s
68 69 $ hg qnew --git -f replacelinkwithfile
69 70 $ hg qpop
70 71 popping replacelinkwithfile
71 72 now at: addlink
72 73 $ hg qpush
73 74 applying replacelinkwithfile
74 75 now at: replacelinkwithfile
75 76 $ cat s
76 77 sss
77 78 $ hg st
78 79
79 80
80 81 test symlink removal
81 82
82 83 $ hg qnew removesl.patch
83 84 $ hg rm a
84 85 $ hg qrefresh --git
85 86 $ hg qpop
86 87 popping removesl.patch
87 88 now at: replacelinkwithfile
88 89 $ hg qpush
89 90 applying removesl.patch
90 91 now at: removesl.patch
91 92 $ hg st -c
92 93 C b
93 94 C c
94 95 C s
95 96
96 97 replace broken symlink with another broken symlink
97 98
98 99 $ ln -s linka linka
99 100 $ hg add linka
100 101 $ hg qnew link
101 102 $ hg mv linka linkb
102 103 $ rm linkb
103 104 $ ln -s linkb linkb
104 105 $ hg qnew movelink
105 106 $ hg qpop
106 107 popping movelink
107 108 now at: link
108 109 $ hg qpush
109 110 applying movelink
110 111 now at: movelink
111 112 $ readlink.py linkb
112 113 linkb -> linkb
@@ -1,532 +1,527 b''
1 1 $ hg init a
2 2 $ hg clone a b
3 3 updating to branch default
4 4 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
5 5 $ cd a
6 6
7 7 with no paths:
8 8
9 9 $ hg paths
10 10 $ hg paths unknown
11 11 not found!
12 12 [1]
13 13 $ hg paths -Tjson
14 14 [
15 15 ]
16 16
17 17 with paths:
18 18
19 19 $ echo '[paths]' >> .hg/hgrc
20 20 $ echo 'dupe = ../b#tip' >> .hg/hgrc
21 21 $ echo 'expand = $SOMETHING/bar' >> .hg/hgrc
22 22 $ hg in dupe
23 23 comparing with $TESTTMP/b
24 24 no changes found
25 25 [1]
26 26 $ cd ..
27 27 $ hg -R a in dupe
28 28 comparing with $TESTTMP/b
29 29 no changes found
30 30 [1]
31 31 $ cd a
32 32 $ hg paths
33 33 dupe = $TESTTMP/b#tip
34 34 expand = $TESTTMP/a/$SOMETHING/bar
35 35 $ SOMETHING=foo hg paths
36 36 dupe = $TESTTMP/b#tip
37 37 expand = $TESTTMP/a/foo/bar
38 38 #if msys
39 39 $ SOMETHING=//foo hg paths
40 40 dupe = $TESTTMP/b#tip
41 41 expand = /foo/bar
42 42 #else
43 43 $ SOMETHING=/foo hg paths
44 44 dupe = $TESTTMP/b#tip
45 45 expand = /foo/bar
46 46 #endif
47 47 $ hg paths -q
48 48 dupe
49 49 expand
50 50 $ hg paths dupe
51 51 $TESTTMP/b#tip
52 52 $ hg paths -q dupe
53 53 $ hg paths unknown
54 54 not found!
55 55 [1]
56 56 $ hg paths -q unknown
57 57 [1]
58 58
59 59 formatter output with paths:
60 60
61 61 $ echo 'dupe:pushurl = https://example.com/dupe' >> .hg/hgrc
62 62 $ hg paths -Tjson | sed 's|\\\\|\\|g'
63 63 [
64 64 {
65 65 "name": "dupe",
66 66 "pushurl": "https://example.com/dupe",
67 67 "url": "$TESTTMP/b#tip"
68 68 },
69 69 {
70 70 "name": "expand",
71 71 "url": "$TESTTMP/a/$SOMETHING/bar"
72 72 }
73 73 ]
74 74 $ hg paths -Tjson dupe | sed 's|\\\\|\\|g'
75 75 [
76 76 {
77 77 "name": "dupe",
78 78 "pushurl": "https://example.com/dupe",
79 79 "url": "$TESTTMP/b#tip"
80 80 }
81 81 ]
82 82 $ hg paths -Tjson -q unknown
83 83 [
84 84 ]
85 85 [1]
86 86
87 87 log template:
88 88
89 89 (behaves as a {name: path-string} dict by default)
90 90
91 91 $ hg log -rnull -T '{peerurls}\n'
92 92 dupe=$TESTTMP/b#tip expand=$TESTTMP/a/$SOMETHING/bar
93 93 $ hg log -rnull -T '{join(peerurls, "\n")}\n'
94 94 dupe=$TESTTMP/b#tip
95 95 expand=$TESTTMP/a/$SOMETHING/bar
96 96 $ hg log -rnull -T '{peerurls % "{name}: {url}\n"}'
97 97 dupe: $TESTTMP/b#tip
98 98 expand: $TESTTMP/a/$SOMETHING/bar
99 99 $ hg log -rnull -T '{get(peerurls, "dupe")}\n'
100 100 $TESTTMP/b#tip
101 101 #if windows
102 102 $ hg log -rnull -T '{peerurls % "{urls|json}\n"}'
103 103 [{"pushurl": "https://example.com/dupe", "url": "$STR_REPR_TESTTMP\\b#tip"}]
104 104 [{"url": "$STR_REPR_TESTTMP\\a\\$SOMETHING\\bar"}]
105 105 #else
106 106 $ hg log -rnull -T '{peerurls % "{urls|json}\n"}'
107 107 [{"pushurl": "https://example.com/dupe", "url": "$TESTTMP/b#tip"}]
108 108 [{"url": "$TESTTMP/a/$SOMETHING/bar"}]
109 109 #endif
110 110
111 111 (sub options can be populated by map/dot operation)
112 112
113 113 $ hg log -rnull \
114 114 > -T '{get(peerurls, "dupe") % "url: {url}\npushurl: {pushurl}\n"}'
115 115 url: $TESTTMP/b#tip
116 116 pushurl: https://example.com/dupe
117 117 $ hg log -rnull -T '{peerurls.dupe.pushurl}\n'
118 118 https://example.com/dupe
119 119
120 120 (in JSON, it's a dict of urls)
121 121
122 122 $ hg log -rnull -T '{peerurls|json}\n' | sed 's|\\\\|/|g'
123 123 {"dupe": "$TESTTMP/b#tip", "expand": "$TESTTMP/a/$SOMETHING/bar"}
124 124
125 125 password should be masked in plain output, but not in machine-readable/template
126 126 output:
127 127
128 128 $ echo 'insecure = http://foo:insecure@example.com/' >> .hg/hgrc
129 129 $ hg paths insecure
130 130 http://foo:***@example.com/
131 131 $ hg paths -Tjson insecure
132 132 [
133 133 {
134 134 "name": "insecure",
135 135 "url": "http://foo:insecure@example.com/"
136 136 }
137 137 ]
138 138 $ hg log -rnull -T '{get(peerurls, "insecure")}\n'
139 139 http://foo:insecure@example.com/
140 140
141 141 zeroconf wraps ui.configitems(), which shouldn't crash at least:
142 142
143 143 XXX-PYOXIDIZER Pyoxidizer build have trouble with zeroconf for unclear reason,
144 144 we accept the bad output for now as this is the last thing in the way of
145 145 testing the pyoxidizer build.
146 146
147 147 #if no-pyoxidizer
148 148 $ hg paths --config extensions.zeroconf=
149 149 dupe = $TESTTMP/b#tip
150 150 dupe:pushurl = https://example.com/dupe
151 151 expand = $TESTTMP/a/$SOMETHING/bar
152 152 insecure = http://foo:***@example.com/
153 153 #else
154 154 $ hg paths --config extensions.zeroconf=
155 155 abort: An invalid argument was supplied (known-bad-output !)
156 156 [255]
157 157 #endif
158 158
159 159
160 160 $ cd ..
161 161
162 162 sub-options for an undeclared path are ignored
163 163
164 164 $ hg init suboptions
165 165 $ cd suboptions
166 166
167 167 $ cat > .hg/hgrc << EOF
168 168 > [paths]
169 169 > path0 = https://example.com/path0
170 170 > path1:pushurl = https://example.com/path1
171 171 > EOF
172 172 $ hg paths
173 173 path0 = https://example.com/path0
174 174
175 175 unknown sub-options aren't displayed
176 176
177 177 $ cat > .hg/hgrc << EOF
178 178 > [paths]
179 179 > path0 = https://example.com/path0
180 180 > path0:foo = https://example.com/path1
181 181 > EOF
182 182
183 183 $ hg paths
184 184 path0 = https://example.com/path0
185 185
186 186 :pushurl must be a URL
187 187
188 188 $ cat > .hg/hgrc << EOF
189 189 > [paths]
190 190 > default = /path/to/nothing
191 191 > default:pushurl = /not/a/url
192 192 > EOF
193 193
194 194 $ hg paths
195 195 (paths.default:pushurl not a URL; ignoring: "/not/a/url")
196 196 default = /path/to/nothing
197 197
198 198 #fragment is not allowed in :pushurl
199 199
200 200 $ cat > .hg/hgrc << EOF
201 201 > [paths]
202 202 > default = https://example.com/repo
203 203 > invalid = https://example.com/repo
204 204 > invalid:pushurl = https://example.com/repo#branch
205 205 > EOF
206 206
207 207 $ hg paths
208 208 ("#fragment" in paths.invalid:pushurl not supported; ignoring)
209 209 default = https://example.com/repo
210 210 invalid = https://example.com/repo
211 211 invalid:pushurl = https://example.com/repo
212 212
213 213 $ cd ..
214 214
215 215 'file:' disables [paths] entries for clone destination
216 216
217 217 $ cat >> $HGRCPATH <<EOF
218 218 > [paths]
219 219 > gpath1 = http://hg.example.com
220 220 > EOF
221 221
222 222 $ hg clone a gpath1
223 223 abort: cannot create new http repository
224 224 [255]
225 225
226 226 $ hg clone a file:gpath1
227 227 updating to branch default
228 228 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
229 229 $ cd gpath1
230 230 $ hg -q id
231 231 000000000000
232 232
233 233 $ cd ..
234 234
235 235 Testing path referencing other paths
236 236 ====================================
237 237
238 238 basic setup
239 239 -----------
240 240
241 $ ls -1
242 a
243 b
244 gpath1
245 suboptions
246 241 $ hg init chained_path
247 242 $ cd chained_path
248 243 $ cat << EOF > .hg/hgrc
249 244 > [paths]
250 245 > default=../a
251 246 > other_default=path://default
252 247 > path_with_branch=../branchy#foo
253 248 > other_branch=path://path_with_branch
254 249 > other_branched=path://path_with_branch#default
255 250 > pushdest=../push-dest
256 251 > pushdest:pushrev=default
257 252 > pushdest2=path://pushdest
258 253 > pushdest-overwrite=path://pushdest
259 254 > pushdest-overwrite:pushrev=foo
260 255 > EOF
261 256
262 257 $ hg init ../branchy
263 258 $ hg init ../push-dest
264 259 $ hg debugbuilddag -R ../branchy '.:base+3<base@foo+5'
265 260 $ hg log -G -T '{branch}\n' -R ../branchy
266 261 o foo
267 262 |
268 263 o foo
269 264 |
270 265 o foo
271 266 |
272 267 o foo
273 268 |
274 269 o foo
275 270 |
276 271 | o default
277 272 | |
278 273 | o default
279 274 | |
280 275 | o default
281 276 |/
282 277 o default
283 278
284 279
285 280 $ hg paths
286 281 default = $TESTTMP/a
287 282 gpath1 = http://hg.example.com/
288 283 other_branch = $TESTTMP/branchy#foo
289 284 other_branched = $TESTTMP/branchy#default
290 285 other_default = $TESTTMP/a
291 286 path_with_branch = $TESTTMP/branchy#foo
292 287 pushdest = $TESTTMP/push-dest
293 288 pushdest:pushrev = default
294 289 pushdest-overwrite = $TESTTMP/push-dest
295 290 pushdest-overwrite:pushrev = foo
296 291 pushdest2 = $TESTTMP/push-dest
297 292 pushdest2:pushrev = default
298 293
299 294 test basic chaining
300 295 -------------------
301 296
302 297 $ hg path other_default
303 298 $TESTTMP/a
304 299 $ hg pull default
305 300 pulling from $TESTTMP/a
306 301 no changes found
307 302 $ hg pull other_default
308 303 pulling from $TESTTMP/a
309 304 no changes found
310 305
311 306 test inheritance of the #fragment part
312 307 --------------------------------------
313 308
314 309 $ hg pull path_with_branch
315 310 pulling from $TESTTMP/branchy
316 311 adding changesets
317 312 adding manifests
318 313 adding file changes
319 314 added 6 changesets with 0 changes to 0 files
320 315 new changesets 1ea73414a91b:bcebb50b77de
321 316 (run 'hg update' to get a working copy)
322 317 $ hg pull other_branch
323 318 pulling from $TESTTMP/branchy
324 319 no changes found
325 320 $ hg pull other_branched
326 321 pulling from $TESTTMP/branchy
327 322 searching for changes
328 323 adding changesets
329 324 adding manifests
330 325 adding file changes
331 326 added 3 changesets with 0 changes to 0 files (+1 heads)
332 327 new changesets 66f7d451a68b:2dc09a01254d
333 328 (run 'hg heads' to see heads)
334 329
335 330 test inheritance of the suboptions
336 331 ----------------------------------
337 332
338 333 $ hg push pushdest
339 334 pushing to $TESTTMP/push-dest
340 335 searching for changes
341 336 adding changesets
342 337 adding manifests
343 338 adding file changes
344 339 added 4 changesets with 0 changes to 0 files
345 340 $ hg push pushdest2
346 341 pushing to $TESTTMP/push-dest
347 342 searching for changes
348 343 no changes found
349 344 [1]
350 345 $ hg push pushdest-overwrite --new-branch
351 346 pushing to $TESTTMP/push-dest
352 347 searching for changes
353 348 adding changesets
354 349 adding manifests
355 350 adding file changes
356 351 added 5 changesets with 0 changes to 0 files (+1 heads)
357 352
358 353 Test chaining path:// definition
359 354 --------------------------------
360 355
361 356 This is currently unsupported, but feel free to implement the necessary
362 357 dependency detection.
363 358
364 359 $ cat << EOF >> .hg/hgrc
365 360 > chain_path=path://other_default
366 361 > EOF
367 362
368 363 $ hg id
369 364 000000000000
370 365 $ hg path
371 366 abort: cannot use `path://other_default`, "other_default" is also defined as a `path://`
372 367 [255]
373 368 $ hg pull chain_path
374 369 abort: cannot use `path://other_default`, "other_default" is also defined as a `path://`
375 370 [255]
376 371
377 372 Doing an actual circle should always be an issue
378 373
379 374 $ cat << EOF >> .hg/hgrc
380 375 > rock=path://cissors
381 376 > cissors=path://paper
382 377 > paper=://rock
383 378 > EOF
384 379
385 380 $ hg id
386 381 000000000000
387 382 $ hg path
388 383 abort: cannot use `path://other_default`, "other_default" is also defined as a `path://`
389 384 [255]
390 385 $ hg pull chain_path
391 386 abort: cannot use `path://other_default`, "other_default" is also defined as a `path://`
392 387 [255]
393 388
394 389 Test basic error cases
395 390 ----------------------
396 391
397 392 $ cat << EOF > .hg/hgrc
398 393 > [paths]
399 394 > error-missing=path://unknown
400 395 > EOF
401 396 $ hg path
402 397 abort: cannot use `path://unknown`, "unknown" is not a known path
403 398 [255]
404 399 $ hg pull error-missing
405 400 abort: cannot use `path://unknown`, "unknown" is not a known path
406 401 [255]
407 402
408 403 Test path pointing to multiple urls
409 404 ===================================
410 405
411 406 Simple cases
412 407 ------------
413 408 - one layer
414 409 - one list
415 410 - no special option
416 411
417 412 $ cat << EOF > .hg/hgrc
418 413 > [paths]
419 414 > one-path=foo
420 415 > multiple-path=foo,bar,baz,https://example.org/
421 416 > multiple-path:multi-urls=yes
422 417 > EOF
423 418 $ hg path
424 419 gpath1 = http://hg.example.com/
425 420 multiple-path = $TESTTMP/chained_path/foo
426 421 multiple-path:multi-urls = yes
427 422 multiple-path = $TESTTMP/chained_path/bar
428 423 multiple-path:multi-urls = yes
429 424 multiple-path = $TESTTMP/chained_path/baz
430 425 multiple-path:multi-urls = yes
431 426 multiple-path = https://example.org/
432 427 multiple-path:multi-urls = yes
433 428 one-path = $TESTTMP/chained_path/foo
434 429
435 430 Reference to a list
436 431 -------------------
437 432
438 433 $ cat << EOF >> .hg/hgrc
439 434 > ref-to-multi=path://multiple-path
440 435 > EOF
441 436 $ hg path | grep ref-to-multi
442 437 ref-to-multi = $TESTTMP/chained_path/foo
443 438 ref-to-multi:multi-urls = yes
444 439 ref-to-multi = $TESTTMP/chained_path/bar
445 440 ref-to-multi:multi-urls = yes
446 441 ref-to-multi = $TESTTMP/chained_path/baz
447 442 ref-to-multi:multi-urls = yes
448 443 ref-to-multi = https://example.org/
449 444 ref-to-multi:multi-urls = yes
450 445
451 446 List with a reference
452 447 ---------------------
453 448
454 449 $ cat << EOF >> .hg/hgrc
455 450 > multi-with-ref=path://one-path, ssh://babar@savannah/celeste-ville
456 451 > multi-with-ref:multi-urls=yes
457 452 > EOF
458 453 $ hg path | grep multi-with-ref
459 454 multi-with-ref = $TESTTMP/chained_path/foo
460 455 multi-with-ref:multi-urls = yes
461 456 multi-with-ref = ssh://babar@savannah/celeste-ville
462 457 multi-with-ref:multi-urls = yes
463 458
464 459 List with a reference to a list
465 460 -------------------------------
466 461
467 462 $ cat << EOF >> .hg/hgrc
468 463 > multi-to-multi-ref = path://multiple-path, ssh://celeste@savannah/celeste-ville
469 464 > multi-to-multi-ref:multi-urls = yes
470 465 > EOF
471 466 $ hg path | grep multi-to-multi-ref
472 467 multi-to-multi-ref = $TESTTMP/chained_path/foo
473 468 multi-to-multi-ref:multi-urls = yes
474 469 multi-to-multi-ref = $TESTTMP/chained_path/bar
475 470 multi-to-multi-ref:multi-urls = yes
476 471 multi-to-multi-ref = $TESTTMP/chained_path/baz
477 472 multi-to-multi-ref:multi-urls = yes
478 473 multi-to-multi-ref = https://example.org/
479 474 multi-to-multi-ref:multi-urls = yes
480 475 multi-to-multi-ref = ssh://celeste@savannah/celeste-ville
481 476 multi-to-multi-ref:multi-urls = yes
482 477
483 478 individual suboptions are inherited
484 479 -----------------------------------
485 480
486 481 $ cat << EOF >> .hg/hgrc
487 482 > with-pushurl = foo
488 483 > with-pushurl:pushurl = http://foo.bar/
489 484 > with-pushrev = bar
490 485 > with-pushrev:pushrev = draft()
491 486 > with-both = toto
492 487 > with-both:pushurl = http://ta.ta
493 488 > with-both:pushrev = secret()
494 489 > ref-all-no-opts = path://with-pushurl, path://with-pushrev, path://with-both
495 490 > ref-all-no-opts:multi-urls = yes
496 491 > with-overwrite = path://with-pushurl, path://with-pushrev, path://with-both
497 492 > with-overwrite:multi-urls = yes
498 493 > with-overwrite:pushrev = public()
499 494 > EOF
500 495 $ hg path | grep with-pushurl
501 496 with-pushurl = $TESTTMP/chained_path/foo
502 497 with-pushurl:pushurl = http://foo.bar/
503 498 $ hg path | grep with-pushrev
504 499 with-pushrev = $TESTTMP/chained_path/bar
505 500 with-pushrev:pushrev = draft()
506 501 $ hg path | grep with-both
507 502 with-both = $TESTTMP/chained_path/toto
508 503 with-both:pushrev = secret()
509 504 with-both:pushurl = http://ta.ta/
510 505 $ hg path | grep ref-all-no-opts
511 506 ref-all-no-opts = $TESTTMP/chained_path/foo
512 507 ref-all-no-opts:multi-urls = yes
513 508 ref-all-no-opts:pushurl = http://foo.bar/
514 509 ref-all-no-opts = $TESTTMP/chained_path/bar
515 510 ref-all-no-opts:multi-urls = yes
516 511 ref-all-no-opts:pushrev = draft()
517 512 ref-all-no-opts = $TESTTMP/chained_path/toto
518 513 ref-all-no-opts:multi-urls = yes
519 514 ref-all-no-opts:pushrev = secret()
520 515 ref-all-no-opts:pushurl = http://ta.ta/
521 516 $ hg path | grep with-overwrite
522 517 with-overwrite = $TESTTMP/chained_path/foo
523 518 with-overwrite:multi-urls = yes
524 519 with-overwrite:pushrev = public()
525 520 with-overwrite:pushurl = http://foo.bar/
526 521 with-overwrite = $TESTTMP/chained_path/bar
527 522 with-overwrite:multi-urls = yes
528 523 with-overwrite:pushrev = public()
529 524 with-overwrite = $TESTTMP/chained_path/toto
530 525 with-overwrite:multi-urls = yes
531 526 with-overwrite:pushrev = public()
532 527 with-overwrite:pushurl = http://ta.ta/
@@ -1,236 +1,237 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3
3 4 $ echo "[merge]" >> .hg/hgrc
4 5 $ echo "followcopies = 1" >> .hg/hgrc
5 6
6 7 $ echo foo > a
7 8 $ echo foo > a2
8 9 $ hg add a a2
9 10 $ hg ci -m "start"
10 11
11 12 $ hg mv a b
12 13 $ hg mv a2 b2
13 14 $ hg ci -m "rename"
14 15
15 16 $ hg co 0
16 17 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
17 18
18 19 $ echo blahblah > a
19 20 $ echo blahblah > a2
20 21 $ hg mv a2 c2
21 22 $ hg ci -m "modify"
22 23 created new head
23 24
24 25 $ hg merge -y --debug
25 26 unmatched files in local:
26 27 c2
27 28 unmatched files in other:
28 29 b
29 30 b2
30 31 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
31 32 on local side:
32 33 src: 'a2' -> dst: 'c2' !
33 34 on remote side:
34 35 src: 'a' -> dst: 'b' *
35 36 src: 'a2' -> dst: 'b2' !
36 37 checking for directory renames
37 38 resolving manifests
38 39 branchmerge: True, force: False, partial: False
39 40 ancestor: af1939970a1c, local: 044f8520aeeb+, remote: 85c198ef2f6c
40 41 note: possible conflict - a2 was renamed multiple times to:
41 42 b2
42 43 c2
43 44 b2: remote created -> g
44 45 getting b2
45 46 preserving a for resolve of b
46 47 removing a
47 48 b: remote moved from a -> m
48 49 picked tool ':merge' for b (binary False symlink False changedelete False)
49 50 merging a and b to b
50 51 my b@044f8520aeeb+ other b@85c198ef2f6c ancestor a@af1939970a1c
51 52 premerge successful
52 53 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
53 54 (branch merge, don't forget to commit)
54 55
55 56 $ hg status -AC
56 57 M b
57 58 a
58 59 M b2
59 60 R a
60 61 C c2
61 62
62 63 $ cat b
63 64 blahblah
64 65
65 66 $ hg ci -m "merge"
66 67
67 68 $ hg debugindex b
68 69 rev linkrev nodeid p1-nodeid p2-nodeid
69 70 0 1 57eacc201a7f 000000000000 000000000000
70 71 1 3 4727ba907962 000000000000 57eacc201a7f
71 72
72 73 $ hg debugrename b
73 74 b renamed from a:dd03b83622e78778b403775d0d074b9ac7387a66
74 75
75 76 This used to trigger a "divergent renames" warning, despite no renames
76 77
77 78 $ hg cp b b3
78 79 $ hg cp b b4
79 80 $ hg ci -A -m 'copy b twice'
80 81 $ hg up '.^'
81 82 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
82 83 $ hg up
83 84 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
84 85 $ hg rm b3 b4
85 86 $ hg ci -m 'clean up a bit of our mess'
86 87
87 88 We'd rather not warn on divergent renames done in the same changeset (issue2113)
88 89
89 90 $ hg cp b b3
90 91 $ hg mv b b4
91 92 $ hg ci -A -m 'divergent renames in same changeset'
92 93 $ hg up '.^'
93 94 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
94 95 $ hg up
95 96 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
96 97
97 98 Check for issue2642
98 99
99 100 $ hg init t
100 101 $ cd t
101 102
102 103 $ echo c0 > f1
103 104 $ hg ci -Aqm0
104 105
105 106 $ hg up null -q
106 107 $ echo c1 > f1 # backport
107 108 $ hg ci -Aqm1
108 109 $ hg mv f1 f2
109 110 $ hg ci -qm2
110 111
111 112 $ hg up 0 -q
112 113 $ hg merge 1 -q --tool internal:local
113 114 $ hg ci -qm3
114 115
115 116 $ hg merge 2
116 117 merging f1 and f2 to f2
117 118 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
118 119 (branch merge, don't forget to commit)
119 120
120 121 $ cat f2
121 122 c0
122 123
123 124 $ cd ..
124 125
125 126 Check for issue2089
126 127
127 128 $ hg init repo2089
128 129 $ cd repo2089
129 130
130 131 $ echo c0 > f1
131 132 $ hg ci -Aqm0
132 133
133 134 $ hg up null -q
134 135 $ echo c1 > f1
135 136 $ hg ci -Aqm1
136 137
137 138 $ hg up 0 -q
138 139 $ hg merge 1 -q --tool internal:local
139 140 $ echo c2 > f1
140 141 $ hg ci -qm2
141 142
142 143 $ hg up 1 -q
143 144 $ hg mv f1 f2
144 145 $ hg ci -Aqm3
145 146
146 147 $ hg up 2 -q
147 148 $ hg merge 3
148 149 merging f1 and f2 to f2
149 150 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
150 151 (branch merge, don't forget to commit)
151 152
152 153 $ cat f2
153 154 c2
154 155
155 156 $ cd ..
156 157
157 158 Check for issue3074
158 159
159 160 $ hg init repo3074
160 161 $ cd repo3074
161 162 $ echo foo > file
162 163 $ hg add file
163 164 $ hg commit -m "added file"
164 165 $ hg mv file newfile
165 166 $ hg commit -m "renamed file"
166 167 $ hg update 0
167 168 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
168 169 $ hg rm file
169 170 $ hg commit -m "deleted file"
170 171 created new head
171 172 $ hg merge --debug
172 173 unmatched files in other:
173 174 newfile
174 175 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
175 176 on remote side:
176 177 src: 'file' -> dst: 'newfile' %
177 178 checking for directory renames
178 179 resolving manifests
179 180 branchmerge: True, force: False, partial: False
180 181 ancestor: 19d7f95df299, local: 0084274f6b67+, remote: 5d32493049f0
181 182 note: possible conflict - file was deleted and renamed to:
182 183 newfile
183 184 newfile: remote created -> g
184 185 getting newfile
185 186 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
186 187 (branch merge, don't forget to commit)
187 188 $ hg status
188 189 M newfile
189 190 $ cd ..
190 191
191 192 Create x and y, then modify y and rename x to z on one side of merge, and
192 193 modify x and rename y to z on the other side.
193 194 $ hg init conflicting-target
194 195 $ cd conflicting-target
195 196 $ echo x > x
196 197 $ echo y > y
197 198 $ hg ci -Aqm 'add x and y'
198 199 $ hg mv x z
199 200 $ echo foo >> y
200 201 $ hg ci -qm 'modify y, rename x to z'
201 202 $ hg co -q 0
202 203 $ hg mv y z
203 204 $ echo foo >> x
204 205 $ hg ci -qm 'modify x, rename y to z'
205 206 # We should probably tell the user about the conflicting rename sources.
206 207 # Depending on which side they pick, we should take that rename and get
207 208 # the changes to the source from the other side. The unchanged file should
208 209 # remain.
209 210 $ hg merge --debug 1 -t :merge3
210 211 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
211 212 on local side:
212 213 src: 'y' -> dst: 'z' *
213 214 on remote side:
214 215 src: 'x' -> dst: 'z' *
215 216 checking for directory renames
216 217 resolving manifests
217 218 branchmerge: True, force: False, partial: False
218 219 ancestor: 5151c134577e, local: 07fcbc9a74ed+, remote: f21419739508
219 220 starting 4 threads for background file closing (?)
220 221 preserving z for resolve of z
221 222 z: both renamed from y -> m
222 223 picked tool ':merge3' for z (binary False symlink False changedelete False)
223 224 merging z
224 225 my z@07fcbc9a74ed+ other z@f21419739508 ancestor y@5151c134577e
225 226 premerge successful
226 227 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
227 228 (branch merge, don't forget to commit)
228 229 $ ls
229 230 x
230 231 z
231 232 $ cat x
232 233 x
233 234 foo
234 235 # 'z' should have had the added 'foo' line
235 236 $ cat z
236 237 x
@@ -1,696 +1,697 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3 $ mkdir d1 d1/d11 d2
3 4 $ echo d1/a > d1/a
4 5 $ echo d1/ba > d1/ba
5 6 $ echo d1/a1 > d1/d11/a1
6 7 $ echo d1/b > d1/b
7 8 $ echo d2/b > d2/b
8 9 $ hg add d1/a d1/b d1/ba d1/d11/a1 d2/b
9 10 $ hg commit -m "1"
10 11
11 12 rename a single file
12 13
13 14 $ hg rename d1/d11/a1 d2/c
14 15 $ hg --config ui.portablefilenames=abort rename d1/a d1/con.xml
15 16 abort: filename contains 'con', which is reserved on Windows: d1/con.xml
16 17 [10]
17 18 $ hg sum
18 19 parent: 0:9b4b6e7b2c26 tip
19 20 1
20 21 branch: default
21 22 commit: 1 renamed
22 23 update: (current)
23 24 phases: 1 draft
24 25 $ hg status -C
25 26 A d2/c
26 27 d1/d11/a1
27 28 R d1/d11/a1
28 29 $ hg update -C
29 30 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
30 31 $ rm d2/c
31 32
32 33 rename a single file using absolute paths
33 34
34 35 $ hg rename `pwd`/d1/d11/a1 `pwd`/d2/c
35 36 $ hg status -C
36 37 A d2/c
37 38 d1/d11/a1
38 39 R d1/d11/a1
39 40 $ hg update -C
40 41 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
41 42 $ rm d2/c
42 43
43 44 rename --after a single file
44 45
45 46 $ mv d1/d11/a1 d2/c
46 47 $ hg rename --after d1/d11/a1 d2/c
47 48 $ hg status -C
48 49 A d2/c
49 50 d1/d11/a1
50 51 R d1/d11/a1
51 52 $ hg update -C
52 53 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
53 54 $ rm d2/c
54 55
55 56 rename --after a single file when src and tgt already tracked
56 57
57 58 $ mv d1/d11/a1 d2/c
58 59 $ hg addrem -s 0
59 60 removing d1/d11/a1
60 61 adding d2/c
61 62 $ hg rename --after d1/d11/a1 d2/c
62 63 $ hg status -C
63 64 A d2/c
64 65 d1/d11/a1
65 66 R d1/d11/a1
66 67 $ hg update -C
67 68 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
68 69 $ rm d2/c
69 70
70 71 rename --after a single file to a nonexistent target filename
71 72
72 73 $ hg rename --after d1/a dummy
73 74 d1/a: not recording move - dummy does not exist
74 75 [1]
75 76
76 77 move a single file to an existing directory
77 78
78 79 $ hg rename d1/d11/a1 d2
79 80 $ hg status -C
80 81 A d2/a1
81 82 d1/d11/a1
82 83 R d1/d11/a1
83 84 $ hg update -C
84 85 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
85 86 $ rm d2/a1
86 87
87 88 move --after a single file to an existing directory
88 89
89 90 $ mv d1/d11/a1 d2
90 91 $ hg rename --after d1/d11/a1 d2
91 92 $ hg status -C
92 93 A d2/a1
93 94 d1/d11/a1
94 95 R d1/d11/a1
95 96 $ hg update -C
96 97 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
97 98 $ rm d2/a1
98 99
99 100 rename a file using a relative path
100 101
101 102 $ (cd d1/d11; hg rename ../../d2/b e)
102 103 $ hg status -C
103 104 A d1/d11/e
104 105 d2/b
105 106 R d2/b
106 107 $ hg update -C
107 108 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 109 $ rm d1/d11/e
109 110
110 111 rename --after a file using a relative path
111 112
112 113 $ (cd d1/d11; mv ../../d2/b e; hg rename --after ../../d2/b e)
113 114 $ hg status -C
114 115 A d1/d11/e
115 116 d2/b
116 117 R d2/b
117 118 $ hg update -C
118 119 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
119 120 $ rm d1/d11/e
120 121
121 122 rename directory d1 as d3
122 123
123 124 $ hg rename d1/ d3
124 125 moving d1/a to d3/a
125 126 moving d1/b to d3/b
126 127 moving d1/ba to d3/ba
127 128 moving d1/d11/a1 to d3/d11/a1
128 129 $ hg status -C
129 130 A d3/a
130 131 d1/a
131 132 A d3/b
132 133 d1/b
133 134 A d3/ba
134 135 d1/ba
135 136 A d3/d11/a1
136 137 d1/d11/a1
137 138 R d1/a
138 139 R d1/b
139 140 R d1/ba
140 141 R d1/d11/a1
141 142 $ hg update -C
142 143 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
143 144 $ rm -rf d3
144 145
145 146 rename --after directory d1 as d3
146 147
147 148 $ mv d1 d3
148 149 $ hg rename --after d1 d3
149 150 moving d1/a to d3/a
150 151 moving d1/b to d3/b
151 152 moving d1/ba to d3/ba
152 153 moving d1/d11/a1 to d3/d11/a1
153 154 $ hg status -C
154 155 A d3/a
155 156 d1/a
156 157 A d3/b
157 158 d1/b
158 159 A d3/ba
159 160 d1/ba
160 161 A d3/d11/a1
161 162 d1/d11/a1
162 163 R d1/a
163 164 R d1/b
164 165 R d1/ba
165 166 R d1/d11/a1
166 167 $ hg update -C
167 168 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
168 169 $ rm -rf d3
169 170
170 171 move a directory using a relative path
171 172
172 173 $ (cd d2; mkdir d3; hg rename ../d1/d11 d3)
173 174 moving ../d1/d11/a1 to d3/d11/a1
174 175 $ hg status -C
175 176 A d2/d3/d11/a1
176 177 d1/d11/a1
177 178 R d1/d11/a1
178 179 $ hg update -C
179 180 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
180 181 $ rm -rf d2/d3
181 182
182 183 move --after a directory using a relative path
183 184
184 185 $ (cd d2; mkdir d3; mv ../d1/d11 d3; hg rename --after ../d1/d11 d3)
185 186 moving ../d1/d11/a1 to d3/d11/a1
186 187 $ hg status -C
187 188 A d2/d3/d11/a1
188 189 d1/d11/a1
189 190 R d1/d11/a1
190 191 $ hg update -C
191 192 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
192 193 $ rm -rf d2/d3
193 194
194 195 move directory d1/d11 to an existing directory d2 (removes empty d1)
195 196
196 197 $ hg rename d1/d11/ d2
197 198 moving d1/d11/a1 to d2/d11/a1
198 199 $ hg status -C
199 200 A d2/d11/a1
200 201 d1/d11/a1
201 202 R d1/d11/a1
202 203 $ hg update -C
203 204 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
204 205 $ rm -rf d2/d11
205 206
206 207 move directories d1 and d2 to a new directory d3
207 208
208 209 $ mkdir d3
209 210 $ hg rename d1 d2 d3
210 211 moving d1/a to d3/d1/a
211 212 moving d1/b to d3/d1/b
212 213 moving d1/ba to d3/d1/ba
213 214 moving d1/d11/a1 to d3/d1/d11/a1
214 215 moving d2/b to d3/d2/b
215 216 $ hg status -C
216 217 A d3/d1/a
217 218 d1/a
218 219 A d3/d1/b
219 220 d1/b
220 221 A d3/d1/ba
221 222 d1/ba
222 223 A d3/d1/d11/a1
223 224 d1/d11/a1
224 225 A d3/d2/b
225 226 d2/b
226 227 R d1/a
227 228 R d1/b
228 229 R d1/ba
229 230 R d1/d11/a1
230 231 R d2/b
231 232 $ hg update -C
232 233 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
233 234 $ rm -rf d3
234 235
235 236 move --after directories d1 and d2 to a new directory d3
236 237
237 238 $ mkdir d3
238 239 $ mv d1 d2 d3
239 240 $ hg rename --after d1 d2 d3
240 241 moving d1/a to d3/d1/a
241 242 moving d1/b to d3/d1/b
242 243 moving d1/ba to d3/d1/ba
243 244 moving d1/d11/a1 to d3/d1/d11/a1
244 245 moving d2/b to d3/d2/b
245 246 $ hg status -C
246 247 A d3/d1/a
247 248 d1/a
248 249 A d3/d1/b
249 250 d1/b
250 251 A d3/d1/ba
251 252 d1/ba
252 253 A d3/d1/d11/a1
253 254 d1/d11/a1
254 255 A d3/d2/b
255 256 d2/b
256 257 R d1/a
257 258 R d1/b
258 259 R d1/ba
259 260 R d1/d11/a1
260 261 R d2/b
261 262 $ hg update -C
262 263 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
263 264 $ rm -rf d3
264 265
265 266 move everything under directory d1 to existing directory d2, do not
266 267 overwrite existing files (d2/b)
267 268
268 269 $ hg rename d1/* d2
269 270 d2/b: not overwriting - file already committed
270 271 ('hg rename --force' to replace the file by recording a rename)
271 272 moving d1/d11/a1 to d2/d11/a1
272 273 [1]
273 274 $ hg status -C
274 275 A d2/a
275 276 d1/a
276 277 A d2/ba
277 278 d1/ba
278 279 A d2/d11/a1
279 280 d1/d11/a1
280 281 R d1/a
281 282 R d1/ba
282 283 R d1/d11/a1
283 284 $ diff -u d1/b d2/b
284 285 --- d1/b * (glob)
285 286 +++ d2/b * (glob)
286 287 @@ * (glob)
287 288 -d1/b
288 289 +d2/b
289 290 [1]
290 291 $ hg update -C
291 292 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
292 293 $ rm d2/a d2/ba d2/d11/a1
293 294
294 295 attempt to move one file into a non-existent directory
295 296
296 297 $ hg rename d1/a dx/
297 298 abort: destination dx/ is not a directory
298 299 [10]
299 300 $ hg status -C
300 301 $ hg update -C
301 302 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
302 303
303 304 attempt to move potentially more than one file into a non-existent directory
304 305
305 306 $ hg rename 'glob:d1/**' dx
306 307 abort: with multiple sources, destination must be an existing directory
307 308 [10]
308 309
309 310 move every file under d1 to d2/d21
310 311
311 312 $ mkdir d2/d21
312 313 $ hg rename 'glob:d1/**' d2/d21
313 314 moving d1/a to d2/d21/a
314 315 moving d1/b to d2/d21/b
315 316 moving d1/ba to d2/d21/ba
316 317 moving d1/d11/a1 to d2/d21/a1
317 318 $ hg status -C
318 319 A d2/d21/a
319 320 d1/a
320 321 A d2/d21/a1
321 322 d1/d11/a1
322 323 A d2/d21/b
323 324 d1/b
324 325 A d2/d21/ba
325 326 d1/ba
326 327 R d1/a
327 328 R d1/b
328 329 R d1/ba
329 330 R d1/d11/a1
330 331 $ hg update -C
331 332 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
332 333 $ rm -rf d2/d21
333 334
334 335 move --after some files under d1 to d2/d21
335 336
336 337 $ mkdir d2/d21
337 338 $ mv d1/a d1/d11/a1 d2/d21
338 339 $ hg rename --after 'glob:d1/**' d2/d21
339 340 moving d1/a to d2/d21/a
340 341 d1/b: not recording move - d2/d21/b does not exist
341 342 d1/ba: not recording move - d2/d21/ba does not exist
342 343 moving d1/d11/a1 to d2/d21/a1
343 344 [1]
344 345 $ hg status -C
345 346 A d2/d21/a
346 347 d1/a
347 348 A d2/d21/a1
348 349 d1/d11/a1
349 350 R d1/a
350 351 R d1/d11/a1
351 352 $ hg update -C
352 353 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
353 354 $ rm -rf d2/d21
354 355
355 356 move every file under d1 starting with an 'a' to d2/d21 (regexp)
356 357
357 358 $ mkdir d2/d21
358 359 $ hg rename 're:d1/([^a][^/]*/)*a.*' d2/d21
359 360 moving d1/a to d2/d21/a
360 361 moving d1/d11/a1 to d2/d21/a1
361 362 $ hg status -C
362 363 A d2/d21/a
363 364 d1/a
364 365 A d2/d21/a1
365 366 d1/d11/a1
366 367 R d1/a
367 368 R d1/d11/a1
368 369 $ hg update -C
369 370 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
370 371 $ rm -rf d2/d21
371 372
372 373 attempt to overwrite an existing file
373 374
374 375 $ echo "ca" > d1/ca
375 376 $ hg rename d1/ba d1/ca
376 377 d1/ca: not overwriting - file exists
377 378 ('hg rename --after' to record the rename)
378 379 [1]
379 380 $ hg status -C
380 381 ? d1/ca
381 382 $ hg update -C
382 383 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
383 384
384 385 forced overwrite of an existing file
385 386
386 387 $ echo "ca" > d1/ca
387 388 $ hg rename --force d1/ba d1/ca
388 389 $ hg status -C
389 390 A d1/ca
390 391 d1/ba
391 392 R d1/ba
392 393 $ hg update -C
393 394 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
394 395 $ rm d1/ca
395 396
396 397 attempt to overwrite an existing broken symlink
397 398
398 399 #if symlink
399 400 $ ln -s ba d1/ca
400 401 $ hg rename --traceback d1/ba d1/ca
401 402 d1/ca: not overwriting - file exists
402 403 ('hg rename --after' to record the rename)
403 404 [1]
404 405 $ hg status -C
405 406 ? d1/ca
406 407 $ hg update -C
407 408 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
408 409 $ rm d1/ca
409 410
410 411 replace a symlink with a file
411 412
412 413 $ ln -s ba d1/ca
413 414 $ hg rename --force d1/ba d1/ca
414 415 $ hg status -C
415 416 A d1/ca
416 417 d1/ba
417 418 R d1/ba
418 419 $ hg update -C
419 420 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
420 421 $ rm d1/ca
421 422 #endif
422 423
423 424 do not copy more than one source file to the same destination file
424 425
425 426 $ mkdir d3
426 427 $ hg rename d1/* d2/* d3
427 428 moving d1/d11/a1 to d3/d11/a1
428 429 d3/b: not overwriting - d2/b collides with d1/b
429 430 [1]
430 431 $ hg status -C
431 432 A d3/a
432 433 d1/a
433 434 A d3/b
434 435 d1/b
435 436 A d3/ba
436 437 d1/ba
437 438 A d3/d11/a1
438 439 d1/d11/a1
439 440 R d1/a
440 441 R d1/b
441 442 R d1/ba
442 443 R d1/d11/a1
443 444 $ hg update -C
444 445 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
445 446 $ rm -rf d3
446 447
447 448 move a whole subtree with "hg rename ."
448 449
449 450 $ mkdir d3
450 451 $ (cd d1; hg rename . ../d3)
451 452 moving a to ../d3/d1/a
452 453 moving b to ../d3/d1/b
453 454 moving ba to ../d3/d1/ba
454 455 moving d11/a1 to ../d3/d1/d11/a1
455 456 $ hg status -C
456 457 A d3/d1/a
457 458 d1/a
458 459 A d3/d1/b
459 460 d1/b
460 461 A d3/d1/ba
461 462 d1/ba
462 463 A d3/d1/d11/a1
463 464 d1/d11/a1
464 465 R d1/a
465 466 R d1/b
466 467 R d1/ba
467 468 R d1/d11/a1
468 469 $ hg update -C
469 470 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
470 471 $ rm -rf d3
471 472
472 473 move a whole subtree with "hg rename --after ."
473 474
474 475 $ mkdir d3
475 476 $ mv d1/* d3
476 477 $ (cd d1; hg rename --after . ../d3)
477 478 moving a to ../d3/a
478 479 moving b to ../d3/b
479 480 moving ba to ../d3/ba
480 481 moving d11/a1 to ../d3/d11/a1
481 482 $ hg status -C
482 483 A d3/a
483 484 d1/a
484 485 A d3/b
485 486 d1/b
486 487 A d3/ba
487 488 d1/ba
488 489 A d3/d11/a1
489 490 d1/d11/a1
490 491 R d1/a
491 492 R d1/b
492 493 R d1/ba
493 494 R d1/d11/a1
494 495 $ hg update -C
495 496 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
496 497 $ rm -rf d3
497 498
498 499 move the parent tree with "hg rename .."
499 500
500 501 $ (cd d1/d11; hg rename .. ../../d3)
501 502 moving ../a to ../../d3/a
502 503 moving ../b to ../../d3/b
503 504 moving ../ba to ../../d3/ba
504 505 moving a1 to ../../d3/d11/a1
505 506 $ hg status -C
506 507 A d3/a
507 508 d1/a
508 509 A d3/b
509 510 d1/b
510 511 A d3/ba
511 512 d1/ba
512 513 A d3/d11/a1
513 514 d1/d11/a1
514 515 R d1/a
515 516 R d1/b
516 517 R d1/ba
517 518 R d1/d11/a1
518 519 $ hg update -C
519 520 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
520 521 $ rm -rf d3
521 522
522 523 skip removed files
523 524
524 525 $ hg remove d1/b
525 526 $ hg rename d1 d3
526 527 moving d1/a to d3/a
527 528 moving d1/ba to d3/ba
528 529 moving d1/d11/a1 to d3/d11/a1
529 530 $ hg status -C
530 531 A d3/a
531 532 d1/a
532 533 A d3/ba
533 534 d1/ba
534 535 A d3/d11/a1
535 536 d1/d11/a1
536 537 R d1/a
537 538 R d1/b
538 539 R d1/ba
539 540 R d1/d11/a1
540 541 $ hg update -C
541 542 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
542 543 $ rm -rf d3
543 544
544 545 transitive rename
545 546
546 547 $ hg rename d1/b d1/bb
547 548 $ hg rename d1/bb d1/bc
548 549 $ hg status -C
549 550 A d1/bc
550 551 d1/b
551 552 R d1/b
552 553 $ hg update -C
553 554 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
554 555 $ rm d1/bc
555 556
556 557 transitive rename --after
557 558
558 559 $ hg rename d1/b d1/bb
559 560 $ mv d1/bb d1/bc
560 561 $ hg rename --after d1/bb d1/bc
561 562 $ hg status -C
562 563 A d1/bc
563 564 d1/b
564 565 R d1/b
565 566 $ hg update -C
566 567 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
567 568 $ rm d1/bc
568 569
569 570 $ echo "# idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)"
570 571 # idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)
571 572 $ hg rename d1/b d1/bb
572 573 $ echo "some stuff added to d1/bb" >> d1/bb
573 574 $ hg rename d1/bb d1/b
574 575 $ hg status -C
575 576 M d1/b
576 577 $ hg update -C
577 578 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
578 579
579 580 overwriting with renames (issue1959)
580 581
581 582 $ hg rename d1/a d1/c
582 583 $ hg rename d1/b d1/a
583 584 $ hg status -C
584 585 M d1/a
585 586 d1/b
586 587 A d1/c
587 588 d1/a
588 589 R d1/b
589 590 $ hg diff --git
590 591 diff --git a/d1/a b/d1/a
591 592 --- a/d1/a
592 593 +++ b/d1/a
593 594 @@ -1,1 +1,1 @@
594 595 -d1/a
595 596 +d1/b
596 597 diff --git a/d1/b b/d1/b
597 598 deleted file mode 100644
598 599 --- a/d1/b
599 600 +++ /dev/null
600 601 @@ -1,1 +0,0 @@
601 602 -d1/b
602 603 diff --git a/d1/a b/d1/c
603 604 copy from d1/a
604 605 copy to d1/c
605 606 $ hg update -C
606 607 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
607 608 $ rm d1/c # The file was marked as added, so 'hg update' action was 'forget'
608 609
609 610 check illegal path components
610 611
611 612 $ hg rename d1/d11/a1 .hg/foo
612 613 abort: path contains illegal component: .hg/foo
613 614 [10]
614 615 $ hg status -C
615 616 $ hg rename d1/d11/a1 ../foo
616 abort: ../foo not under root '$TESTTMP'
617 abort: ../foo not under root '$TESTTMP/repo'
617 618 [255]
618 619 $ hg status -C
619 620
620 621 $ mv d1/d11/a1 .hg/foo
621 622 $ hg rename --after d1/d11/a1 .hg/foo
622 623 abort: path contains illegal component: .hg/foo
623 624 [10]
624 625 $ hg status -C
625 626 ! d1/d11/a1
626 627 $ hg update -C
627 628 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
628 629 $ rm .hg/foo
629 630
630 631 $ hg rename d1/d11/a1 .hg
631 632 abort: path contains illegal component: .hg/a1
632 633 [10]
633 634 $ hg --config extensions.largefiles= rename d1/d11/a1 .hg
634 635 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
635 636 abort: path contains illegal component: .hg/a1
636 637 [10]
637 638 $ hg status -C
638 639 $ hg rename d1/d11/a1 ..
639 abort: ../a1 not under root '$TESTTMP'
640 abort: ../a1 not under root '$TESTTMP/repo'
640 641 [255]
641 642 $ hg --config extensions.largefiles= rename d1/d11/a1 ..
642 643 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
643 abort: ../a1 not under root '$TESTTMP'
644 abort: ../a1 not under root '$TESTTMP/repo'
644 645 [255]
645 646 $ hg status -C
646 647
647 648 $ mv d1/d11/a1 .hg
648 649 $ hg rename --after d1/d11/a1 .hg
649 650 abort: path contains illegal component: .hg/a1
650 651 [10]
651 652 $ hg status -C
652 653 ! d1/d11/a1
653 654 $ hg update -C
654 655 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
655 656 $ rm .hg/a1
656 657
657 658 $ (cd d1/d11; hg rename ../../d2/b ../../.hg/foo)
658 659 abort: path contains illegal component: .hg/foo
659 660 [10]
660 661 $ hg status -C
661 662 $ (cd d1/d11; hg rename ../../d2/b ../../../foo)
662 abort: ../../../foo not under root '$TESTTMP'
663 abort: ../../../foo not under root '$TESTTMP/repo'
663 664 [255]
664 665 $ hg status -C
665 666
666 667 check that stat information such as mtime is preserved on rename - it's unclear
667 668 whether the `touch` and `stat` commands are portable, so we mimic them using
668 669 python. Not all platforms support precision of even one-second granularity, so
669 670 we allow a rather generous fudge factor here; 1234567890 is 2009, and the
670 671 primary thing we care about is that it's not the machine's current time;
671 672 hopefully it's really unlikely for a machine to have such a broken clock that
672 673 this test fails. :)
673 674
674 675 $ mkdir mtime
675 676 Create the file (as empty), then update its mtime and atime to be 1234567890.
676 677 >>> import os
677 678 >>> filename = "mtime/f"
678 679 >>> mtime = 1234567890
679 680 >>> open(filename, "w").close()
680 681 >>> os.utime(filename, (mtime, mtime))
681 682 $ hg ci -qAm 'add mtime dir'
682 683 "hg cp" does not preserve the mtime, so it should be newer than the 2009
683 684 timestamp.
684 685 $ hg cp -q mtime mtime_cp
685 686 >>> import os
686 687 >>> filename = "mtime_cp/f"
687 688 >>> print(os.stat(filename).st_mtime < 1234567999)
688 689 False
689 690 "hg mv" preserves the mtime, so it should be ~equal to the 2009 timestamp
690 691 (modulo some fudge factor due to not every system supporting 1s-level
691 692 precision).
692 693 $ hg mv -q mtime mtime_mv
693 694 >>> import os
694 695 >>> filename = "mtime_mv/f"
695 696 >>> print(os.stat(filename).st_mtime < 1234567999)
696 697 True
@@ -1,30 +1,31 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3 $ touch unknown
3 4
4 5 $ touch a
5 6 $ hg add a
6 7 $ hg ci -m "1"
7 8
8 9 $ touch b
9 10 $ hg add b
10 11 $ hg ci -m "2"
11 12
12 13 Should show unknown
13 14
14 15 $ hg status
15 16 ? unknown
16 17 $ hg revert -r 0 --all
17 18 removing b
18 19
19 20 Should show unknown and b removed
20 21
21 22 $ hg status
22 23 R b
23 24 ? unknown
24 25
25 26 Should show a and unknown
26 27
27 28 $ ls -A
28 29 .hg
29 30 a
30 31 unknown
@@ -1,158 +1,159 b''
1 1 Tests of 'hg status --rev <rev>' to make sure status between <rev> and '.' get
2 2 combined correctly with the dirstate status.
3 3
4 $ hg init
4 $ hg init repo
5 $ cd repo
5 6
6 7 First commit
7 8
8 9 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 1
9 10 $ hg addremove --similarity 0
10 11 adding content1_content1_content1-tracked
11 12 adding content1_content1_content1-untracked
12 13 adding content1_content1_content3-tracked
13 14 adding content1_content1_content3-untracked
14 15 adding content1_content1_missing-tracked
15 16 adding content1_content1_missing-untracked
16 17 adding content1_content2_content1-tracked
17 18 adding content1_content2_content1-untracked
18 19 adding content1_content2_content2-tracked
19 20 adding content1_content2_content2-untracked
20 21 adding content1_content2_content3-tracked
21 22 adding content1_content2_content3-untracked
22 23 adding content1_content2_missing-tracked
23 24 adding content1_content2_missing-untracked
24 25 adding content1_missing_content1-tracked
25 26 adding content1_missing_content1-untracked
26 27 adding content1_missing_content3-tracked
27 28 adding content1_missing_content3-untracked
28 29 adding content1_missing_missing-tracked
29 30 adding content1_missing_missing-untracked
30 31 $ hg commit -m first
31 32
32 33 Second commit
33 34
34 35 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 2
35 36 $ hg addremove --similarity 0
36 37 removing content1_missing_content1-tracked
37 38 removing content1_missing_content1-untracked
38 39 removing content1_missing_content3-tracked
39 40 removing content1_missing_content3-untracked
40 41 removing content1_missing_missing-tracked
41 42 removing content1_missing_missing-untracked
42 43 adding missing_content2_content2-tracked
43 44 adding missing_content2_content2-untracked
44 45 adding missing_content2_content3-tracked
45 46 adding missing_content2_content3-untracked
46 47 adding missing_content2_missing-tracked
47 48 adding missing_content2_missing-untracked
48 49 $ hg commit -m second
49 50
50 51 Working copy
51 52
52 53 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 wc
53 54 $ hg addremove --similarity 0
54 55 adding content1_missing_content1-tracked
55 56 adding content1_missing_content1-untracked
56 57 adding content1_missing_content3-tracked
57 58 adding content1_missing_content3-untracked
58 59 adding content1_missing_missing-tracked
59 60 adding content1_missing_missing-untracked
60 61 adding missing_missing_content3-tracked
61 62 adding missing_missing_content3-untracked
62 63 adding missing_missing_missing-tracked
63 64 adding missing_missing_missing-untracked
64 65 $ hg forget *_*_*-untracked
65 66 $ rm *_*_missing-*
66 67
67 68 Status compared to parent of the working copy, i.e. the dirstate status
68 69
69 70 $ hg status -A --rev 1 'glob:missing_content2_content3-tracked'
70 71 M missing_content2_content3-tracked
71 72 $ hg status -A --rev 1 'glob:missing_content2_content2-tracked'
72 73 C missing_content2_content2-tracked
73 74 $ hg status -A --rev 1 'glob:missing_missing_content3-tracked'
74 75 A missing_missing_content3-tracked
75 76 $ hg status -A --rev 1 'glob:missing_missing_content3-untracked'
76 77 ? missing_missing_content3-untracked
77 78 $ hg status -A --rev 1 'glob:missing_content2_*-untracked'
78 79 R missing_content2_content2-untracked
79 80 R missing_content2_content3-untracked
80 81 R missing_content2_missing-untracked
81 82 $ hg status -A --rev 1 'glob:missing_*_missing-tracked'
82 83 ! missing_content2_missing-tracked
83 84 ! missing_missing_missing-tracked
84 85
85 86 $ hg status -A --rev 1 'glob:missing_missing_missing-untracked'
86 87 missing_missing_missing-untracked: $ENOENT$
87 88
88 89 Status between first and second commit. Should ignore dirstate status.
89 90
90 91 $ hg status -A --rev 0:1 'glob:content1_content2_*'
91 92 M content1_content2_content1-tracked
92 93 M content1_content2_content1-untracked
93 94 M content1_content2_content2-tracked
94 95 M content1_content2_content2-untracked
95 96 M content1_content2_content3-tracked
96 97 M content1_content2_content3-untracked
97 98 M content1_content2_missing-tracked
98 99 M content1_content2_missing-untracked
99 100 $ hg status -A --rev 0:1 'glob:content1_content1_*'
100 101 C content1_content1_content1-tracked
101 102 C content1_content1_content1-untracked
102 103 C content1_content1_content3-tracked
103 104 C content1_content1_content3-untracked
104 105 C content1_content1_missing-tracked
105 106 C content1_content1_missing-untracked
106 107 $ hg status -A --rev 0:1 'glob:missing_content2_*'
107 108 A missing_content2_content2-tracked
108 109 A missing_content2_content2-untracked
109 110 A missing_content2_content3-tracked
110 111 A missing_content2_content3-untracked
111 112 A missing_content2_missing-tracked
112 113 A missing_content2_missing-untracked
113 114 $ hg status -A --rev 0:1 'glob:content1_missing_*'
114 115 R content1_missing_content1-tracked
115 116 R content1_missing_content1-untracked
116 117 R content1_missing_content3-tracked
117 118 R content1_missing_content3-untracked
118 119 R content1_missing_missing-tracked
119 120 R content1_missing_missing-untracked
120 121 $ hg status -A --rev 0:1 'glob:missing_missing_*'
121 122
122 123 Status compared to one revision back, checking that the dirstate status
123 124 is correctly combined with the inter-revision status
124 125
125 126 $ hg status -A --rev 0 'glob:content1_*_content[23]-tracked'
126 127 M content1_content1_content3-tracked
127 128 M content1_content2_content2-tracked
128 129 M content1_content2_content3-tracked
129 130 M content1_missing_content3-tracked
130 131 $ hg status -A --rev 0 'glob:content1_*_content1-tracked'
131 132 C content1_content1_content1-tracked
132 133 C content1_content2_content1-tracked
133 134 C content1_missing_content1-tracked
134 135 $ hg status -A --rev 0 'glob:missing_*_content?-tracked'
135 136 A missing_content2_content2-tracked
136 137 A missing_content2_content3-tracked
137 138 A missing_missing_content3-tracked
138 139 BROKEN: missing_content2_content[23]-untracked exist, so should be listed
139 140 $ hg status -A --rev 0 'glob:missing_*_content?-untracked'
140 141 ? missing_missing_content3-untracked
141 142 $ hg status -A --rev 0 'glob:content1_*_*-untracked'
142 143 R content1_content1_content1-untracked
143 144 R content1_content1_content3-untracked
144 145 R content1_content1_missing-untracked
145 146 R content1_content2_content1-untracked
146 147 R content1_content2_content2-untracked
147 148 R content1_content2_content3-untracked
148 149 R content1_content2_missing-untracked
149 150 R content1_missing_content1-untracked
150 151 R content1_missing_content3-untracked
151 152 R content1_missing_missing-untracked
152 153 $ hg status -A --rev 0 'glob:*_*_missing-tracked'
153 154 ! content1_content1_missing-tracked
154 155 ! content1_content2_missing-tracked
155 156 ! content1_missing_missing-tracked
156 157 ! missing_content2_missing-tracked
157 158 ! missing_missing_missing-tracked
158 159 $ hg status -A --rev 0 'glob:missing_*_missing-untracked'
@@ -1,26 +1,27 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3
3 4 $ echo a > a
4 5 $ hg ci -Ama
5 6 adding a
6 7
7 8 $ hg an a
8 9 0: a
9 10
10 11 $ hg --config ui.strict=False an a
11 12 0: a
12 13
13 14 $ echo "[ui]" >> $HGRCPATH
14 15 $ echo "strict=True" >> $HGRCPATH
15 16
16 17 $ hg an a
17 18 hg: unknown command 'an'
18 19 (use 'hg help' for a list of commands)
19 20 [10]
20 21 $ hg annotate a
21 22 0: a
22 23
23 24 should succeed - up is an alias, not an abbreviation
24 25
25 26 $ hg up
26 27 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -1,85 +1,86 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3
3 4 $ touch a
4 5 $ hg add a
5 6 $ hg commit -m "Added a"
6 7
7 8 $ touch main
8 9 $ hg add main
9 10 $ hg commit -m "Added main"
10 11 $ hg checkout 0
11 12 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
12 13
13 14 'main' should be gone:
14 15
15 16 $ ls -A
16 17 .hg
17 18 a
18 19
19 20 $ touch side1
20 21 $ hg add side1
21 22 $ hg commit -m "Added side1"
22 23 created new head
23 24 $ touch side2
24 25 $ hg add side2
25 26 $ hg commit -m "Added side2"
26 27
27 28 $ hg log
28 29 changeset: 3:91ebc10ed028
29 30 tag: tip
30 31 user: test
31 32 date: Thu Jan 01 00:00:00 1970 +0000
32 33 summary: Added side2
33 34
34 35 changeset: 2:b932d7dbb1e1
35 36 parent: 0:c2eda428b523
36 37 user: test
37 38 date: Thu Jan 01 00:00:00 1970 +0000
38 39 summary: Added side1
39 40
40 41 changeset: 1:71a760306caf
41 42 user: test
42 43 date: Thu Jan 01 00:00:00 1970 +0000
43 44 summary: Added main
44 45
45 46 changeset: 0:c2eda428b523
46 47 user: test
47 48 date: Thu Jan 01 00:00:00 1970 +0000
48 49 summary: Added a
49 50
50 51
51 52 $ hg heads
52 53 changeset: 3:91ebc10ed028
53 54 tag: tip
54 55 user: test
55 56 date: Thu Jan 01 00:00:00 1970 +0000
56 57 summary: Added side2
57 58
58 59 changeset: 1:71a760306caf
59 60 user: test
60 61 date: Thu Jan 01 00:00:00 1970 +0000
61 62 summary: Added main
62 63
63 64 $ ls -A
64 65 .hg
65 66 a
66 67 side1
67 68 side2
68 69
69 70 $ hg update --debug -C 1
70 71 resolving manifests
71 72 branchmerge: False, force: True, partial: False
72 73 ancestor: 91ebc10ed028+, local: 91ebc10ed028+, remote: 71a760306caf
73 74 side1: other deleted -> r
74 75 removing side1
75 76 side2: other deleted -> r
76 77 removing side2
77 78 main: remote created -> g
78 79 getting main
79 80 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
80 81
81 82 $ ls -A
82 83 .hg
83 84 a
84 85 main
85 86
@@ -1,27 +1,28 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 3 $ touch a
3 4
4 5 $ unset HGUSER
5 6 $ echo "[ui]" >> .hg/hgrc
6 7 $ echo "username= foo" >> .hg/hgrc
7 8 $ echo " bar1" >> .hg/hgrc
8 9
9 10 $ hg ci -Am m
10 11 adding a
11 12 abort: username 'foo\nbar1' contains a newline
12 13
13 14 [255]
14 15 $ rm .hg/hgrc
15 16
16 17 $ HGUSER=`(echo foo; echo bar2)` hg ci -Am m
17 18 adding a
18 19 abort: username 'foo\nbar2' contains a newline
19 20
20 21 [255]
21 22 $ hg ci -Am m -u "`(echo foo; echo bar3)`"
22 23 adding a
23 24 transaction abort!
24 25 rollback completed
25 26 abort: username 'foo\nbar3' contains a newline
26 27 [50]
27 28
General Comments 0
You need to be logged in to leave comments. Login now