##// END OF EJS Templates
update: change default destination to tipmost descendant (issue4673) (BC)...
Pierre-Yves David -
r28065:6b1fc09c default
parent child Browse files
Show More
@@ -1,251 +1,252 b''
1 1 # destutil.py - Mercurial utility function for command destination
2 2 #
3 3 # Copyright Matt Mackall <mpm@selenic.com> and other
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 from __future__ import absolute_import
9 9
10 10 from .i18n import _
11 11 from . import (
12 12 bookmarks,
13 13 error,
14 14 obsolete,
15 15 )
16 16
17 17 def _destupdatevalidate(repo, rev, clean, check):
18 18 """validate that the destination comply to various rules
19 19
20 20 This exists as its own function to help wrapping from extensions."""
21 21 wc = repo[None]
22 22 p1 = wc.p1()
23 23 if not clean:
24 24 # Check that the update is linear.
25 25 #
26 26 # Mercurial do not allow update-merge for non linear pattern
27 27 # (that would be technically possible but was considered too confusing
28 28 # for user a long time ago)
29 29 #
30 30 # See mercurial.merge.update for details
31 31 if p1.rev() not in repo.changelog.ancestors([rev], inclusive=True):
32 32 dirty = wc.dirty(missing=True)
33 33 foreground = obsolete.foreground(repo, [p1.node()])
34 34 if not repo[rev].node() in foreground:
35 35 if dirty:
36 36 msg = _("uncommitted changes")
37 37 hint = _("commit and merge, or update --clean to"
38 38 " discard changes")
39 39 raise error.UpdateAbort(msg, hint=hint)
40 40 elif not check: # destination is not a descendant.
41 41 msg = _("not a linear update")
42 42 hint = _("merge or update --check to force update")
43 43 raise error.UpdateAbort(msg, hint=hint)
44 44
45 45 def _destupdateobs(repo, clean, check):
46 46 """decide of an update destination from obsolescence markers"""
47 47 node = None
48 48 wc = repo[None]
49 49 p1 = wc.p1()
50 50 movemark = None
51 51
52 52 if p1.obsolete() and not p1.children():
53 53 # allow updating to successors
54 54 successors = obsolete.successorssets(repo, p1.node())
55 55
56 56 # behavior of certain cases is as follows,
57 57 #
58 58 # divergent changesets: update to highest rev, similar to what
59 59 # is currently done when there are more than one head
60 60 # (i.e. 'tip')
61 61 #
62 62 # replaced changesets: same as divergent except we know there
63 63 # is no conflict
64 64 #
65 65 # pruned changeset: no update is done; though, we could
66 66 # consider updating to the first non-obsolete parent,
67 67 # similar to what is current done for 'hg prune'
68 68
69 69 if successors:
70 70 # flatten the list here handles both divergent (len > 1)
71 71 # and the usual case (len = 1)
72 72 successors = [n for sub in successors for n in sub]
73 73
74 74 # get the max revision for the given successors set,
75 75 # i.e. the 'tip' of a set
76 76 node = repo.revs('max(%ln)', successors).first()
77 77 if bookmarks.isactivewdirparent(repo):
78 78 movemark = repo['.'].node()
79 79 return node, movemark, None
80 80
81 81 def _destupdatebook(repo, clean, check):
82 82 """decide on an update destination from active bookmark"""
83 83 # we also move the active bookmark, if any
84 84 activemark = None
85 85 node, movemark = bookmarks.calculateupdate(repo.ui, repo, None)
86 86 if node is not None:
87 87 activemark = node
88 88 return node, movemark, activemark
89 89
90 90 def _destupdatebranch(repo, clean, check):
91 91 """decide on an update destination from current branch"""
92 92 wc = repo[None]
93 93 movemark = node = None
94 94 try:
95 node = repo.branchtip(wc.branch())
95 node = repo.revs('max(.::(head() and branch(%s)))'
96 , wc.branch()).first()
96 97 if bookmarks.isactivewdirparent(repo):
97 98 movemark = repo['.'].node()
98 99 except error.RepoLookupError:
99 100 if wc.branch() == 'default': # no default branch!
100 101 node = repo.lookup('tip') # update to tip
101 102 else:
102 103 raise error.Abort(_("branch %s not found") % wc.branch())
103 104 return node, movemark, None
104 105
105 106 # order in which each step should be evalutated
106 107 # steps are run until one finds a destination
107 108 destupdatesteps = ['evolution', 'bookmark', 'branch']
108 109 # mapping to ease extension overriding steps.
109 110 destupdatestepmap = {'evolution': _destupdateobs,
110 111 'bookmark': _destupdatebook,
111 112 'branch': _destupdatebranch,
112 113 }
113 114
114 115 def destupdate(repo, clean=False, check=False):
115 116 """destination for bare update operation
116 117
117 118 return (rev, movemark, activemark)
118 119
119 120 - rev: the revision to update to,
120 121 - movemark: node to move the active bookmark from
121 122 (cf bookmark.calculate update),
122 123 - activemark: a bookmark to activate at the end of the update.
123 124 """
124 125 node = movemark = activemark = None
125 126
126 127 for step in destupdatesteps:
127 128 node, movemark, activemark = destupdatestepmap[step](repo, clean, check)
128 129 if node is not None:
129 130 break
130 131 rev = repo[node].rev()
131 132
132 133 _destupdatevalidate(repo, rev, clean, check)
133 134
134 135 return rev, movemark, activemark
135 136
136 137 def _destmergebook(repo):
137 138 """find merge destination in the active bookmark case"""
138 139 node = None
139 140 bmheads = repo.bookmarkheads(repo._activebookmark)
140 141 curhead = repo[repo._activebookmark].node()
141 142 if len(bmheads) == 2:
142 143 if curhead == bmheads[0]:
143 144 node = bmheads[1]
144 145 else:
145 146 node = bmheads[0]
146 147 elif len(bmheads) > 2:
147 148 raise error.Abort(_("multiple matching bookmarks to merge - "
148 149 "please merge with an explicit rev or bookmark"),
149 150 hint=_("run 'hg heads' to see all heads"))
150 151 elif len(bmheads) <= 1:
151 152 raise error.Abort(_("no matching bookmark to merge - "
152 153 "please merge with an explicit rev or bookmark"),
153 154 hint=_("run 'hg heads' to see all heads"))
154 155 assert node is not None
155 156 return node
156 157
157 158 def _destmergebranch(repo):
158 159 """find merge destination based on branch heads"""
159 160 node = None
160 161 branch = repo[None].branch()
161 162 bheads = repo.branchheads(branch)
162 163 nbhs = [bh for bh in bheads if not repo[bh].bookmarks()]
163 164
164 165 if len(nbhs) > 2:
165 166 raise error.Abort(_("branch '%s' has %d heads - "
166 167 "please merge with an explicit rev")
167 168 % (branch, len(bheads)),
168 169 hint=_("run 'hg heads .' to see heads"))
169 170
170 171 parent = repo.dirstate.p1()
171 172 if len(nbhs) <= 1:
172 173 if len(bheads) > 1:
173 174 raise error.Abort(_("heads are bookmarked - "
174 175 "please merge with an explicit rev"),
175 176 hint=_("run 'hg heads' to see all heads"))
176 177 if len(repo.heads()) > 1:
177 178 raise error.Abort(_("branch '%s' has one head - "
178 179 "please merge with an explicit rev")
179 180 % branch,
180 181 hint=_("run 'hg heads' to see all heads"))
181 182 msg, hint = _('nothing to merge'), None
182 183 if parent != repo.lookup(branch):
183 184 hint = _("use 'hg update' instead")
184 185 raise error.Abort(msg, hint=hint)
185 186
186 187 if parent not in bheads:
187 188 raise error.Abort(_('working directory not at a head revision'),
188 189 hint=_("use 'hg update' or merge with an "
189 190 "explicit revision"))
190 191 if parent == nbhs[0]:
191 192 node = nbhs[-1]
192 193 else:
193 194 node = nbhs[0]
194 195 assert node is not None
195 196 return node
196 197
197 198 def destmerge(repo):
198 199 if repo._activebookmark:
199 200 node = _destmergebook(repo)
200 201 else:
201 202 node = _destmergebranch(repo)
202 203 return repo[node].rev()
203 204
204 205 histeditdefaultrevset = 'reverse(only(.) and not public() and not ::merge())'
205 206
206 207 def desthistedit(ui, repo):
207 208 """Default base revision to edit for `hg histedit`."""
208 209 # Avoid cycle: scmutil -> revset -> destutil
209 210 from . import scmutil
210 211
211 212 default = ui.config('histedit', 'defaultrev', histeditdefaultrevset)
212 213 if default:
213 214 revs = scmutil.revrange(repo, [default])
214 215 if revs:
215 216 # The revset supplied by the user may not be in ascending order nor
216 217 # take the first revision. So do this manually.
217 218 revs.sort()
218 219 return revs.first()
219 220
220 221 return None
221 222
222 223 def _statusotherbook(ui, repo):
223 224 bmheads = repo.bookmarkheads(repo._activebookmark)
224 225 curhead = repo[repo._activebookmark].node()
225 226 if repo.revs('%n and parents()', curhead):
226 227 # we are on the active bookmark
227 228 bmheads = [b for b in bmheads if curhead != b]
228 229 if bmheads:
229 230 msg = _('%i other divergent bookmarks for "%s"\n')
230 231 ui.status(msg % (len(bmheads), repo._activebookmark))
231 232
232 233 def _statusotherbranchheads(ui, repo):
233 234 currentbranch = repo.dirstate.branch()
234 235 heads = repo.branchheads(currentbranch)
235 236 l = len(heads)
236 237 if repo.revs('%ln and parents()', heads):
237 238 # we are on a head
238 239 heads = repo.revs('%ln - parents()', heads)
239 240 if heads and l != len(heads):
240 241 ui.status(_('%i other heads for branch "%s"\n') %
241 242 (len(heads), currentbranch))
242 243
243 244 def statusotherdests(ui, repo):
244 245 """Print message about other head"""
245 246 # XXX we should probably include a hint:
246 247 # - about what to do
247 248 # - how to see such heads
248 249 if repo._activebookmark:
249 250 _statusotherbook(ui, repo)
250 251 else:
251 252 _statusotherbranchheads(ui, repo)
@@ -1,871 +1,848 b''
1 1 $ hg init
2 2
3 3 no bookmarks
4 4
5 5 $ hg bookmarks
6 6 no bookmarks set
7 7
8 8 $ hg bookmarks -Tjson
9 9 [
10 10 ]
11 11
12 12 bookmark rev -1
13 13
14 14 $ hg bookmark X
15 15
16 16 list bookmarks
17 17
18 18 $ hg bookmarks
19 19 * X -1:000000000000
20 20
21 21 list bookmarks with color
22 22
23 23 $ hg --config extensions.color= --config color.mode=ansi \
24 24 > bookmarks --color=always
25 25 \x1b[0;32m * \x1b[0m\x1b[0;32mX\x1b[0m\x1b[0;32m -1:000000000000\x1b[0m (esc)
26 26
27 27 $ echo a > a
28 28 $ hg add a
29 29 $ hg commit -m 0
30 30
31 31 bookmark X moved to rev 0
32 32
33 33 $ hg bookmarks
34 34 * X 0:f7b1eb17ad24
35 35
36 36 look up bookmark
37 37
38 38 $ hg log -r X
39 39 changeset: 0:f7b1eb17ad24
40 40 bookmark: X
41 41 tag: tip
42 42 user: test
43 43 date: Thu Jan 01 00:00:00 1970 +0000
44 44 summary: 0
45 45
46 46
47 47 second bookmark for rev 0, command should work even with ui.strict on
48 48
49 49 $ hg --config ui.strict=1 bookmark X2
50 50
51 51 bookmark rev -1 again
52 52
53 53 $ hg bookmark -r null Y
54 54
55 55 list bookmarks
56 56
57 57 $ hg bookmarks
58 58 X 0:f7b1eb17ad24
59 59 * X2 0:f7b1eb17ad24
60 60 Y -1:000000000000
61 61
62 62 $ echo b > b
63 63 $ hg add b
64 64 $ hg commit -m 1
65 65
66 66 $ hg bookmarks -Tjson
67 67 [
68 68 {
69 69 "active": false,
70 70 "bookmark": "X",
71 71 "node": "f7b1eb17ad24730a1651fccd46c43826d1bbc2ac",
72 72 "rev": 0
73 73 },
74 74 {
75 75 "active": true,
76 76 "bookmark": "X2",
77 77 "node": "925d80f479bb026b0fb3deb27503780b13f74123",
78 78 "rev": 1
79 79 },
80 80 {
81 81 "active": false,
82 82 "bookmark": "Y",
83 83 "node": "0000000000000000000000000000000000000000",
84 84 "rev": -1
85 85 }
86 86 ]
87 87
88 88 bookmarks revset
89 89
90 90 $ hg log -r 'bookmark()'
91 91 changeset: 0:f7b1eb17ad24
92 92 bookmark: X
93 93 user: test
94 94 date: Thu Jan 01 00:00:00 1970 +0000
95 95 summary: 0
96 96
97 97 changeset: 1:925d80f479bb
98 98 bookmark: X2
99 99 tag: tip
100 100 user: test
101 101 date: Thu Jan 01 00:00:00 1970 +0000
102 102 summary: 1
103 103
104 104 $ hg log -r 'bookmark(Y)'
105 105 $ hg log -r 'bookmark(X2)'
106 106 changeset: 1:925d80f479bb
107 107 bookmark: X2
108 108 tag: tip
109 109 user: test
110 110 date: Thu Jan 01 00:00:00 1970 +0000
111 111 summary: 1
112 112
113 113 $ hg log -r 'bookmark("re:X")'
114 114 changeset: 0:f7b1eb17ad24
115 115 bookmark: X
116 116 user: test
117 117 date: Thu Jan 01 00:00:00 1970 +0000
118 118 summary: 0
119 119
120 120 changeset: 1:925d80f479bb
121 121 bookmark: X2
122 122 tag: tip
123 123 user: test
124 124 date: Thu Jan 01 00:00:00 1970 +0000
125 125 summary: 1
126 126
127 127 $ hg log -r 'bookmark("literal:X")'
128 128 changeset: 0:f7b1eb17ad24
129 129 bookmark: X
130 130 user: test
131 131 date: Thu Jan 01 00:00:00 1970 +0000
132 132 summary: 0
133 133
134 134
135 135 $ hg log -r 'bookmark(unknown)'
136 136 abort: bookmark 'unknown' does not exist!
137 137 [255]
138 138 $ hg log -r 'bookmark("literal:unknown")'
139 139 abort: bookmark 'unknown' does not exist!
140 140 [255]
141 141 $ hg log -r 'bookmark("re:unknown")'
142 142 abort: no bookmarks exist that match 'unknown'!
143 143 [255]
144 144 $ hg log -r 'present(bookmark("literal:unknown"))'
145 145 $ hg log -r 'present(bookmark("re:unknown"))'
146 146
147 147 $ hg help revsets | grep 'bookmark('
148 148 "bookmark([name])"
149 149
150 150 bookmarks X and X2 moved to rev 1, Y at rev -1
151 151
152 152 $ hg bookmarks
153 153 X 0:f7b1eb17ad24
154 154 * X2 1:925d80f479bb
155 155 Y -1:000000000000
156 156
157 157 bookmark rev 0 again
158 158
159 159 $ hg bookmark -r 0 Z
160 160
161 161 $ hg update X
162 162 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
163 163 (activating bookmark X)
164 164 $ echo c > c
165 165 $ hg add c
166 166 $ hg commit -m 2
167 167 created new head
168 168
169 169 bookmarks X moved to rev 2, Y at rev -1, Z at rev 0
170 170
171 171 $ hg bookmarks
172 172 * X 2:db815d6d32e6
173 173 X2 1:925d80f479bb
174 174 Y -1:000000000000
175 175 Z 0:f7b1eb17ad24
176 176
177 177 rename nonexistent bookmark
178 178
179 179 $ hg bookmark -m A B
180 180 abort: bookmark 'A' does not exist
181 181 [255]
182 182
183 183 rename to existent bookmark
184 184
185 185 $ hg bookmark -m X Y
186 186 abort: bookmark 'Y' already exists (use -f to force)
187 187 [255]
188 188
189 189 force rename to existent bookmark
190 190
191 191 $ hg bookmark -f -m X Y
192 192
193 193 list bookmarks
194 194
195 195 $ hg bookmark
196 196 X2 1:925d80f479bb
197 197 * Y 2:db815d6d32e6
198 198 Z 0:f7b1eb17ad24
199 199
200 200 bookmarks from a revset
201 201 $ hg bookmark -r '.^1' REVSET
202 202 $ hg bookmark -r ':tip' TIP
203 203 $ hg up -q TIP
204 204 $ hg bookmarks
205 205 REVSET 0:f7b1eb17ad24
206 206 * TIP 2:db815d6d32e6
207 207 X2 1:925d80f479bb
208 208 Y 2:db815d6d32e6
209 209 Z 0:f7b1eb17ad24
210 210
211 211 $ hg bookmark -d REVSET
212 212 $ hg bookmark -d TIP
213 213
214 214 rename without new name or multiple names
215 215
216 216 $ hg bookmark -m Y
217 217 abort: new bookmark name required
218 218 [255]
219 219 $ hg bookmark -m Y Y2 Y3
220 220 abort: only one new bookmark name allowed
221 221 [255]
222 222
223 223 delete without name
224 224
225 225 $ hg bookmark -d
226 226 abort: bookmark name required
227 227 [255]
228 228
229 229 delete nonexistent bookmark
230 230
231 231 $ hg bookmark -d A
232 232 abort: bookmark 'A' does not exist
233 233 [255]
234 234
235 235 bookmark name with spaces should be stripped
236 236
237 237 $ hg bookmark ' x y '
238 238
239 239 list bookmarks
240 240
241 241 $ hg bookmarks
242 242 X2 1:925d80f479bb
243 243 Y 2:db815d6d32e6
244 244 Z 0:f7b1eb17ad24
245 245 * x y 2:db815d6d32e6
246 246
247 247 look up stripped bookmark name
248 248
249 249 $ hg log -r '"x y"'
250 250 changeset: 2:db815d6d32e6
251 251 bookmark: Y
252 252 bookmark: x y
253 253 tag: tip
254 254 parent: 0:f7b1eb17ad24
255 255 user: test
256 256 date: Thu Jan 01 00:00:00 1970 +0000
257 257 summary: 2
258 258
259 259
260 260 reject bookmark name with newline
261 261
262 262 $ hg bookmark '
263 263 > '
264 264 abort: bookmark names cannot consist entirely of whitespace
265 265 [255]
266 266
267 267 $ hg bookmark -m Z '
268 268 > '
269 269 abort: bookmark names cannot consist entirely of whitespace
270 270 [255]
271 271
272 272 bookmark with reserved name
273 273
274 274 $ hg bookmark tip
275 275 abort: the name 'tip' is reserved
276 276 [255]
277 277
278 278 $ hg bookmark .
279 279 abort: the name '.' is reserved
280 280 [255]
281 281
282 282 $ hg bookmark null
283 283 abort: the name 'null' is reserved
284 284 [255]
285 285
286 286
287 287 bookmark with existing name
288 288
289 289 $ hg bookmark X2
290 290 abort: bookmark 'X2' already exists (use -f to force)
291 291 [255]
292 292
293 293 $ hg bookmark -m Y Z
294 294 abort: bookmark 'Z' already exists (use -f to force)
295 295 [255]
296 296
297 297 bookmark with name of branch
298 298
299 299 $ hg bookmark default
300 300 abort: a bookmark cannot have the name of an existing branch
301 301 [255]
302 302
303 303 $ hg bookmark -m Y default
304 304 abort: a bookmark cannot have the name of an existing branch
305 305 [255]
306 306
307 307 bookmark with integer name
308 308
309 309 $ hg bookmark 10
310 310 abort: cannot use an integer as a name
311 311 [255]
312 312
313 313 incompatible options
314 314
315 315 $ hg bookmark -m Y -d Z
316 316 abort: --delete and --rename are incompatible
317 317 [255]
318 318
319 319 $ hg bookmark -r 1 -d Z
320 320 abort: --rev is incompatible with --delete
321 321 [255]
322 322
323 323 $ hg bookmark -r 1 -m Z Y
324 324 abort: --rev is incompatible with --rename
325 325 [255]
326 326
327 327 force bookmark with existing name
328 328
329 329 $ hg bookmark -f X2
330 330
331 331 force bookmark back to where it was, should deactivate it
332 332
333 333 $ hg bookmark -fr1 X2
334 334 $ hg bookmarks
335 335 X2 1:925d80f479bb
336 336 Y 2:db815d6d32e6
337 337 Z 0:f7b1eb17ad24
338 338 x y 2:db815d6d32e6
339 339
340 340 forward bookmark to descendant without --force
341 341
342 342 $ hg bookmark Z
343 343 moving bookmark 'Z' forward from f7b1eb17ad24
344 344
345 345 list bookmarks
346 346
347 347 $ hg bookmark
348 348 X2 1:925d80f479bb
349 349 Y 2:db815d6d32e6
350 350 * Z 2:db815d6d32e6
351 351 x y 2:db815d6d32e6
352 352
353 353 revision but no bookmark name
354 354
355 355 $ hg bookmark -r .
356 356 abort: bookmark name required
357 357 [255]
358 358
359 359 bookmark name with whitespace only
360 360
361 361 $ hg bookmark ' '
362 362 abort: bookmark names cannot consist entirely of whitespace
363 363 [255]
364 364
365 365 $ hg bookmark -m Y ' '
366 366 abort: bookmark names cannot consist entirely of whitespace
367 367 [255]
368 368
369 369 invalid bookmark
370 370
371 371 $ hg bookmark 'foo:bar'
372 372 abort: ':' cannot be used in a name
373 373 [255]
374 374
375 375 $ hg bookmark 'foo
376 376 > bar'
377 377 abort: '\n' cannot be used in a name
378 378 [255]
379 379
380 380 the bookmark extension should be ignored now that it is part of core
381 381
382 382 $ echo "[extensions]" >> $HGRCPATH
383 383 $ echo "bookmarks=" >> $HGRCPATH
384 384 $ hg bookmarks
385 385 X2 1:925d80f479bb
386 386 Y 2:db815d6d32e6
387 387 * Z 2:db815d6d32e6
388 388 x y 2:db815d6d32e6
389 389
390 390 test summary
391 391
392 392 $ hg summary
393 393 parent: 2:db815d6d32e6 tip
394 394 2
395 395 branch: default
396 396 bookmarks: *Z Y x y
397 397 commit: (clean)
398 398 update: 1 new changesets, 2 branch heads (merge)
399 399 phases: 3 draft
400 400
401 401 test id
402 402
403 403 $ hg id
404 404 db815d6d32e6 tip Y/Z/x y
405 405
406 406 test rollback
407 407
408 408 $ echo foo > f1
409 409 $ hg bookmark tmp-rollback
410 410 $ hg ci -Amr
411 411 adding f1
412 412 $ hg bookmarks
413 413 X2 1:925d80f479bb
414 414 Y 2:db815d6d32e6
415 415 Z 2:db815d6d32e6
416 416 * tmp-rollback 3:2bf5cfec5864
417 417 x y 2:db815d6d32e6
418 418 $ hg rollback
419 419 repository tip rolled back to revision 2 (undo commit)
420 420 working directory now based on revision 2
421 421 $ hg bookmarks
422 422 X2 1:925d80f479bb
423 423 Y 2:db815d6d32e6
424 424 Z 2:db815d6d32e6
425 425 * tmp-rollback 2:db815d6d32e6
426 426 x y 2:db815d6d32e6
427 427 $ hg bookmark -f Z -r 1
428 428 $ hg rollback
429 429 repository tip rolled back to revision 2 (undo bookmark)
430 430 $ hg bookmarks
431 431 X2 1:925d80f479bb
432 432 Y 2:db815d6d32e6
433 433 Z 2:db815d6d32e6
434 434 * tmp-rollback 2:db815d6d32e6
435 435 x y 2:db815d6d32e6
436 436 $ hg bookmark -d tmp-rollback
437 437
438 438 activate bookmark on working dir parent without --force
439 439
440 440 $ hg bookmark --inactive Z
441 441 $ hg bookmark Z
442 442
443 443 test clone
444 444
445 445 $ hg bookmark -r 2 -i @
446 446 $ hg bookmark -r 2 -i a@
447 447 $ hg bookmarks
448 448 @ 2:db815d6d32e6
449 449 X2 1:925d80f479bb
450 450 Y 2:db815d6d32e6
451 451 * Z 2:db815d6d32e6
452 452 a@ 2:db815d6d32e6
453 453 x y 2:db815d6d32e6
454 454 $ hg clone . cloned-bookmarks
455 455 updating to bookmark @
456 456 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
457 457 $ hg -R cloned-bookmarks bookmarks
458 458 * @ 2:db815d6d32e6
459 459 X2 1:925d80f479bb
460 460 Y 2:db815d6d32e6
461 461 Z 2:db815d6d32e6
462 462 a@ 2:db815d6d32e6
463 463 x y 2:db815d6d32e6
464 464
465 465 test clone with pull protocol
466 466
467 467 $ hg clone --pull . cloned-bookmarks-pull
468 468 requesting all changes
469 469 adding changesets
470 470 adding manifests
471 471 adding file changes
472 472 added 3 changesets with 3 changes to 3 files (+1 heads)
473 473 updating to bookmark @
474 474 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
475 475 $ hg -R cloned-bookmarks-pull bookmarks
476 476 * @ 2:db815d6d32e6
477 477 X2 1:925d80f479bb
478 478 Y 2:db815d6d32e6
479 479 Z 2:db815d6d32e6
480 480 a@ 2:db815d6d32e6
481 481 x y 2:db815d6d32e6
482 482
483 483 delete multiple bookmarks at once
484 484
485 485 $ hg bookmark -d @ a@
486 486
487 487 test clone with a bookmark named "default" (issue3677)
488 488
489 489 $ hg bookmark -r 1 -f -i default
490 490 $ hg clone . cloned-bookmark-default
491 491 updating to branch default
492 492 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
493 493 $ hg -R cloned-bookmark-default bookmarks
494 494 X2 1:925d80f479bb
495 495 Y 2:db815d6d32e6
496 496 Z 2:db815d6d32e6
497 497 default 1:925d80f479bb
498 498 x y 2:db815d6d32e6
499 499 $ hg -R cloned-bookmark-default parents -q
500 500 2:db815d6d32e6
501 501 $ hg bookmark -d default
502 502
503 503 test clone with a specific revision
504 504
505 505 $ hg clone -r 925d80 . cloned-bookmarks-rev
506 506 adding changesets
507 507 adding manifests
508 508 adding file changes
509 509 added 2 changesets with 2 changes to 2 files
510 510 updating to branch default
511 511 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
512 512 $ hg -R cloned-bookmarks-rev bookmarks
513 513 X2 1:925d80f479bb
514 514
515 515 test clone with update to a bookmark
516 516
517 517 $ hg clone -u Z . ../cloned-bookmarks-update
518 518 updating to branch default
519 519 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
520 520 $ hg -R ../cloned-bookmarks-update bookmarks
521 521 X2 1:925d80f479bb
522 522 Y 2:db815d6d32e6
523 523 * Z 2:db815d6d32e6
524 524 x y 2:db815d6d32e6
525 525
526 526 create bundle with two heads
527 527
528 528 $ hg clone . tobundle
529 529 updating to branch default
530 530 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
531 531 $ echo x > tobundle/x
532 532 $ hg -R tobundle add tobundle/x
533 533 $ hg -R tobundle commit -m'x'
534 534 $ hg -R tobundle update -r -2
535 535 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
536 536 $ echo y > tobundle/y
537 537 $ hg -R tobundle branch test
538 538 marked working directory as branch test
539 539 (branches are permanent and global, did you want a bookmark?)
540 540 $ hg -R tobundle add tobundle/y
541 541 $ hg -R tobundle commit -m'y'
542 542 $ hg -R tobundle bundle tobundle.hg
543 543 searching for changes
544 544 2 changesets found
545 545 $ hg unbundle tobundle.hg
546 546 adding changesets
547 547 adding manifests
548 548 adding file changes
549 549 added 2 changesets with 2 changes to 2 files (+1 heads)
550 550 (run 'hg heads' to see heads, 'hg merge' to merge)
551 551
552 552 update to active bookmark if it's not the parent
553 553
554 554 $ hg summary
555 555 parent: 2:db815d6d32e6
556 556 2
557 557 branch: default
558 558 bookmarks: *Z Y x y
559 559 commit: 1 added, 1 unknown (new branch head)
560 560 update: 2 new changesets (update)
561 561 phases: 5 draft
562 562 $ hg update
563 563 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
564 564 updating bookmark Z
565 565 $ hg bookmarks
566 566 X2 1:925d80f479bb
567 567 Y 2:db815d6d32e6
568 568 * Z 3:125c9a1d6df6
569 569 x y 2:db815d6d32e6
570 570
571 571 pull --update works the same as pull && update
572 572
573 573 $ hg bookmark -r3 Y
574 574 moving bookmark 'Y' forward from db815d6d32e6
575 575 $ cp -r ../cloned-bookmarks-update ../cloned-bookmarks-manual-update
576 576 $ cp -r ../cloned-bookmarks-update ../cloned-bookmarks-manual-update-with-divergence
577 577
578 578 (manual version)
579 579
580 580 $ hg -R ../cloned-bookmarks-manual-update update Y
581 581 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
582 582 (activating bookmark Y)
583 583 $ hg -R ../cloned-bookmarks-manual-update pull .
584 584 pulling from .
585 585 searching for changes
586 586 adding changesets
587 587 adding manifests
588 588 adding file changes
589 589 added 2 changesets with 2 changes to 2 files (+1 heads)
590 590 updating bookmark Y
591 591 updating bookmark Z
592 592 (run 'hg heads' to see heads, 'hg merge' to merge)
593 593
594 594 (# tests strange but with --date crashing when bookmark have to move)
595 595
596 596 $ hg -R ../cloned-bookmarks-manual-update update -d 1986
597 597 abort: revision matching date not found
598 598 [255]
599 599 $ hg -R ../cloned-bookmarks-manual-update update
600 600 updating to active bookmark Y
601 601 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
602 602 (activating bookmark Y)
603 603
604 604 (all in one version)
605 605
606 606 $ hg -R ../cloned-bookmarks-update update Y
607 607 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
608 608 (activating bookmark Y)
609 609 $ hg -R ../cloned-bookmarks-update pull --update .
610 610 pulling from .
611 611 searching for changes
612 612 adding changesets
613 613 adding manifests
614 614 adding file changes
615 615 added 2 changesets with 2 changes to 2 files (+1 heads)
616 616 updating bookmark Y
617 617 updating bookmark Z
618 618 updating to active bookmark Y
619 619 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
620 620
621 621 We warn about divergent during bare update to the active bookmark
622 622
623 623 $ hg -R ../cloned-bookmarks-manual-update-with-divergence update Y
624 624 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
625 625 (activating bookmark Y)
626 626 $ hg -R ../cloned-bookmarks-manual-update-with-divergence bookmarks -r X2 Y@1
627 627 $ hg -R ../cloned-bookmarks-manual-update-with-divergence bookmarks
628 628 X2 1:925d80f479bb
629 629 * Y 2:db815d6d32e6
630 630 Y@1 1:925d80f479bb
631 631 Z 2:db815d6d32e6
632 632 x y 2:db815d6d32e6
633 633 $ hg -R ../cloned-bookmarks-manual-update-with-divergence pull
634 634 pulling from $TESTTMP
635 635 searching for changes
636 636 adding changesets
637 637 adding manifests
638 638 adding file changes
639 639 added 2 changesets with 2 changes to 2 files (+1 heads)
640 640 updating bookmark Y
641 641 updating bookmark Z
642 642 (run 'hg heads' to see heads, 'hg merge' to merge)
643 643 $ hg -R ../cloned-bookmarks-manual-update-with-divergence update
644 644 updating to active bookmark Y
645 645 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
646 646 (activating bookmark Y)
647 647 1 other divergent bookmarks for "Y"
648 648
649 649 test wrongly formated bookmark
650 650
651 651 $ echo '' >> .hg/bookmarks
652 652 $ hg bookmarks
653 653 X2 1:925d80f479bb
654 654 Y 3:125c9a1d6df6
655 655 * Z 3:125c9a1d6df6
656 656 x y 2:db815d6d32e6
657 657 $ echo "Ican'thasformatedlines" >> .hg/bookmarks
658 658 $ hg bookmarks
659 659 malformed line in .hg/bookmarks: "Ican'thasformatedlines"
660 660 X2 1:925d80f479bb
661 661 Y 3:125c9a1d6df6
662 662 * Z 3:125c9a1d6df6
663 663 x y 2:db815d6d32e6
664 664
665 665 test missing revisions
666 666
667 667 $ echo "925d80f479bc z" > .hg/bookmarks
668 668 $ hg book
669 669 no bookmarks set
670 670
671 671 test stripping a non-checked-out but bookmarked revision
672 672
673 673 $ hg log --graph
674 674 o changeset: 4:9ba5f110a0b3
675 675 | branch: test
676 676 | tag: tip
677 677 | parent: 2:db815d6d32e6
678 678 | user: test
679 679 | date: Thu Jan 01 00:00:00 1970 +0000
680 680 | summary: y
681 681 |
682 682 | @ changeset: 3:125c9a1d6df6
683 683 |/ user: test
684 684 | date: Thu Jan 01 00:00:00 1970 +0000
685 685 | summary: x
686 686 |
687 687 o changeset: 2:db815d6d32e6
688 688 | parent: 0:f7b1eb17ad24
689 689 | user: test
690 690 | date: Thu Jan 01 00:00:00 1970 +0000
691 691 | summary: 2
692 692 |
693 693 | o changeset: 1:925d80f479bb
694 694 |/ user: test
695 695 | date: Thu Jan 01 00:00:00 1970 +0000
696 696 | summary: 1
697 697 |
698 698 o changeset: 0:f7b1eb17ad24
699 699 user: test
700 700 date: Thu Jan 01 00:00:00 1970 +0000
701 701 summary: 0
702 702
703 703 $ hg book should-end-on-two
704 704 $ hg co --clean 4
705 705 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
706 706 (leaving bookmark should-end-on-two)
707 707 $ hg book four
708 708 $ hg --config extensions.mq= strip 3
709 709 saved backup bundle to * (glob)
710 710 should-end-on-two should end up pointing to revision 2, as that's the
711 711 tipmost surviving ancestor of the stripped revision.
712 712 $ hg log --graph
713 713 @ changeset: 3:9ba5f110a0b3
714 714 | branch: test
715 715 | bookmark: four
716 716 | tag: tip
717 717 | user: test
718 718 | date: Thu Jan 01 00:00:00 1970 +0000
719 719 | summary: y
720 720 |
721 721 o changeset: 2:db815d6d32e6
722 722 | bookmark: should-end-on-two
723 723 | parent: 0:f7b1eb17ad24
724 724 | user: test
725 725 | date: Thu Jan 01 00:00:00 1970 +0000
726 726 | summary: 2
727 727 |
728 728 | o changeset: 1:925d80f479bb
729 729 |/ user: test
730 730 | date: Thu Jan 01 00:00:00 1970 +0000
731 731 | summary: 1
732 732 |
733 733 o changeset: 0:f7b1eb17ad24
734 734 user: test
735 735 date: Thu Jan 01 00:00:00 1970 +0000
736 736 summary: 0
737 737
738 test non-linear update not clearing active bookmark
739
740 $ hg up 1
741 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
742 (leaving bookmark four)
743 $ hg book drop
744 $ hg up -C
745 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
746 (leaving bookmark drop)
747 1 other heads for branch "default"
748 $ hg sum
749 parent: 2:db815d6d32e6
750 2
751 branch: default
752 bookmarks: should-end-on-two
753 commit: 2 unknown (clean)
754 update: 1 new changesets, 2 branch heads (merge)
755 phases: 4 draft
756 $ hg book
757 drop 1:925d80f479bb
758 four 3:9ba5f110a0b3
759 should-end-on-two 2:db815d6d32e6
760 $ hg book -d drop
761 $ hg up four
762 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
763 (activating bookmark four)
764 738
765 739 no-op update doesn't deactive bookmarks
766 740
741 $ hg up four
742 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
743 (activating bookmark four)
767 744 $ hg up
768 745 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
769 746 $ hg sum
770 747 parent: 3:9ba5f110a0b3 tip
771 748 y
772 749 branch: test
773 750 bookmarks: *four
774 751 commit: 2 unknown (clean)
775 752 update: (current)
776 753 phases: 4 draft
777 754
778 755 test clearing divergent bookmarks of linear ancestors
779 756
780 757 $ hg bookmark Z -r 0
781 758 $ hg bookmark Z@1 -r 1
782 759 $ hg bookmark Z@2 -r 2
783 760 $ hg bookmark Z@3 -r 3
784 761 $ hg book
785 762 Z 0:f7b1eb17ad24
786 763 Z@1 1:925d80f479bb
787 764 Z@2 2:db815d6d32e6
788 765 Z@3 3:9ba5f110a0b3
789 766 * four 3:9ba5f110a0b3
790 767 should-end-on-two 2:db815d6d32e6
791 768 $ hg bookmark Z
792 769 moving bookmark 'Z' forward from f7b1eb17ad24
793 770 $ hg book
794 771 * Z 3:9ba5f110a0b3
795 772 Z@1 1:925d80f479bb
796 773 four 3:9ba5f110a0b3
797 774 should-end-on-two 2:db815d6d32e6
798 775
799 776 test clearing only a single divergent bookmark across branches
800 777
801 778 $ hg book foo -r 1
802 779 $ hg book foo@1 -r 0
803 780 $ hg book foo@2 -r 2
804 781 $ hg book foo@3 -r 3
805 782 $ hg book foo -r foo@3
806 783 $ hg book
807 784 * Z 3:9ba5f110a0b3
808 785 Z@1 1:925d80f479bb
809 786 foo 3:9ba5f110a0b3
810 787 foo@1 0:f7b1eb17ad24
811 788 foo@2 2:db815d6d32e6
812 789 four 3:9ba5f110a0b3
813 790 should-end-on-two 2:db815d6d32e6
814 791
815 792 pull --update works the same as pull && update (case #2)
816 793
817 794 It is assumed that "hg pull" itself doesn't update current active
818 795 bookmark ('Y' in tests below).
819 796
820 797 $ hg pull -q ../cloned-bookmarks-update
821 798 divergent bookmark Z stored as Z@2
822 799
823 800 (pulling revision on another named branch with --update updates
824 801 neither the working directory nor current active bookmark: "no-op"
825 802 case)
826 803
827 804 $ echo yy >> y
828 805 $ hg commit -m yy
829 806
830 807 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
831 808 * Y 3:125c9a1d6df6
832 809 $ hg -R ../cloned-bookmarks-update pull . --update
833 810 pulling from .
834 811 searching for changes
835 812 adding changesets
836 813 adding manifests
837 814 adding file changes
838 815 added 1 changesets with 1 changes to 1 files
839 816 divergent bookmark Z stored as Z@default
840 817 adding remote bookmark foo
841 818 adding remote bookmark four
842 819 adding remote bookmark should-end-on-two
843 820 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
844 821 $ hg -R ../cloned-bookmarks-update parents -T "{rev}:{node|short}\n"
845 822 3:125c9a1d6df6
846 823 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
847 824 * Y 3:125c9a1d6df6
848 825
849 826 (pulling revision on current named/topological branch with --update
850 827 updates the working directory and current active bookmark)
851 828
852 829 $ hg update -C -q 125c9a1d6df6
853 830 $ echo xx >> x
854 831 $ hg commit -m xx
855 832
856 833 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
857 834 * Y 3:125c9a1d6df6
858 835 $ hg -R ../cloned-bookmarks-update pull . --update
859 836 pulling from .
860 837 searching for changes
861 838 adding changesets
862 839 adding manifests
863 840 adding file changes
864 841 added 1 changesets with 1 changes to 1 files
865 842 divergent bookmark Z stored as Z@default
866 843 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
867 844 updating bookmark Y
868 845 $ hg -R ../cloned-bookmarks-update parents -T "{rev}:{node|short}\n"
869 846 6:81dcce76aa0b
870 847 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
871 848 * Y 6:81dcce76aa0b
@@ -1,238 +1,238 b''
1 1 Create user cache directory
2 2
3 3 $ USERCACHE=`pwd`/cache; export USERCACHE
4 4 $ cat <<EOF >> ${HGRCPATH}
5 5 > [extensions]
6 6 > hgext.largefiles=
7 7 > [largefiles]
8 8 > usercache=${USERCACHE}
9 9 > EOF
10 10 $ mkdir -p ${USERCACHE}
11 11
12 12 Create source repo, and commit adding largefile.
13 13
14 14 $ hg init src
15 15 $ cd src
16 16 $ echo large > large
17 17 $ hg add --large large
18 18 $ hg commit -m 'add largefile'
19 19 $ hg rm large
20 20 $ hg commit -m 'branchhead without largefile' large
21 21 $ hg up -qr 0
22 22 $ rm large
23 23 $ echo "0000000000000000000000000000000000000000" > .hglf/large
24 24 $ hg commit -m 'commit missing file with corrupt standin' large
25 25 abort: large: file not found!
26 26 [255]
27 27 $ hg up -Cqr 0
28 28 $ cd ..
29 29
30 30 Discard all cached largefiles in USERCACHE
31 31
32 32 $ rm -rf ${USERCACHE}
33 33
34 34 Create mirror repo, and pull from source without largefile:
35 35 "pull" is used instead of "clone" for suppression of (1) updating to
36 36 tip (= caching largefile from source repo), and (2) recording source
37 37 repo as "default" path in .hg/hgrc.
38 38
39 39 $ hg init mirror
40 40 $ cd mirror
41 41 $ hg pull ../src
42 42 pulling from ../src
43 43 requesting all changes
44 44 adding changesets
45 45 adding manifests
46 46 adding file changes
47 47 added 2 changesets with 1 changes to 1 files
48 48 (run 'hg update' to get a working copy)
49 49
50 50 Update working directory to "tip", which requires largefile("large"),
51 51 but there is no cache file for it. So, hg must treat it as
52 52 "missing"(!) file.
53 53
54 54 $ hg update -r0
55 55 getting changed largefiles
56 56 large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file:/*/$TESTTMP/mirror (glob)
57 57 0 largefiles updated, 0 removed
58 58 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
59 59 $ hg status
60 60 ! large
61 61
62 62 Update working directory to null: this cleanup .hg/largefiles/dirstate
63 63
64 64 $ hg update null
65 65 getting changed largefiles
66 66 0 largefiles updated, 0 removed
67 67 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
68 68
69 69 Update working directory to tip, again.
70 70
71 71 $ hg update -r0
72 72 getting changed largefiles
73 73 large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file:/*/$TESTTMP/mirror (glob)
74 74 0 largefiles updated, 0 removed
75 75 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
76 76 $ hg status
77 77 ! large
78 78 $ cd ..
79 79
80 80 Verify that largefiles from pulled branchheads are fetched, also to an empty repo
81 81
82 82 $ hg init mirror2
83 83 $ hg -R mirror2 pull src -r0
84 84 pulling from src
85 85 adding changesets
86 86 adding manifests
87 87 adding file changes
88 88 added 1 changesets with 1 changes to 1 files
89 89 (run 'hg update' to get a working copy)
90 90
91 91 #if unix-permissions
92 92
93 93 Portable way to print file permissions:
94 94
95 95 $ cat > ls-l.py <<EOF
96 96 > #!/usr/bin/env python
97 97 > import sys, os
98 98 > path = sys.argv[1]
99 99 > print '%03o' % (os.lstat(path).st_mode & 0777)
100 100 > EOF
101 101 $ chmod +x ls-l.py
102 102
103 103 Test that files in .hg/largefiles inherit mode from .hg/store, not
104 104 from file in working copy:
105 105
106 106 $ cd src
107 107 $ chmod 750 .hg/store
108 108 $ chmod 660 large
109 109 $ echo change >> large
110 110 $ hg commit -m change
111 111 created new head
112 112 $ ../ls-l.py .hg/largefiles/e151b474069de4ca6898f67ce2f2a7263adf8fea
113 113 640
114 114
115 115 Test permission of with files in .hg/largefiles created by update:
116 116
117 117 $ cd ../mirror
118 118 $ rm -r "$USERCACHE" .hg/largefiles # avoid links
119 119 $ chmod 750 .hg/store
120 120 $ hg pull ../src --update -q
121 121 $ ../ls-l.py .hg/largefiles/e151b474069de4ca6898f67ce2f2a7263adf8fea
122 122 640
123 123
124 124 Test permission of files created by push:
125 125
126 126 $ hg serve -R ../src -d -p $HGPORT --pid-file hg.pid \
127 127 > --config "web.allow_push=*" --config web.push_ssl=no
128 128 $ cat hg.pid >> $DAEMON_PIDS
129 129
130 130 $ echo change >> large
131 131 $ hg commit -m change
132 132
133 133 $ rm -r "$USERCACHE"
134 134
135 135 $ hg push -q http://localhost:$HGPORT/
136 136
137 137 $ ../ls-l.py ../src/.hg/largefiles/b734e14a0971e370408ab9bce8d56d8485e368a9
138 138 640
139 139
140 140 $ cd ..
141 141
142 142 #endif
143 143
144 144 Test issue 4053 (remove --after on a deleted, uncommitted file shouldn't say
145 145 it is missing, but a remove on a nonexistent unknown file still should. Same
146 146 for a forget.)
147 147
148 148 $ cd src
149 149 $ touch x
150 150 $ hg add x
151 151 $ mv x y
152 152 $ hg remove -A x y ENOENT
153 153 ENOENT: * (glob)
154 154 not removing y: file is untracked
155 155 [1]
156 156 $ hg add y
157 157 $ mv y z
158 158 $ hg forget y z ENOENT
159 159 ENOENT: * (glob)
160 160 not removing z: file is already untracked
161 161 [1]
162 162
163 163 Largefiles are accessible from the share's store
164 164 $ cd ..
165 165 $ hg share -q src share_dst --config extensions.share=
166 166 $ hg -R share_dst update -r0
167 167 getting changed largefiles
168 168 1 largefiles updated, 0 removed
169 169 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
170 170
171 171 $ echo modified > share_dst/large
172 172 $ hg -R share_dst ci -m modified
173 173 created new head
174 174
175 175 Only dirstate is in the local store for the share, and the largefile is in the
176 176 share source's local store. Avoid the extra largefiles added in the unix
177 177 conditional above.
178 178 $ hash=`hg -R share_dst cat share_dst/.hglf/large`
179 179 $ echo $hash
180 180 e2fb5f2139d086ded2cb600d5a91a196e76bf020
181 181
182 182 $ find share_dst/.hg/largefiles/* | sort
183 183 share_dst/.hg/largefiles/dirstate
184 184
185 185 $ find src/.hg/largefiles/* | egrep "(dirstate|$hash)" | sort
186 186 src/.hg/largefiles/dirstate
187 187 src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
188 188
189 189 Inject corruption into the largefiles store and see how update handles that:
190 190
191 191 $ cd src
192 $ hg up -qC
192 $ hg up -qC tip
193 193 $ cat large
194 194 modified
195 195 $ rm large
196 196 $ cat .hglf/large
197 197 e2fb5f2139d086ded2cb600d5a91a196e76bf020
198 198 $ mv .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 ..
199 199 $ echo corruption > .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
200 200 $ hg up -C
201 201 getting changed largefiles
202 202 large: data corruption in $TESTTMP/src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 with hash 6a7bb2556144babe3899b25e5428123735bb1e27 (glob)
203 203 0 largefiles updated, 0 removed
204 204 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
205 205 2 other heads for branch "default"
206 206 $ hg st
207 207 ! large
208 208 ? z
209 209 $ rm .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
210 210
211 211 #if serve
212 212
213 213 Test coverage of error handling from putlfile:
214 214
215 215 $ mkdir $TESTTMP/mirrorcache
216 216 $ hg serve -R ../mirror -d -p $HGPORT1 --pid-file hg.pid --config largefiles.usercache=$TESTTMP/mirrorcache
217 217 $ cat hg.pid >> $DAEMON_PIDS
218 218
219 219 $ hg push http://localhost:$HGPORT1 -f --config files.usercache=nocache
220 220 pushing to http://localhost:$HGPORT1/
221 221 searching for changes
222 222 abort: remotestore: could not open file $TESTTMP/src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020: HTTP Error 403: ssl required
223 223 [255]
224 224
225 225 $ rm .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
226 226
227 227 Test coverage of 'missing from store':
228 228
229 229 $ hg serve -R ../mirror -d -p $HGPORT2 --pid-file hg.pid --config largefiles.usercache=$TESTTMP/mirrorcache --config "web.allow_push=*" --config web.push_ssl=no
230 230 $ cat hg.pid >> $DAEMON_PIDS
231 231
232 232 $ hg push http://localhost:$HGPORT2 -f --config largefiles.usercache=nocache
233 233 pushing to http://localhost:$HGPORT2/
234 234 searching for changes
235 235 abort: largefile e2fb5f2139d086ded2cb600d5a91a196e76bf020 missing from store (needs to be uploaded)
236 236 [255]
237 237
238 238 #endif
@@ -1,352 +1,352 b''
1 1 Criss cross merging
2 2
3 3 $ hg init criss-cross
4 4 $ cd criss-cross
5 5 $ echo '0 base' > f1
6 6 $ echo '0 base' > f2
7 7 $ hg ci -Aqm '0 base'
8 8
9 9 $ echo '1 first change' > f1
10 10 $ hg ci -m '1 first change f1'
11 11
12 12 $ hg up -qr0
13 13 $ echo '2 first change' > f2
14 14 $ hg ci -qm '2 first change f2'
15 15
16 16 $ hg merge -qr 1
17 17 $ hg ci -m '3 merge'
18 18
19 19 $ hg up -qr2
20 20 $ hg merge -qr1
21 21 $ hg ci -qm '4 merge'
22 22
23 23 $ echo '5 second change' > f1
24 24 $ hg ci -m '5 second change f1'
25 25
26 26 $ hg up -r3
27 27 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28 28 $ echo '6 second change' > f2
29 29 $ hg ci -m '6 second change f2'
30 30
31 31 $ hg log -G
32 32 @ changeset: 6:3b08d01b0ab5
33 33 | tag: tip
34 34 | parent: 3:cf89f02107e5
35 35 | user: test
36 36 | date: Thu Jan 01 00:00:00 1970 +0000
37 37 | summary: 6 second change f2
38 38 |
39 39 | o changeset: 5:adfe50279922
40 40 | | user: test
41 41 | | date: Thu Jan 01 00:00:00 1970 +0000
42 42 | | summary: 5 second change f1
43 43 | |
44 44 | o changeset: 4:7d3e55501ae6
45 45 | |\ parent: 2:40663881a6dd
46 46 | | | parent: 1:0f6b37dbe527
47 47 | | | user: test
48 48 | | | date: Thu Jan 01 00:00:00 1970 +0000
49 49 | | | summary: 4 merge
50 50 | | |
51 51 o---+ changeset: 3:cf89f02107e5
52 52 | | | parent: 2:40663881a6dd
53 53 |/ / parent: 1:0f6b37dbe527
54 54 | | user: test
55 55 | | date: Thu Jan 01 00:00:00 1970 +0000
56 56 | | summary: 3 merge
57 57 | |
58 58 | o changeset: 2:40663881a6dd
59 59 | | parent: 0:40494bf2444c
60 60 | | user: test
61 61 | | date: Thu Jan 01 00:00:00 1970 +0000
62 62 | | summary: 2 first change f2
63 63 | |
64 64 o | changeset: 1:0f6b37dbe527
65 65 |/ user: test
66 66 | date: Thu Jan 01 00:00:00 1970 +0000
67 67 | summary: 1 first change f1
68 68 |
69 69 o changeset: 0:40494bf2444c
70 70 user: test
71 71 date: Thu Jan 01 00:00:00 1970 +0000
72 72 summary: 0 base
73 73
74 74
75 75 $ hg merge -v --debug --tool internal:dump 5 --config merge.preferancestor='!'
76 76 note: using 0f6b37dbe527 as ancestor of 3b08d01b0ab5 and adfe50279922
77 77 alternatively, use --config merge.preferancestor=40663881a6dd
78 78 searching for copies back to rev 3
79 79 resolving manifests
80 80 branchmerge: True, force: False, partial: False
81 81 ancestor: 0f6b37dbe527, local: 3b08d01b0ab5+, remote: adfe50279922
82 82 preserving f2 for resolve of f2
83 83 f1: remote is newer -> g
84 84 getting f1
85 85 f2: versions differ -> m (premerge)
86 86 picked tool ':dump' for f2 (binary False symlink False changedelete False)
87 87 merging f2
88 88 my f2@3b08d01b0ab5+ other f2@adfe50279922 ancestor f2@0f6b37dbe527
89 89 f2: versions differ -> m (merge)
90 90 picked tool ':dump' for f2 (binary False symlink False changedelete False)
91 91 my f2@3b08d01b0ab5+ other f2@adfe50279922 ancestor f2@0f6b37dbe527
92 92 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
93 93 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
94 94 [1]
95 95
96 96 $ head *
97 97 ==> f1 <==
98 98 5 second change
99 99
100 100 ==> f2 <==
101 101 6 second change
102 102
103 103 ==> f2.base <==
104 104 0 base
105 105
106 106 ==> f2.local <==
107 107 6 second change
108 108
109 109 ==> f2.orig <==
110 110 6 second change
111 111
112 112 ==> f2.other <==
113 113 2 first change
114 114
115 115 $ hg up -qC .
116 116 $ hg merge -v --tool internal:dump 5 --config merge.preferancestor="null 40663881 3b08d"
117 117 note: using 40663881a6dd as ancestor of 3b08d01b0ab5 and adfe50279922
118 118 alternatively, use --config merge.preferancestor=0f6b37dbe527
119 119 resolving manifests
120 120 merging f1
121 121 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
122 122 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
123 123 [1]
124 124
125 125 Redo merge with merge.preferancestor="*" to enable bid merge
126 126
127 127 $ rm f*
128 128 $ hg up -qC .
129 129 $ hg merge -v --debug --tool internal:dump 5 --config merge.preferancestor="*"
130 130 note: merging 3b08d01b0ab5+ and adfe50279922 using bids from ancestors 0f6b37dbe527 and 40663881a6dd
131 131
132 132 calculating bids for ancestor 0f6b37dbe527
133 133 searching for copies back to rev 3
134 134 resolving manifests
135 135 branchmerge: True, force: False, partial: False
136 136 ancestor: 0f6b37dbe527, local: 3b08d01b0ab5+, remote: adfe50279922
137 137 f1: remote is newer -> g
138 138 f2: versions differ -> m
139 139
140 140 calculating bids for ancestor 40663881a6dd
141 141 searching for copies back to rev 3
142 142 resolving manifests
143 143 branchmerge: True, force: False, partial: False
144 144 ancestor: 40663881a6dd, local: 3b08d01b0ab5+, remote: adfe50279922
145 145 f1: versions differ -> m
146 146 f2: remote unchanged -> k
147 147
148 148 auction for merging merge bids
149 149 f1: picking 'get' action
150 150 f2: picking 'keep' action
151 151 end of auction
152 152
153 153 f1: remote is newer -> g
154 154 getting f1
155 155 f2: remote unchanged -> k
156 156 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
157 157 (branch merge, don't forget to commit)
158 158
159 159 $ head *
160 160 ==> f1 <==
161 161 5 second change
162 162
163 163 ==> f2 <==
164 164 6 second change
165 165
166 166
167 167 The other way around:
168 168
169 169 $ hg up -C -r5
170 170 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
171 171 $ hg merge -v --debug --config merge.preferancestor="*"
172 172 note: merging adfe50279922+ and 3b08d01b0ab5 using bids from ancestors 0f6b37dbe527 and 40663881a6dd
173 173
174 174 calculating bids for ancestor 0f6b37dbe527
175 175 searching for copies back to rev 3
176 176 resolving manifests
177 177 branchmerge: True, force: False, partial: False
178 178 ancestor: 0f6b37dbe527, local: adfe50279922+, remote: 3b08d01b0ab5
179 179 f1: remote unchanged -> k
180 180 f2: versions differ -> m
181 181
182 182 calculating bids for ancestor 40663881a6dd
183 183 searching for copies back to rev 3
184 184 resolving manifests
185 185 branchmerge: True, force: False, partial: False
186 186 ancestor: 40663881a6dd, local: adfe50279922+, remote: 3b08d01b0ab5
187 187 f1: versions differ -> m
188 188 f2: remote is newer -> g
189 189
190 190 auction for merging merge bids
191 191 f1: picking 'keep' action
192 192 f2: picking 'get' action
193 193 end of auction
194 194
195 195 f2: remote is newer -> g
196 196 getting f2
197 197 f1: remote unchanged -> k
198 198 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
199 199 (branch merge, don't forget to commit)
200 200
201 201 $ head *
202 202 ==> f1 <==
203 203 5 second change
204 204
205 205 ==> f2 <==
206 206 6 second change
207 207
208 208 Verify how the output looks and and how verbose it is:
209 209
210 210 $ hg up -qC
211 211 $ hg merge
212 212 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
213 213 (branch merge, don't forget to commit)
214 214
215 $ hg up -qC
215 $ hg up -qC tip
216 216 $ hg merge -v
217 217 note: merging 3b08d01b0ab5+ and adfe50279922 using bids from ancestors 0f6b37dbe527 and 40663881a6dd
218 218
219 219 calculating bids for ancestor 0f6b37dbe527
220 220 resolving manifests
221 221
222 222 calculating bids for ancestor 40663881a6dd
223 223 resolving manifests
224 224
225 225 auction for merging merge bids
226 226 f1: picking 'get' action
227 227 f2: picking 'keep' action
228 228 end of auction
229 229
230 230 getting f1
231 231 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
232 232 (branch merge, don't forget to commit)
233 233
234 234 $ hg up -qC
235 235 $ hg merge -v --debug --config merge.preferancestor="*"
236 236 note: merging 3b08d01b0ab5+ and adfe50279922 using bids from ancestors 0f6b37dbe527 and 40663881a6dd
237 237
238 238 calculating bids for ancestor 0f6b37dbe527
239 239 searching for copies back to rev 3
240 240 resolving manifests
241 241 branchmerge: True, force: False, partial: False
242 242 ancestor: 0f6b37dbe527, local: 3b08d01b0ab5+, remote: adfe50279922
243 243 f1: remote is newer -> g
244 244 f2: versions differ -> m
245 245
246 246 calculating bids for ancestor 40663881a6dd
247 247 searching for copies back to rev 3
248 248 resolving manifests
249 249 branchmerge: True, force: False, partial: False
250 250 ancestor: 40663881a6dd, local: 3b08d01b0ab5+, remote: adfe50279922
251 251 f1: versions differ -> m
252 252 f2: remote unchanged -> k
253 253
254 254 auction for merging merge bids
255 255 f1: picking 'get' action
256 256 f2: picking 'keep' action
257 257 end of auction
258 258
259 259 f1: remote is newer -> g
260 260 getting f1
261 261 f2: remote unchanged -> k
262 262 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
263 263 (branch merge, don't forget to commit)
264 264
265 265 $ cd ..
266 266
267 267 http://stackoverflow.com/questions/9350005/how-do-i-specify-a-merge-base-to-use-in-a-hg-merge/9430810
268 268
269 269 $ hg init ancestor-merging
270 270 $ cd ancestor-merging
271 271 $ echo a > x
272 272 $ hg commit -A -m a x
273 273 $ hg update -q 0
274 274 $ echo b >> x
275 275 $ hg commit -m b
276 276 $ hg update -q 0
277 277 $ echo c >> x
278 278 $ hg commit -qm c
279 279 $ hg update -q 1
280 280 $ hg merge -q --tool internal:local 2
281 281 $ echo c >> x
282 282 $ hg commit -m bc
283 283 $ hg update -q 2
284 284 $ hg merge -q --tool internal:local 1
285 285 $ echo b >> x
286 286 $ hg commit -qm cb
287 287
288 288 $ hg merge --config merge.preferancestor='!'
289 289 note: using 70008a2163f6 as ancestor of 0d355fdef312 and 4b8b546a3eef
290 290 alternatively, use --config merge.preferancestor=b211bbc6eb3c
291 291 merging x
292 292 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
293 293 (branch merge, don't forget to commit)
294 294 $ cat x
295 295 a
296 296 c
297 297 b
298 298 c
299 299
300 300 $ hg up -qC .
301 301
302 302 $ hg merge --config merge.preferancestor=b211bbc6eb3c
303 303 note: using b211bbc6eb3c as ancestor of 0d355fdef312 and 4b8b546a3eef
304 304 alternatively, use --config merge.preferancestor=70008a2163f6
305 305 merging x
306 306 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
307 307 (branch merge, don't forget to commit)
308 308 $ cat x
309 309 a
310 310 b
311 311 c
312 312 b
313 313
314 314 $ hg up -qC .
315 315
316 316 $ hg merge -v --config merge.preferancestor="*"
317 317 note: merging 0d355fdef312+ and 4b8b546a3eef using bids from ancestors 70008a2163f6 and b211bbc6eb3c
318 318
319 319 calculating bids for ancestor 70008a2163f6
320 320 resolving manifests
321 321
322 322 calculating bids for ancestor b211bbc6eb3c
323 323 resolving manifests
324 324
325 325 auction for merging merge bids
326 326 x: multiple bids for merge action:
327 327 versions differ -> m
328 328 versions differ -> m
329 329 x: ambiguous merge - picked m action
330 330 end of auction
331 331
332 332 merging x
333 333 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
334 334 (branch merge, don't forget to commit)
335 335 $ cat x
336 336 a
337 337 c
338 338 b
339 339 c
340 340
341 341 Verify that the old context ancestor works with / despite preferancestor:
342 342
343 343 $ hg log -r 'ancestor(head())' --config merge.preferancestor=1 -T '{rev}\n'
344 344 1
345 345 $ hg log -r 'ancestor(head())' --config merge.preferancestor=2 -T '{rev}\n'
346 346 2
347 347 $ hg log -r 'ancestor(head())' --config merge.preferancestor=3 -T '{rev}\n'
348 348 1
349 349 $ hg log -r 'ancestor(head())' --config merge.preferancestor='1337 * - 2' -T '{rev}\n'
350 350 2
351 351
352 352 $ cd ..
@@ -1,41 +1,36 b''
1 1 $ hg init
2 2 $ echo This is file a1 > a
3 3 $ echo This is file b1 > b
4 4 $ hg add a b
5 5 $ hg commit -m "commit #0"
6 6 $ echo This is file b22 > b
7 7 $ hg commit -m "comment #1"
8 8 $ hg update 0
9 9 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
10 10 $ rm b
11 11 $ hg commit -A -m "comment #2"
12 12 removing b
13 13 created new head
14 14 $ hg update 1
15 15 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
16 $ hg update
17 abort: not a linear update
18 (merge or update --check to force update)
19 [255]
20 16 $ rm b
21 $ hg update -c
17 $ hg update -c 2
22 18 abort: uncommitted changes
23 19 [255]
24 20 $ hg revert b
25 $ hg update -c
21 $ hg update -c 2
26 22 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
27 1 other heads for branch "default"
28 23 $ mv a c
29 24
30 25 Should abort:
31 26
32 27 $ hg update 1
33 28 abort: uncommitted changes
34 29 (commit or update --clean to discard changes)
35 30 [255]
36 31 $ mv c a
37 32
38 33 Should succeed:
39 34
40 35 $ hg update 1
41 36 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -1,66 +1,64 b''
1 1 $ hg init t
2 2 $ cd t
3 3 $ echo 1 > foo
4 4 $ hg ci -Am m
5 5 adding foo
6 6
7 7 $ cd ..
8 8 $ hg clone t tt
9 9 updating to branch default
10 10 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
11 11 $ cd tt
12 12 $ echo 1.1 > foo
13 13 $ hg ci -Am m
14 14
15 15 $ cd ../t
16 16 $ echo 1.2 > foo
17 17 $ hg ci -Am m
18 18
19 Should not update:
19 Should not update to the other topological branch:
20 20
21 21 $ hg pull -u ../tt
22 22 pulling from ../tt
23 23 searching for changes
24 24 adding changesets
25 25 adding manifests
26 26 adding file changes
27 27 added 1 changesets with 1 changes to 1 files (+1 heads)
28 abort: not updating: not a linear update
29 (merge or update --check to force update)
30 [255]
28 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 1 other heads for branch "default"
31 30
32 31 $ cd ../tt
33 32
34 Should not update:
33 Should not update to the other branch:
35 34
36 35 $ hg pull -u ../t
37 36 pulling from ../t
38 37 searching for changes
39 38 adding changesets
40 39 adding manifests
41 40 adding file changes
42 41 added 1 changesets with 1 changes to 1 files (+1 heads)
43 abort: not updating: not a linear update
44 (merge or update --check to force update)
45 [255]
42 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 1 other heads for branch "default"
46 44
47 45 $ HGMERGE=true hg merge
48 46 merging foo
49 47 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
50 48 (branch merge, don't forget to commit)
51 49 $ hg ci -mm
52 50
53 51 $ cd ../t
54 52
55 53 Should work:
56 54
57 55 $ hg pull -u ../tt
58 56 pulling from ../tt
59 57 searching for changes
60 58 adding changesets
61 59 adding manifests
62 60 adding file changes
63 61 added 1 changesets with 1 changes to 1 files (-1 heads)
64 62 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
65 63
66 64 $ cd ..
@@ -1,231 +1,230 b''
1 1 $ HGMERGE=true; export HGMERGE
2 2
3 3 $ hg init r1
4 4 $ cd r1
5 5 $ echo a > a
6 6 $ hg addremove
7 7 adding a
8 8 $ hg commit -m "1"
9 9
10 10 $ hg clone . ../r2
11 11 updating to branch default
12 12 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
13 13 $ cd ../r2
14 14 $ hg up
15 15 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
16 16 $ echo abc > a
17 17 $ hg diff --nodates
18 18 diff -r c19d34741b0a a
19 19 --- a/a
20 20 +++ b/a
21 21 @@ -1,1 +1,1 @@
22 22 -a
23 23 +abc
24 24
25 25 $ cd ../r1
26 26 $ echo b > b
27 27 $ echo a2 > a
28 28 $ hg addremove
29 29 adding b
30 30 $ hg commit -m "2"
31 31
32 32 $ cd ../r2
33 33 $ hg -q pull ../r1
34 34 $ hg status
35 35 M a
36 36 $ hg parents
37 37 changeset: 0:c19d34741b0a
38 38 user: test
39 39 date: Thu Jan 01 00:00:00 1970 +0000
40 40 summary: 1
41 41
42 42 $ hg --debug up
43 43 searching for copies back to rev 1
44 44 unmatched files in other:
45 45 b
46 46 resolving manifests
47 47 branchmerge: False, force: False, partial: False
48 48 ancestor: c19d34741b0a, local: c19d34741b0a+, remote: 1e71731e6fbb
49 49 preserving a for resolve of a
50 50 b: remote created -> g
51 51 getting b
52 52 a: versions differ -> m (premerge)
53 53 picked tool 'true' for a (binary False symlink False changedelete False)
54 54 merging a
55 55 my a@c19d34741b0a+ other a@1e71731e6fbb ancestor a@c19d34741b0a
56 56 a: versions differ -> m (merge)
57 57 picked tool 'true' for a (binary False symlink False changedelete False)
58 58 my a@c19d34741b0a+ other a@1e71731e6fbb ancestor a@c19d34741b0a
59 59 launching merge tool: true *$TESTTMP/r2/a* * * (glob)
60 60 merge tool returned: 0
61 61 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
62 62 $ hg parents
63 63 changeset: 1:1e71731e6fbb
64 64 tag: tip
65 65 user: test
66 66 date: Thu Jan 01 00:00:00 1970 +0000
67 67 summary: 2
68 68
69 69 $ hg --debug up 0
70 70 resolving manifests
71 71 branchmerge: False, force: False, partial: False
72 72 ancestor: 1e71731e6fbb, local: 1e71731e6fbb+, remote: c19d34741b0a
73 73 preserving a for resolve of a
74 74 b: other deleted -> r
75 75 removing b
76 76 a: versions differ -> m (premerge)
77 77 picked tool 'true' for a (binary False symlink False changedelete False)
78 78 merging a
79 79 my a@1e71731e6fbb+ other a@c19d34741b0a ancestor a@1e71731e6fbb
80 80 a: versions differ -> m (merge)
81 81 picked tool 'true' for a (binary False symlink False changedelete False)
82 82 my a@1e71731e6fbb+ other a@c19d34741b0a ancestor a@1e71731e6fbb
83 83 launching merge tool: true *$TESTTMP/r2/a* * * (glob)
84 84 merge tool returned: 0
85 85 0 files updated, 1 files merged, 1 files removed, 0 files unresolved
86 86 $ hg parents
87 87 changeset: 0:c19d34741b0a
88 88 user: test
89 89 date: Thu Jan 01 00:00:00 1970 +0000
90 90 summary: 1
91 91
92 92 $ hg parents
93 93 changeset: 0:c19d34741b0a
94 94 user: test
95 95 date: Thu Jan 01 00:00:00 1970 +0000
96 96 summary: 1
97 97
98 98 $ hg --debug up
99 99 searching for copies back to rev 1
100 100 unmatched files in other:
101 101 b
102 102 resolving manifests
103 103 branchmerge: False, force: False, partial: False
104 104 ancestor: c19d34741b0a, local: c19d34741b0a+, remote: 1e71731e6fbb
105 105 preserving a for resolve of a
106 106 b: remote created -> g
107 107 getting b
108 108 a: versions differ -> m (premerge)
109 109 picked tool 'true' for a (binary False symlink False changedelete False)
110 110 merging a
111 111 my a@c19d34741b0a+ other a@1e71731e6fbb ancestor a@c19d34741b0a
112 112 a: versions differ -> m (merge)
113 113 picked tool 'true' for a (binary False symlink False changedelete False)
114 114 my a@c19d34741b0a+ other a@1e71731e6fbb ancestor a@c19d34741b0a
115 115 launching merge tool: true *$TESTTMP/r2/a* * * (glob)
116 116 merge tool returned: 0
117 117 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
118 118 $ hg parents
119 119 changeset: 1:1e71731e6fbb
120 120 tag: tip
121 121 user: test
122 122 date: Thu Jan 01 00:00:00 1970 +0000
123 123 summary: 2
124 124
125 125 $ hg -v history
126 126 changeset: 1:1e71731e6fbb
127 127 tag: tip
128 128 user: test
129 129 date: Thu Jan 01 00:00:00 1970 +0000
130 130 files: a b
131 131 description:
132 132 2
133 133
134 134
135 135 changeset: 0:c19d34741b0a
136 136 user: test
137 137 date: Thu Jan 01 00:00:00 1970 +0000
138 138 files: a
139 139 description:
140 140 1
141 141
142 142
143 143 $ hg diff --nodates
144 144 diff -r 1e71731e6fbb a
145 145 --- a/a
146 146 +++ b/a
147 147 @@ -1,1 +1,1 @@
148 148 -a2
149 149 +abc
150 150
151 151
152 152 create a second head
153 153
154 154 $ cd ../r1
155 155 $ hg up 0
156 156 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
157 157 $ echo b2 > b
158 158 $ echo a3 > a
159 159 $ hg addremove
160 160 adding b
161 161 $ hg commit -m "3"
162 162 created new head
163 163
164 164 $ cd ../r2
165 165 $ hg -q pull ../r1
166 166 $ hg status
167 167 M a
168 168 $ hg parents
169 169 changeset: 1:1e71731e6fbb
170 170 user: test
171 171 date: Thu Jan 01 00:00:00 1970 +0000
172 172 summary: 2
173 173
174 174 $ hg --debug up
175 abort: uncommitted changes
176 (commit and merge, or update --clean to discard changes)
177 [255]
175 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
176 1 other heads for branch "default"
178 177
179 178 test conflicting untracked files
180 179
181 180 $ hg up -qC 0
182 181 $ echo untracked > b
183 182 $ hg st
184 183 ? b
185 184 $ hg up 1
186 185 b: untracked file differs
187 186 abort: untracked files in working directory differ from files in requested revision
188 187 [255]
189 188 $ rm b
190 189
191 190 test conflicting untracked ignored file
192 191
193 192 $ hg up -qC 0
194 193 $ echo ignored > .hgignore
195 194 $ hg add .hgignore
196 195 $ hg ci -m 'add .hgignore'
197 196 created new head
198 197 $ echo ignored > ignored
199 198 $ hg add ignored
200 199 $ hg ci -m 'add ignored file'
201 200
202 201 $ hg up -q 'desc("add .hgignore")'
203 202 $ echo untracked > ignored
204 203 $ hg st
205 204 $ hg up 'desc("add ignored file")'
206 205 ignored: untracked file differs
207 206 abort: untracked files in working directory differ from files in requested revision
208 207 [255]
209 208
210 209 test a local add
211 210
212 211 $ cd ..
213 212 $ hg init a
214 213 $ hg init b
215 214 $ echo a > a/a
216 215 $ echo a > b/a
217 216 $ hg --cwd a commit -A -m a
218 217 adding a
219 218 $ cd b
220 219 $ hg add a
221 220 $ hg pull -u ../a
222 221 pulling from ../a
223 222 requesting all changes
224 223 adding changesets
225 224 adding manifests
226 225 adding file changes
227 226 added 1 changesets with 1 changes to 1 files
228 227 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
229 228 $ hg st
230 229
231 230 $ cd ..
@@ -1,268 +1,268 b''
1 1 # Construct the following history tree:
2 2 #
3 3 # @ 5:e1bb631146ca b1
4 4 # |
5 5 # o 4:a4fdb3b883c4 0:b608b9236435 b1
6 6 # |
7 7 # | o 3:4b57d2520816 1:44592833ba9f
8 8 # | |
9 9 # | | o 2:063f31070f65
10 10 # | |/
11 11 # | o 1:44592833ba9f
12 12 # |/
13 13 # o 0:b608b9236435
14 14
15 15 $ mkdir b1
16 16 $ cd b1
17 17 $ hg init
18 18 $ echo foo > foo
19 19 $ echo zero > a
20 20 $ hg init sub
21 21 $ echo suba > sub/suba
22 22 $ hg --cwd sub ci -Am addsuba
23 23 adding suba
24 24 $ echo 'sub = sub' > .hgsub
25 25 $ hg ci -qAm0
26 26 $ echo one > a ; hg ci -m1
27 27 $ echo two > a ; hg ci -m2
28 28 $ hg up -q 1
29 29 $ echo three > a ; hg ci -qm3
30 30 $ hg up -q 0
31 31 $ hg branch -q b1
32 32 $ echo four > a ; hg ci -qm4
33 33 $ echo five > a ; hg ci -qm5
34 34
35 35 Initial repo state:
36 36
37 37 $ hg log -G --template '{rev}:{node|short} {parents} {branches}\n'
38 38 @ 5:ff252e8273df b1
39 39 |
40 40 o 4:d047485b3896 0:60829823a42a b1
41 41 |
42 42 | o 3:6efa171f091b 1:0786582aa4b1
43 43 | |
44 44 | | o 2:bd10386d478c
45 45 | |/
46 46 | o 1:0786582aa4b1
47 47 |/
48 48 o 0:60829823a42a
49 49
50 50
51 51 Make sure update doesn't assume b1 is a repository if invoked from outside:
52 52
53 53 $ cd ..
54 54 $ hg update b1
55 55 abort: no repository found in '$TESTTMP' (.hg not found)!
56 56 [255]
57 57 $ cd b1
58 58
59 59 Test helper functions:
60 60
61 61 $ revtest () {
62 62 > msg=$1
63 63 > dirtyflag=$2 # 'clean', 'dirty' or 'dirtysub'
64 64 > startrev=$3
65 65 > targetrev=$4
66 66 > opt=$5
67 67 > hg up -qC $startrev
68 68 > test $dirtyflag = dirty && echo dirty > foo
69 69 > test $dirtyflag = dirtysub && echo dirty > sub/suba
70 70 > hg up $opt $targetrev
71 71 > hg parent --template 'parent={rev}\n'
72 72 > hg stat -S
73 73 > }
74 74
75 75 $ norevtest () {
76 76 > msg=$1
77 77 > dirtyflag=$2 # 'clean', 'dirty' or 'dirtysub'
78 78 > startrev=$3
79 79 > opt=$4
80 80 > hg up -qC $startrev
81 81 > test $dirtyflag = dirty && echo dirty > foo
82 82 > test $dirtyflag = dirtysub && echo dirty > sub/suba
83 83 > hg up $opt
84 84 > hg parent --template 'parent={rev}\n'
85 85 > hg stat -S
86 86 > }
87 87
88 88 Test cases are documented in a table in the update function of merge.py.
89 89 Cases are run as shown in that table, row by row.
90 90
91 91 $ norevtest 'none clean linear' clean 4
92 92 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
93 93 parent=5
94 94
95 95 $ norevtest 'none clean same' clean 2
96 abort: not a linear update
97 (merge or update --check to force update)
96 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
97 1 other heads for branch "default"
98 98 parent=2
99 99
100 100
101 101 $ revtest 'none clean linear' clean 1 2
102 102 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
103 103 parent=2
104 104
105 105 $ revtest 'none clean same' clean 2 3
106 106 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
107 107 parent=3
108 108
109 109 $ revtest 'none clean cross' clean 3 4
110 110 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
111 111 parent=4
112 112
113 113
114 114 $ revtest 'none dirty linear' dirty 1 2
115 115 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
116 116 parent=2
117 117 M foo
118 118
119 119 $ revtest 'none dirtysub linear' dirtysub 1 2
120 120 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
121 121 parent=2
122 122 M sub/suba
123 123
124 124 $ revtest 'none dirty same' dirty 2 3
125 125 abort: uncommitted changes
126 126 (commit or update --clean to discard changes)
127 127 parent=2
128 128 M foo
129 129
130 130 $ revtest 'none dirtysub same' dirtysub 2 3
131 131 abort: uncommitted changes
132 132 (commit or update --clean to discard changes)
133 133 parent=2
134 134 M sub/suba
135 135
136 136 $ revtest 'none dirty cross' dirty 3 4
137 137 abort: uncommitted changes
138 138 (commit or update --clean to discard changes)
139 139 parent=3
140 140 M foo
141 141
142 142 $ norevtest 'none dirty cross' dirty 2
143 abort: uncommitted changes
144 (commit and merge, or update --clean to discard changes)
143 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
144 1 other heads for branch "default"
145 145 parent=2
146 146 M foo
147 147
148 148 $ revtest 'none dirtysub cross' dirtysub 3 4
149 149 abort: uncommitted changes
150 150 (commit or update --clean to discard changes)
151 151 parent=3
152 152 M sub/suba
153 153
154 154 $ revtest '-C dirty linear' dirty 1 2 -C
155 155 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
156 156 parent=2
157 157
158 158 $ revtest '-c dirty linear' dirty 1 2 -c
159 159 abort: uncommitted changes
160 160 parent=1
161 161 M foo
162 162
163 163 $ revtest '-c dirtysub linear' dirtysub 1 2 -c
164 164 abort: uncommitted changes in subrepository 'sub'
165 165 parent=1
166 166 M sub/suba
167 167
168 168 $ norevtest '-c clean same' clean 2 -c
169 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
169 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
170 170 1 other heads for branch "default"
171 parent=3
171 parent=2
172 172
173 173 $ revtest '-cC dirty linear' dirty 1 2 -cC
174 174 abort: cannot specify both -c/--check and -C/--clean
175 175 parent=1
176 176 M foo
177 177
178 178 Test obsolescence behavior
179 179 ---------------------------------------------------------------------
180 180
181 181 successors should be taken in account when checking head destination
182 182
183 183 $ cat << EOF >> $HGRCPATH
184 184 > [ui]
185 185 > logtemplate={rev}:{node|short} {desc|firstline}
186 186 > [experimental]
187 187 > evolution=createmarkers
188 188 > EOF
189 189
190 190 Test no-argument update to a successor of an obsoleted changeset
191 191
192 192 $ hg log -G
193 193 o 5:ff252e8273df 5
194 194 |
195 195 o 4:d047485b3896 4
196 196 |
197 197 | o 3:6efa171f091b 3
198 198 | |
199 199 | | o 2:bd10386d478c 2
200 200 | |/
201 201 | @ 1:0786582aa4b1 1
202 202 |/
203 203 o 0:60829823a42a 0
204 204
205 205 $ hg book bm -r 3
206 206 $ hg status
207 207 M foo
208 208
209 209 We add simple obsolescence marker between 3 and 4 (indirect successors)
210 210
211 211 $ hg id --debug -i -r 3
212 212 6efa171f091b00a3c35edc15d48c52a498929953
213 213 $ hg id --debug -i -r 4
214 214 d047485b3896813b2a624e86201983520f003206
215 215 $ hg debugobsolete 6efa171f091b00a3c35edc15d48c52a498929953 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
216 216 $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa d047485b3896813b2a624e86201983520f003206
217 217
218 218 Test that 5 is detected as a valid destination from 3 and also accepts moving
219 219 the bookmark (issue4015)
220 220
221 221 $ hg up --quiet --hidden 3
222 222 $ hg up 5
223 223 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
224 224 $ hg book bm
225 225 moving bookmark 'bm' forward from 6efa171f091b
226 226 $ hg bookmarks
227 227 * bm 5:ff252e8273df
228 228
229 229 Test that 4 is detected as the no-argument destination from 3 and also moves
230 230 the bookmark with it
231 231 $ hg up --quiet 0 # we should be able to update to 3 directly
232 232 $ hg up --quiet --hidden 3 # but not implemented yet.
233 233 $ hg book -f bm
234 234 $ hg up
235 235 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
236 236 updating bookmark bm
237 237 $ hg book
238 238 * bm 4:d047485b3896
239 239
240 240 Test that 5 is detected as a valid destination from 1
241 241 $ hg up --quiet 0 # we should be able to update to 3 directly
242 242 $ hg up --quiet --hidden 3 # but not implemented yet.
243 243 $ hg up 5
244 244 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
245 245
246 246 Test that 5 is not detected as a valid destination from 2
247 247 $ hg up --quiet 0
248 248 $ hg up --quiet 2
249 249 $ hg up 5
250 250 abort: uncommitted changes
251 251 (commit or update --clean to discard changes)
252 252 [255]
253 253
254 254 Test that we don't crash when updating from a pruned changeset (i.e. has no
255 255 successors). Behavior should probably be that we update to the first
256 256 non-obsolete parent but that will be decided later.
257 257 $ hg id --debug -r 2
258 258 bd10386d478cd5a9faf2e604114c8e6da62d3889
259 259 $ hg up --quiet 0
260 260 $ hg up --quiet 2
261 261 $ hg debugobsolete bd10386d478cd5a9faf2e604114c8e6da62d3889
262 262 $ hg up
263 263 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
264 264
265 265 Test experimental revset support
266 266
267 267 $ hg log -r '_destupdate()'
268 268 2:bd10386d478c 2 (no-eol)
General Comments 0
You need to be logged in to leave comments. Login now