##// END OF EJS Templates
bundle: emit full snapshot as is, without doing a redelta...
marmoute -
r50678:e1953a34 default
parent child Browse files
Show More
@@ -1,643 +1,647 b''
1 1 # storageutil.py - Storage functionality agnostic of backend implementation.
2 2 #
3 3 # Copyright 2018 Gregory Szorc <gregory.szorc@gmail.com>
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
9 9 import re
10 10 import struct
11 11
12 12 from ..i18n import _
13 13 from ..node import (
14 14 bin,
15 15 nullrev,
16 16 sha1nodeconstants,
17 17 )
18 18 from .. import (
19 19 dagop,
20 20 error,
21 21 mdiff,
22 22 )
23 23 from ..interfaces import repository
24 24 from ..revlogutils import sidedata as sidedatamod
25 25 from ..utils import hashutil
26 26
27 27 _nullhash = hashutil.sha1(sha1nodeconstants.nullid)
28 28
29 29 # revision data contains extra metadata not part of the official digest
30 30 # Only used in changegroup >= v4.
31 31 CG_FLAG_SIDEDATA = 1
32 32
33 33
34 34 def hashrevisionsha1(text, p1, p2):
35 35 """Compute the SHA-1 for revision data and its parents.
36 36
37 37 This hash combines both the current file contents and its history
38 38 in a manner that makes it easy to distinguish nodes with the same
39 39 content in the revision graph.
40 40 """
41 41 # As of now, if one of the parent node is null, p2 is null
42 42 if p2 == sha1nodeconstants.nullid:
43 43 # deep copy of a hash is faster than creating one
44 44 s = _nullhash.copy()
45 45 s.update(p1)
46 46 else:
47 47 # none of the parent nodes are nullid
48 48 if p1 < p2:
49 49 a = p1
50 50 b = p2
51 51 else:
52 52 a = p2
53 53 b = p1
54 54 s = hashutil.sha1(a)
55 55 s.update(b)
56 56 s.update(text)
57 57 return s.digest()
58 58
59 59
60 60 METADATA_RE = re.compile(b'\x01\n')
61 61
62 62
63 63 def parsemeta(text):
64 64 """Parse metadata header from revision data.
65 65
66 66 Returns a 2-tuple of (metadata, offset), where both can be None if there
67 67 is no metadata.
68 68 """
69 69 # text can be buffer, so we can't use .startswith or .index
70 70 if text[:2] != b'\x01\n':
71 71 return None, None
72 72 s = METADATA_RE.search(text, 2).start()
73 73 mtext = text[2:s]
74 74 meta = {}
75 75 for l in mtext.splitlines():
76 76 k, v = l.split(b': ', 1)
77 77 meta[k] = v
78 78 return meta, s + 2
79 79
80 80
81 81 def packmeta(meta, text):
82 82 """Add metadata to fulltext to produce revision text."""
83 83 keys = sorted(meta)
84 84 metatext = b''.join(b'%s: %s\n' % (k, meta[k]) for k in keys)
85 85 return b'\x01\n%s\x01\n%s' % (metatext, text)
86 86
87 87
88 88 def iscensoredtext(text):
89 89 meta = parsemeta(text)[0]
90 90 return meta and b'censored' in meta
91 91
92 92
93 93 def filtermetadata(text):
94 94 """Extract just the revision data from source text.
95 95
96 96 Returns ``text`` unless it has a metadata header, in which case we return
97 97 a new buffer without hte metadata.
98 98 """
99 99 if not text.startswith(b'\x01\n'):
100 100 return text
101 101
102 102 offset = text.index(b'\x01\n', 2)
103 103 return text[offset + 2 :]
104 104
105 105
106 106 def filerevisioncopied(store, node):
107 107 """Resolve file revision copy metadata.
108 108
109 109 Returns ``False`` if the file has no copy metadata. Otherwise a
110 110 2-tuple of the source filename and node.
111 111 """
112 112 if store.parents(node)[0] != sha1nodeconstants.nullid:
113 113 # When creating a copy or move we set filelog parents to null,
114 114 # because contents are probably unrelated and making a delta
115 115 # would not be useful.
116 116 # Conversely, if filelog p1 is non-null we know
117 117 # there is no copy metadata.
118 118 # In the presence of merges, this reasoning becomes invalid
119 119 # if we reorder parents. See tests/test-issue6528.t.
120 120 return False
121 121
122 122 meta = parsemeta(store.revision(node))[0]
123 123
124 124 # copy and copyrev occur in pairs. In rare cases due to old bugs,
125 125 # one can occur without the other. So ensure both are present to flag
126 126 # as a copy.
127 127 if meta and b'copy' in meta and b'copyrev' in meta:
128 128 return meta[b'copy'], bin(meta[b'copyrev'])
129 129
130 130 return False
131 131
132 132
133 133 def filedataequivalent(store, node, filedata):
134 134 """Determines whether file data is equivalent to a stored node.
135 135
136 136 Returns True if the passed file data would hash to the same value
137 137 as a stored revision and False otherwise.
138 138
139 139 When a stored revision is censored, filedata must be empty to have
140 140 equivalence.
141 141
142 142 When a stored revision has copy metadata, it is ignored as part
143 143 of the compare.
144 144 """
145 145
146 146 if filedata.startswith(b'\x01\n'):
147 147 revisiontext = b'\x01\n\x01\n' + filedata
148 148 else:
149 149 revisiontext = filedata
150 150
151 151 p1, p2 = store.parents(node)
152 152
153 153 computednode = hashrevisionsha1(revisiontext, p1, p2)
154 154
155 155 if computednode == node:
156 156 return True
157 157
158 158 # Censored files compare against the empty file.
159 159 if store.iscensored(store.rev(node)):
160 160 return filedata == b''
161 161
162 162 # Renaming a file produces a different hash, even if the data
163 163 # remains unchanged. Check if that's the case.
164 164 if store.renamed(node):
165 165 return store.read(node) == filedata
166 166
167 167 return False
168 168
169 169
170 170 def iterrevs(storelen, start=0, stop=None):
171 171 """Iterate over revision numbers in a store."""
172 172 step = 1
173 173
174 174 if stop is not None:
175 175 if start > stop:
176 176 step = -1
177 177 stop += step
178 178 if stop > storelen:
179 179 stop = storelen
180 180 else:
181 181 stop = storelen
182 182
183 183 return range(start, stop, step)
184 184
185 185
186 186 def fileidlookup(store, fileid, identifier):
187 187 """Resolve the file node for a value.
188 188
189 189 ``store`` is an object implementing the ``ifileindex`` interface.
190 190
191 191 ``fileid`` can be:
192 192
193 193 * A 20 or 32 byte binary node.
194 194 * An integer revision number
195 195 * A 40 or 64 byte hex node.
196 196 * A bytes that can be parsed as an integer representing a revision number.
197 197
198 198 ``identifier`` is used to populate ``error.LookupError`` with an identifier
199 199 for the store.
200 200
201 201 Raises ``error.LookupError`` on failure.
202 202 """
203 203 if isinstance(fileid, int):
204 204 try:
205 205 return store.node(fileid)
206 206 except IndexError:
207 207 raise error.LookupError(
208 208 b'%d' % fileid, identifier, _(b'no match found')
209 209 )
210 210
211 211 if len(fileid) in (20, 32):
212 212 try:
213 213 store.rev(fileid)
214 214 return fileid
215 215 except error.LookupError:
216 216 pass
217 217
218 218 if len(fileid) in (40, 64):
219 219 try:
220 220 rawnode = bin(fileid)
221 221 store.rev(rawnode)
222 222 return rawnode
223 223 except TypeError:
224 224 pass
225 225
226 226 try:
227 227 rev = int(fileid)
228 228
229 229 if b'%d' % rev != fileid:
230 230 raise ValueError
231 231
232 232 try:
233 233 return store.node(rev)
234 234 except (IndexError, TypeError):
235 235 pass
236 236 except (ValueError, OverflowError):
237 237 pass
238 238
239 239 raise error.LookupError(fileid, identifier, _(b'no match found'))
240 240
241 241
242 242 def resolvestripinfo(minlinkrev, tiprev, headrevs, linkrevfn, parentrevsfn):
243 243 """Resolve information needed to strip revisions.
244 244
245 245 Finds the minimum revision number that must be stripped in order to
246 246 strip ``minlinkrev``.
247 247
248 248 Returns a 2-tuple of the minimum revision number to do that and a set
249 249 of all revision numbers that have linkrevs that would be broken
250 250 by that strip.
251 251
252 252 ``tiprev`` is the current tip-most revision. It is ``len(store) - 1``.
253 253 ``headrevs`` is an iterable of head revisions.
254 254 ``linkrevfn`` is a callable that receives a revision and returns a linked
255 255 revision.
256 256 ``parentrevsfn`` is a callable that receives a revision number and returns
257 257 an iterable of its parent revision numbers.
258 258 """
259 259 brokenrevs = set()
260 260 strippoint = tiprev + 1
261 261
262 262 heads = {}
263 263 futurelargelinkrevs = set()
264 264 for head in headrevs:
265 265 headlinkrev = linkrevfn(head)
266 266 heads[head] = headlinkrev
267 267 if headlinkrev >= minlinkrev:
268 268 futurelargelinkrevs.add(headlinkrev)
269 269
270 270 # This algorithm involves walking down the rev graph, starting at the
271 271 # heads. Since the revs are topologically sorted according to linkrev,
272 272 # once all head linkrevs are below the minlink, we know there are
273 273 # no more revs that could have a linkrev greater than minlink.
274 274 # So we can stop walking.
275 275 while futurelargelinkrevs:
276 276 strippoint -= 1
277 277 linkrev = heads.pop(strippoint)
278 278
279 279 if linkrev < minlinkrev:
280 280 brokenrevs.add(strippoint)
281 281 else:
282 282 futurelargelinkrevs.remove(linkrev)
283 283
284 284 for p in parentrevsfn(strippoint):
285 285 if p != nullrev:
286 286 plinkrev = linkrevfn(p)
287 287 heads[p] = plinkrev
288 288 if plinkrev >= minlinkrev:
289 289 futurelargelinkrevs.add(plinkrev)
290 290
291 291 return strippoint, brokenrevs
292 292
293 293
294 294 def emitrevisions(
295 295 store,
296 296 nodes,
297 297 nodesorder,
298 298 resultcls,
299 299 deltaparentfn=None,
300 300 candeltafn=None,
301 301 rawsizefn=None,
302 302 revdifffn=None,
303 303 flagsfn=None,
304 304 deltamode=repository.CG_DELTAMODE_STD,
305 305 revisiondata=False,
306 306 assumehaveparentrevisions=False,
307 307 sidedata_helpers=None,
308 308 debug_info=None,
309 309 ):
310 310 """Generic implementation of ifiledata.emitrevisions().
311 311
312 312 Emitting revision data is subtly complex. This function attempts to
313 313 encapsulate all the logic for doing so in a backend-agnostic way.
314 314
315 315 ``store``
316 316 Object conforming to ``ifilestorage`` interface.
317 317
318 318 ``nodes``
319 319 List of revision nodes whose data to emit.
320 320
321 321 ``resultcls``
322 322 A type implementing the ``irevisiondelta`` interface that will be
323 323 constructed and returned.
324 324
325 325 ``deltaparentfn`` (optional)
326 326 Callable receiving a revision number and returning the revision number
327 327 of a revision that the internal delta is stored against. This delta
328 328 will be preferred over computing a new arbitrary delta.
329 329
330 330 If not defined, a delta will always be computed from raw revision
331 331 data.
332 332
333 333 ``candeltafn`` (optional)
334 334 Callable receiving a pair of revision numbers that returns a bool
335 335 indicating whether a delta between them can be produced.
336 336
337 337 If not defined, it is assumed that any two revisions can delta with
338 338 each other.
339 339
340 340 ``rawsizefn`` (optional)
341 341 Callable receiving a revision number and returning the length of the
342 342 ``store.rawdata(rev)``.
343 343
344 344 If not defined, ``len(store.rawdata(rev))`` will be called.
345 345
346 346 ``revdifffn`` (optional)
347 347 Callable receiving a pair of revision numbers that returns a delta
348 348 between them.
349 349
350 350 If not defined, a delta will be computed by invoking mdiff code
351 351 on ``store.revision()`` results.
352 352
353 353 Defining this function allows a precomputed or stored delta to be
354 354 used without having to compute on.
355 355
356 356 ``flagsfn`` (optional)
357 357 Callable receiving a revision number and returns the integer flags
358 358 value for it. If not defined, flags value will be 0.
359 359
360 360 ``deltamode``
361 361 constaint on delta to be sent:
362 362 * CG_DELTAMODE_STD - normal mode, try to reuse storage deltas,
363 363 * CG_DELTAMODE_PREV - only delta against "prev",
364 364 * CG_DELTAMODE_FULL - only issue full snapshot.
365 365
366 366 Whether to send fulltext revisions instead of deltas, if allowed.
367 367
368 368 ``nodesorder``
369 369 ``revisiondata``
370 370 ``assumehaveparentrevisions``
371 371 ``sidedata_helpers`` (optional)
372 372 If not None, means that sidedata should be included.
373 373 See `revlogutil.sidedata.get_sidedata_helpers`.
374 374
375 375 ``debug_info`
376 376 An optionnal dictionnary to gather information about the bundling
377 377 process (if present, see config: debug.bundling.stats.
378 378 """
379 379
380 380 fnode = store.node
381 381 frev = store.rev
382 382 parents = store.parentrevs
383 383
384 384 if nodesorder == b'nodes':
385 385 revs = [frev(n) for n in nodes]
386 386 elif nodesorder == b'linear':
387 387 revs = {frev(n) for n in nodes}
388 388 revs = dagop.linearize(revs, store.parentrevs)
389 389 else: # storage and default
390 390 revs = sorted(frev(n) for n in nodes)
391 391
392 392 prevrev = None
393 393
394 394 if deltamode == repository.CG_DELTAMODE_PREV or assumehaveparentrevisions:
395 395 prevrev = parents(revs[0])[0]
396 396
397 397 # Sets of revs available to delta against.
398 398 emitted = set()
399 399 available = set()
400 400 if assumehaveparentrevisions:
401 401 common_heads = set(p for r in revs for p in parents(r))
402 402 common_heads.difference_update(revs)
403 403 available = store.ancestors(common_heads, inclusive=True)
404 404
405 405 def is_usable_base(rev):
406 406 """Is a delta against this revision usable over the wire"""
407 407 if rev == nullrev:
408 408 return False
409 409 return rev in emitted or rev in available
410 410
411 411 for rev in revs:
412 412 if rev == nullrev:
413 413 continue
414 414
415 415 debug_delta_source = None
416 416 if debug_info is not None:
417 417 debug_info['revision-total'] += 1
418 418
419 419 node = fnode(rev)
420 420 p1rev, p2rev = parents(rev)
421 421
422 422 if debug_info is not None:
423 423 if p1rev != p2rev and p1rev != nullrev and p2rev != nullrev:
424 424 debug_info['merge-total'] += 1
425 425
426 426 if deltaparentfn:
427 427 deltaparentrev = deltaparentfn(rev)
428 428 if debug_info is not None:
429 429 if deltaparentrev == nullrev:
430 430 debug_info['available-full'] += 1
431 431 else:
432 432 debug_info['available-delta'] += 1
433 433
434 434 else:
435 435 deltaparentrev = nullrev
436 436
437 437 # Forced delta against previous mode.
438 438 if deltamode == repository.CG_DELTAMODE_PREV:
439 439 if debug_info is not None:
440 440 debug_delta_source = "prev"
441 441 baserev = prevrev
442 442
443 443 # We're instructed to send fulltext. Honor that.
444 444 elif deltamode == repository.CG_DELTAMODE_FULL:
445 445 if debug_info is not None:
446 446 debug_delta_source = "full"
447 447 baserev = nullrev
448 448 # We're instructed to use p1. Honor that
449 449 elif deltamode == repository.CG_DELTAMODE_P1:
450 450 if debug_info is not None:
451 451 debug_delta_source = "p1"
452 452 baserev = p1rev
453 453
454 454 # There is a delta in storage. We try to use that because it
455 455 # amounts to effectively copying data from storage and is
456 456 # therefore the fastest.
457 457 elif is_usable_base(deltaparentrev):
458 458 if debug_info is not None:
459 459 debug_delta_source = "storage"
460 460 baserev = deltaparentrev
461 elif deltaparentrev == nullrev:
462 if debug_info is not None:
463 debug_delta_source = "storage"
464 baserev = deltaparentrev
461 465 else:
462 466 if deltaparentrev != nullrev and debug_info is not None:
463 467 debug_info['denied-base-not-available'] += 1
464 468 # No guarantee the receiver has the delta parent, or Storage has a
465 469 # fulltext revision.
466 470 #
467 471 # We compute a delta on the fly to send over the wire.
468 472 #
469 473 # We start with a try against p1, which in the common case should
470 474 # be close to this revision content.
471 475 #
472 476 # note: we could optimize between p1 and p2 in merges cases.
473 477 elif is_usable_base(p1rev):
474 478 if debug_info is not None:
475 479 debug_delta_source = "p1"
476 480 baserev = p1rev
477 481 # if p1 was not an option, try p2
478 482 elif is_usable_base(p2rev):
479 483 if debug_info is not None:
480 484 debug_delta_source = "p2"
481 485 baserev = p2rev
482 486 # Send delta against prev in despair
483 487 #
484 488 # using the closest available ancestors first might be better?
485 489 elif prevrev is not None:
486 490 if debug_info is not None:
487 491 debug_delta_source = "prev"
488 492 baserev = prevrev
489 493 else:
490 494 if debug_info is not None:
491 495 debug_delta_source = "full"
492 496 baserev = nullrev
493 497
494 498 # But we can't actually use our chosen delta base for whatever
495 499 # reason. Reset to fulltext.
496 500 if (
497 501 baserev != nullrev
498 502 and candeltafn is not None
499 503 and not candeltafn(baserev, rev)
500 504 ):
501 505 if debug_info is not None:
502 506 debug_delta_source = "full"
503 507 debug_info['denied-delta-candeltafn'] += 1
504 508 baserev = nullrev
505 509
506 510 revision = None
507 511 delta = None
508 512 baserevisionsize = None
509 513
510 514 if revisiondata:
511 515 if store.iscensored(baserev) or store.iscensored(rev):
512 516 try:
513 517 revision = store.rawdata(node)
514 518 except error.CensoredNodeError as e:
515 519 if debug_info is not None:
516 520 debug_delta_source = "full"
517 521 debug_info['denied-delta-not-available'] += 1
518 522 revision = e.tombstone
519 523
520 524 if baserev != nullrev:
521 525 if rawsizefn:
522 526 baserevisionsize = rawsizefn(baserev)
523 527 else:
524 528 baserevisionsize = len(store.rawdata(baserev))
525 529
526 530 elif (
527 531 baserev == nullrev and deltamode != repository.CG_DELTAMODE_PREV
528 532 ):
529 533 if debug_info is not None:
530 534 debug_info['computed-delta'] += 1 # close enough
531 535 debug_info['delta-full'] += 1
532 536 revision = store.rawdata(node)
533 537 emitted.add(rev)
534 538 else:
535 539 if revdifffn:
536 540 if debug_info is not None:
537 541 if debug_delta_source == "full":
538 542 debug_info['computed-delta'] += 1
539 543 debug_info['delta-full'] += 1
540 544 elif debug_delta_source == "prev":
541 545 debug_info['computed-delta'] += 1
542 546 debug_info['delta-against-prev'] += 1
543 547 elif debug_delta_source == "p1":
544 548 debug_info['computed-delta'] += 1
545 549 debug_info['delta-against-p1'] += 1
546 550 elif debug_delta_source == "storage":
547 551 debug_info['reused-storage-delta'] += 1
548 552 else:
549 553 assert False, 'unreachable'
550 554
551 555 delta = revdifffn(baserev, rev)
552 556 else:
553 557 if debug_info is not None:
554 558 if debug_delta_source == "full":
555 559 debug_info['computed-delta'] += 1
556 560 debug_info['delta-full'] += 1
557 561 elif debug_delta_source == "prev":
558 562 debug_info['computed-delta'] += 1
559 563 debug_info['delta-against-prev'] += 1
560 564 elif debug_delta_source == "p1":
561 565 debug_info['computed-delta'] += 1
562 566 debug_info['delta-against-p1'] += 1
563 567 elif debug_delta_source == "storage":
564 568 # seem quite unlikelry to happens
565 569 debug_info['computed-delta'] += 1
566 570 debug_info['reused-storage-delta'] += 1
567 571 else:
568 572 assert False, 'unreachable'
569 573 delta = mdiff.textdiff(
570 574 store.rawdata(baserev), store.rawdata(rev)
571 575 )
572 576
573 577 emitted.add(rev)
574 578
575 579 serialized_sidedata = None
576 580 sidedata_flags = (0, 0)
577 581 if sidedata_helpers:
578 582 try:
579 583 old_sidedata = store.sidedata(rev)
580 584 except error.CensoredNodeError:
581 585 # skip any potential sidedata of the censored revision
582 586 sidedata = {}
583 587 else:
584 588 sidedata, sidedata_flags = sidedatamod.run_sidedata_helpers(
585 589 store=store,
586 590 sidedata_helpers=sidedata_helpers,
587 591 sidedata=old_sidedata,
588 592 rev=rev,
589 593 )
590 594 if sidedata:
591 595 serialized_sidedata = sidedatamod.serialize_sidedata(sidedata)
592 596
593 597 flags = flagsfn(rev) if flagsfn else 0
594 598 protocol_flags = 0
595 599 if serialized_sidedata:
596 600 # Advertise that sidedata exists to the other side
597 601 protocol_flags |= CG_FLAG_SIDEDATA
598 602 # Computers and removers can return flags to add and/or remove
599 603 flags = flags | sidedata_flags[0] & ~sidedata_flags[1]
600 604
601 605 yield resultcls(
602 606 node=node,
603 607 p1node=fnode(p1rev),
604 608 p2node=fnode(p2rev),
605 609 basenode=fnode(baserev),
606 610 flags=flags,
607 611 baserevisionsize=baserevisionsize,
608 612 revision=revision,
609 613 delta=delta,
610 614 sidedata=serialized_sidedata,
611 615 protocol_flags=protocol_flags,
612 616 )
613 617
614 618 prevrev = rev
615 619
616 620
617 621 def deltaiscensored(delta, baserev, baselenfn):
618 622 """Determine if a delta represents censored revision data.
619 623
620 624 ``baserev`` is the base revision this delta is encoded against.
621 625 ``baselenfn`` is a callable receiving a revision number that resolves the
622 626 length of the revision fulltext.
623 627
624 628 Returns a bool indicating if the result of the delta represents a censored
625 629 revision.
626 630 """
627 631 # Fragile heuristic: unless new file meta keys are added alphabetically
628 632 # preceding "censored", all censored revisions are prefixed by
629 633 # "\1\ncensored:". A delta producing such a censored revision must be a
630 634 # full-replacement delta, so we inspect the first and only patch in the
631 635 # delta for this prefix.
632 636 hlen = struct.calcsize(b">lll")
633 637 if len(delta) <= hlen:
634 638 return False
635 639
636 640 oldlen = baselenfn(baserev)
637 641 newlen = len(delta) - hlen
638 642 if delta[:hlen] != mdiff.replacediffheader(oldlen, newlen):
639 643 return False
640 644
641 645 add = b"\1\ncensored:"
642 646 addlen = len(add)
643 647 return newlen >= addlen and delta[hlen : hlen + addlen] == add
@@ -1,1331 +1,1331 b''
1 1 $ hg init repo
2 2 $ cd repo
3 3
4 4 Setup:
5 5
6 6 $ echo a >> a
7 7 $ hg ci -Am 'base'
8 8 adding a
9 9
10 10 Refuse to amend public csets:
11 11
12 12 $ hg phase -r . -p
13 13 $ hg ci --amend
14 14 abort: cannot amend public changesets: ad120869acf0
15 15 (see 'hg help phases' for details)
16 16 [10]
17 17 $ hg phase -r . -f -d
18 18
19 19 $ echo a >> a
20 20 $ hg ci -Am 'base1'
21 21
22 22 Nothing to amend:
23 23
24 24 $ hg ci --amend -m 'base1'
25 25 nothing changed
26 26 [1]
27 27
28 28 $ cat >> $HGRCPATH <<EOF
29 29 > [hooks]
30 30 > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE"
31 31 > EOF
32 32
33 33 Amending changeset with changes in working dir:
34 34 (and check that --message does not trigger an editor)
35 35
36 36 $ echo a >> a
37 37 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1'
38 38 pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149
39 39 43f1ba15f28a tip
40 40 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/489edb5b847d-5ab4f721-amend.hg
41 41 $ echo 'pretxncommit.foo = ' >> $HGRCPATH
42 42 $ hg diff -c .
43 43 diff -r ad120869acf0 -r 43f1ba15f28a a
44 44 --- a/a Thu Jan 01 00:00:00 1970 +0000
45 45 +++ b/a Thu Jan 01 00:00:00 1970 +0000
46 46 @@ -1,1 +1,3 @@
47 47 a
48 48 +a
49 49 +a
50 50 $ hg log
51 51 changeset: 1:43f1ba15f28a
52 52 tag: tip
53 53 user: test
54 54 date: Thu Jan 01 00:00:00 1970 +0000
55 55 summary: amend base1
56 56
57 57 changeset: 0:ad120869acf0
58 58 user: test
59 59 date: Thu Jan 01 00:00:00 1970 +0000
60 60 summary: base
61 61
62 62
63 63 Check proper abort for empty message
64 64
65 65 $ cat > editor.sh << '__EOF__'
66 66 > #!/bin/sh
67 67 > echo "" > "$1"
68 68 > __EOF__
69 69
70 70 Update the existing file to ensure that the dirstate is not in pending state
71 71 (where the status of some files in the working copy is not known yet). This in
72 72 turn ensures that when the transaction is aborted due to an empty message during
73 73 the amend, there should be no rollback.
74 74 $ echo a >> a
75 75
76 76 $ echo b > b
77 77 $ hg add b
78 78 $ hg summary
79 79 parent: 1:43f1ba15f28a tip
80 80 amend base1
81 81 branch: default
82 82 commit: 1 modified, 1 added, 1 unknown
83 83 update: (current)
84 84 phases: 2 draft
85 85 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
86 86 abort: empty commit message
87 87 [10]
88 88 $ hg summary
89 89 parent: 1:43f1ba15f28a tip
90 90 amend base1
91 91 branch: default
92 92 commit: 1 modified, 1 added, 1 unknown
93 93 update: (current)
94 94 phases: 2 draft
95 95
96 96 Add new file along with modified existing file:
97 97 $ hg ci --amend -m 'amend base1 new file'
98 98 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/43f1ba15f28a-007467c2-amend.hg
99 99
100 100 Remove file that was added in amended commit:
101 101 (and test logfile option)
102 102 (and test that logfile option do not trigger an editor)
103 103
104 104 $ hg rm b
105 105 $ echo 'amend base1 remove new file' > ../logfile
106 106 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile
107 107 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/c16295aaf401-1ada9901-amend.hg
108 108
109 109 $ hg cat b
110 110 b: no such file in rev 47343646fa3d
111 111 [1]
112 112
113 113 No changes, just a different message:
114 114
115 115 $ hg ci -v --amend -m 'no changes, new message'
116 116 amending changeset 47343646fa3d
117 117 copying changeset 47343646fa3d to ad120869acf0
118 118 committing files:
119 119 a
120 120 committing manifest
121 121 committing changelog
122 122 1 changesets found
123 123 uncompressed size of bundle content:
124 124 254 (changelog)
125 125 163 (manifests)
126 131 a
126 133 a
127 127 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/47343646fa3d-c2758885-amend.hg
128 128 1 changesets found
129 129 uncompressed size of bundle content:
130 130 250 (changelog)
131 131 163 (manifests)
132 131 a
132 133 a
133 133 adding branch
134 134 adding changesets
135 135 adding manifests
136 136 adding file changes
137 137 added 1 changesets with 1 changes to 1 files
138 138 committed changeset 1:401431e913a1
139 139 $ hg diff -c .
140 140 diff -r ad120869acf0 -r 401431e913a1 a
141 141 --- a/a Thu Jan 01 00:00:00 1970 +0000
142 142 +++ b/a Thu Jan 01 00:00:00 1970 +0000
143 143 @@ -1,1 +1,4 @@
144 144 a
145 145 +a
146 146 +a
147 147 +a
148 148 $ hg log
149 149 changeset: 1:401431e913a1
150 150 tag: tip
151 151 user: test
152 152 date: Thu Jan 01 00:00:00 1970 +0000
153 153 summary: no changes, new message
154 154
155 155 changeset: 0:ad120869acf0
156 156 user: test
157 157 date: Thu Jan 01 00:00:00 1970 +0000
158 158 summary: base
159 159
160 160
161 161 Disable default date on commit so when -d isn't given, the old date is preserved:
162 162
163 163 $ echo '[defaults]' >> $HGRCPATH
164 164 $ echo 'commit=' >> $HGRCPATH
165 165
166 166 Test -u/-d:
167 167
168 168 $ cat > .hg/checkeditform.sh <<EOF
169 169 > env | grep HGEDITFORM
170 170 > true
171 171 > EOF
172 172 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0'
173 173 HGEDITFORM=commit.amend.normal
174 174 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/401431e913a1-5e8e532c-amend.hg
175 175 $ echo a >> a
176 176 $ hg ci --amend -u foo -d '1 0'
177 177 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d96b1d28ae33-677e0afb-amend.hg
178 178 $ hg log -r .
179 179 changeset: 1:a9a13940fc03
180 180 tag: tip
181 181 user: foo
182 182 date: Thu Jan 01 00:00:01 1970 +0000
183 183 summary: no changes, new message
184 184
185 185
186 186 Open editor with old commit message if a message isn't given otherwise:
187 187
188 188 $ cat > editor.sh << '__EOF__'
189 189 > #!/bin/sh
190 190 > cat $1
191 191 > echo "another precious commit message" > "$1"
192 192 > __EOF__
193 193
194 194 at first, test saving last-message.txt
195 195
196 196 $ cat > .hg/hgrc << '__EOF__'
197 197 > [hooks]
198 198 > pretxncommit.test-saving-last-message = false
199 199 > __EOF__
200 200
201 201 $ rm -f .hg/last-message.txt
202 202 $ hg commit --amend -v -m "message given from command line"
203 203 amending changeset a9a13940fc03
204 204 copying changeset a9a13940fc03 to ad120869acf0
205 205 committing files:
206 206 a
207 207 committing manifest
208 208 committing changelog
209 209 running hook pretxncommit.test-saving-last-message: false
210 210 transaction abort!
211 211 rollback completed
212 212 abort: pretxncommit.test-saving-last-message hook exited with status 1
213 213 [40]
214 214 $ cat .hg/last-message.txt
215 215 message given from command line (no-eol)
216 216
217 217 $ rm -f .hg/last-message.txt
218 218 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
219 219 amending changeset a9a13940fc03
220 220 copying changeset a9a13940fc03 to ad120869acf0
221 221 no changes, new message
222 222
223 223
224 224 HG: Enter commit message. Lines beginning with 'HG:' are removed.
225 225 HG: Leave message empty to abort commit.
226 226 HG: --
227 227 HG: user: foo
228 228 HG: branch 'default'
229 229 HG: changed a
230 230 committing files:
231 231 a
232 232 committing manifest
233 233 committing changelog
234 234 running hook pretxncommit.test-saving-last-message: false
235 235 transaction abort!
236 236 rollback completed
237 237 abort: pretxncommit.test-saving-last-message hook exited with status 1
238 238 [40]
239 239
240 240 $ cat .hg/last-message.txt
241 241 another precious commit message
242 242
243 243 $ cat > .hg/hgrc << '__EOF__'
244 244 > [hooks]
245 245 > pretxncommit.test-saving-last-message =
246 246 > __EOF__
247 247
248 248 then, test editing custom commit message
249 249
250 250 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
251 251 amending changeset a9a13940fc03
252 252 copying changeset a9a13940fc03 to ad120869acf0
253 253 no changes, new message
254 254
255 255
256 256 HG: Enter commit message. Lines beginning with 'HG:' are removed.
257 257 HG: Leave message empty to abort commit.
258 258 HG: --
259 259 HG: user: foo
260 260 HG: branch 'default'
261 261 HG: changed a
262 262 committing files:
263 263 a
264 264 committing manifest
265 265 committing changelog
266 266 1 changesets found
267 267 uncompressed size of bundle content:
268 268 249 (changelog)
269 269 163 (manifests)
270 133 a
270 135 a
271 271 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/a9a13940fc03-7c2e8674-amend.hg
272 272 1 changesets found
273 273 uncompressed size of bundle content:
274 274 257 (changelog)
275 275 163 (manifests)
276 133 a
276 135 a
277 277 adding branch
278 278 adding changesets
279 279 adding manifests
280 280 adding file changes
281 281 added 1 changesets with 1 changes to 1 files
282 282 committed changeset 1:64a124ba1b44
283 283
284 284 Same, but with changes in working dir (different code path):
285 285
286 286 $ echo a >> a
287 287 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
288 288 amending changeset 64a124ba1b44
289 289 another precious commit message
290 290
291 291
292 292 HG: Enter commit message. Lines beginning with 'HG:' are removed.
293 293 HG: Leave message empty to abort commit.
294 294 HG: --
295 295 HG: user: foo
296 296 HG: branch 'default'
297 297 HG: changed a
298 298 committing files:
299 299 a
300 300 committing manifest
301 301 committing changelog
302 302 1 changesets found
303 303 uncompressed size of bundle content:
304 304 257 (changelog)
305 305 163 (manifests)
306 133 a
306 135 a
307 307 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/64a124ba1b44-10374b8f-amend.hg
308 308 1 changesets found
309 309 uncompressed size of bundle content:
310 310 257 (changelog)
311 311 163 (manifests)
312 135 a
312 137 a
313 313 adding branch
314 314 adding changesets
315 315 adding manifests
316 316 adding file changes
317 317 added 1 changesets with 1 changes to 1 files
318 318 committed changeset 1:7892795b8e38
319 319
320 320 $ rm editor.sh
321 321 $ hg log -r .
322 322 changeset: 1:7892795b8e38
323 323 tag: tip
324 324 user: foo
325 325 date: Thu Jan 01 00:00:01 1970 +0000
326 326 summary: another precious commit message
327 327
328 328
329 329 Moving bookmarks, preserve active bookmark:
330 330
331 331 $ hg book book1
332 332 $ hg book book2
333 333 $ hg ci --amend -m 'move bookmarks'
334 334 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/7892795b8e38-3fb46217-amend.hg
335 335 $ hg book
336 336 book1 1:8311f17e2616
337 337 * book2 1:8311f17e2616
338 338 $ echo a >> a
339 339 $ hg ci --amend -m 'move bookmarks'
340 340 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/8311f17e2616-f0504fe3-amend.hg
341 341 $ hg book
342 342 book1 1:a3b65065808c
343 343 * book2 1:a3b65065808c
344 344
345 345 abort does not loose bookmarks
346 346
347 347 $ cat > editor.sh << '__EOF__'
348 348 > #!/bin/sh
349 349 > echo "" > "$1"
350 350 > __EOF__
351 351 $ echo a >> a
352 352 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
353 353 abort: empty commit message
354 354 [10]
355 355 $ hg book
356 356 book1 1:a3b65065808c
357 357 * book2 1:a3b65065808c
358 358 $ hg revert -Caq
359 359 $ rm editor.sh
360 360
361 361 $ echo '[defaults]' >> $HGRCPATH
362 362 $ echo "commit=-d '0 0'" >> $HGRCPATH
363 363
364 364 Moving branches:
365 365
366 366 $ hg branch foo
367 367 marked working directory as branch foo
368 368 (branches are permanent and global, did you want a bookmark?)
369 369 $ echo a >> a
370 370 $ hg ci -m 'branch foo'
371 371 $ hg branch default -f
372 372 marked working directory as branch default
373 373 $ hg ci --amend -m 'back to default'
374 374 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/f8339a38efe1-c18453c9-amend.hg
375 375 $ hg branches
376 376 default 2:9c07515f2650
377 377
378 378 Close branch:
379 379
380 380 $ hg up -q 0
381 381 $ echo b >> b
382 382 $ hg branch foo
383 383 marked working directory as branch foo
384 384 (branches are permanent and global, did you want a bookmark?)
385 385 $ hg ci -Am 'fork'
386 386 adding b
387 387 $ echo b >> b
388 388 $ hg ci -mb
389 389 $ hg ci --amend --close-branch -m 'closing branch foo'
390 390 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/c962248fa264-54245dc7-amend.hg
391 391
392 392 Same thing, different code path:
393 393
394 394 $ echo b >> b
395 395 $ hg ci -m 'reopen branch'
396 396 reopening closed branch head 4
397 397 $ echo b >> b
398 398 $ hg ci --amend --close-branch
399 399 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/027371728205-b900d9fa-amend.hg
400 400 $ hg branches
401 401 default 2:9c07515f2650
402 402
403 403 Refuse to amend during a merge:
404 404
405 405 $ hg up -q default
406 406 $ hg merge foo
407 407 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
408 408 (branch merge, don't forget to commit)
409 409 $ hg ci --amend
410 410 abort: cannot amend changesets while merging
411 411 [20]
412 412 $ hg ci -m 'merge'
413 413
414 414 Refuse to amend if there is a merge conflict (issue5805):
415 415
416 416 $ hg up -q foo
417 417 $ echo c > a
418 418 $ hg up default -t :fail
419 419 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
420 420 use 'hg resolve' to retry unresolved file merges
421 421 [1]
422 422 $ hg resolve -l
423 423 U a
424 424
425 425 $ hg ci --amend
426 426 abort: unresolved merge conflicts (see 'hg help resolve')
427 427 [20]
428 428
429 429 $ hg up -qC .
430 430
431 431 Follow copies/renames:
432 432
433 433 $ hg mv b c
434 434 $ hg ci -m 'b -> c'
435 435 $ hg mv c d
436 436 $ hg ci --amend -m 'b -> d'
437 437 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/42f3f27a067d-f23cc9f7-amend.hg
438 438 $ hg st --rev '.^' --copies d
439 439 A d
440 440 b
441 441 $ hg cp d e
442 442 $ hg ci -m 'e = d'
443 443 $ hg cp e f
444 444 $ hg ci --amend -m 'f = d'
445 445 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/9198f73182d5-251d584a-amend.hg
446 446 $ hg st --rev '.^' --copies f
447 447 A f
448 448 d
449 449
450 450 $ mv f f.orig
451 451 $ hg rm -A f
452 452 $ hg ci -m removef
453 453 $ hg cp a f
454 454 $ mv f.orig f
455 455 $ hg ci --amend -m replacef
456 456 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/f0993ab6b482-eda301bf-amend.hg
457 457 $ hg st --change . --copies
458 458 $ hg log -r . --template "{file_copies}\n"
459 459
460 460
461 461 Move added file (issue3410):
462 462
463 463 $ echo g >> g
464 464 $ hg ci -Am g
465 465 adding g
466 466 $ hg mv g h
467 467 $ hg ci --amend
468 468 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/58585e3f095c-0f5ebcda-amend.hg
469 469 $ hg st --change . --copies h
470 470 A h
471 471 $ hg log -r . --template "{file_copies}\n"
472 472
473 473
474 474 Can't rollback an amend:
475 475
476 476 $ hg rollback
477 477 no rollback information available
478 478 [1]
479 479
480 480 Preserve extra dict (issue3430):
481 481
482 482 $ hg branch a
483 483 marked working directory as branch a
484 484 (branches are permanent and global, did you want a bookmark?)
485 485 $ echo a >> a
486 486 $ hg ci -ma
487 487 $ hg ci --amend -m "a'"
488 488 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/39a162f1d65e-9dfe13d8-amend.hg
489 489 $ hg log -r . --template "{branch}\n"
490 490 a
491 491 $ hg ci --amend -m "a''"
492 492 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d5ca7b1ac72b-0b4c1a34-amend.hg
493 493 $ hg log -r . --template "{branch}\n"
494 494 a
495 495
496 496 Also preserve other entries in the dict that are in the old commit,
497 497 first graft something so there's an additional entry:
498 498
499 499 $ hg up 0 -q
500 500 $ echo z > z
501 501 $ hg ci -Am 'fork'
502 502 adding z
503 503 created new head
504 504 $ hg up 11
505 505 5 files updated, 0 files merged, 1 files removed, 0 files unresolved
506 506 $ hg graft 12
507 507 grafting 12:2647734878ef "fork" (tip)
508 508 $ hg ci --amend -m 'graft amend'
509 509 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/fe8c6f7957ca-25638666-amend.hg
510 510 $ hg log -r . --debug | grep extra
511 511 extra: amend_source=fe8c6f7957ca1665ed77496ed7a07657d469ac60
512 512 extra: branch=a
513 513 extra: source=2647734878ef0236dda712fae9c1651cf694ea8a
514 514
515 515 Preserve phase
516 516
517 517 $ hg phase '.^::.'
518 518 11: draft
519 519 13: draft
520 520 $ hg phase --secret --force .
521 521 $ hg phase '.^::.'
522 522 11: draft
523 523 13: secret
524 524 $ hg commit --amend -m 'amend for phase' -q
525 525 $ hg phase '.^::.'
526 526 11: draft
527 527 13: secret
528 528
529 529 Test amend with obsolete
530 530 ---------------------------
531 531
532 532 Enable obsolete
533 533
534 534 $ cat >> $HGRCPATH << EOF
535 535 > [experimental]
536 536 > evolution.createmarkers=True
537 537 > evolution.allowunstable=True
538 538 > EOF
539 539
540 540 Amend with no files changes
541 541
542 542 $ hg id -n
543 543 13
544 544 $ hg ci --amend -m 'babar'
545 545 $ hg id -n
546 546 14
547 547 $ hg log -Gl 3 --style=compact
548 548 @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test
549 549 | babar
550 550 |
551 551 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
552 552 | | fork
553 553 | ~
554 554 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
555 555 | a''
556 556 ~
557 557 $ hg log -Gl 4 --hidden --style=compact
558 558 @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test
559 559 | babar
560 560 |
561 561 | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test
562 562 |/ amend for phase
563 563 |
564 564 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
565 565 | | fork
566 566 | ~
567 567 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
568 568 | a''
569 569 ~
570 570
571 571 Amend with files changes
572 572
573 573 (note: the extra commit over 15 is a temporary junk I would be happy to get
574 574 ride of)
575 575
576 576 $ echo 'babar' >> a
577 577 $ hg commit --amend
578 578 $ hg log -Gl 6 --hidden --style=compact
579 579 @ 15[tip]:11 a5b42b49b0d5 1970-01-01 00:00 +0000 test
580 580 | babar
581 581 |
582 582 | x 14:11 682950e85999 1970-01-01 00:00 +0000 test
583 583 |/ babar
584 584 |
585 585 | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test
586 586 |/ amend for phase
587 587 |
588 588 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
589 589 | | fork
590 590 | ~
591 591 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
592 592 | a''
593 593 |
594 594 o 10 5fa75032e226 1970-01-01 00:00 +0000 test
595 595 | g
596 596 ~
597 597
598 598
599 599 Test that amend does not make it easy to create obsolescence cycle
600 600 ---------------------------------------------------------------------
601 601
602 602 $ hg id -r 14 --hidden
603 603 682950e85999 (a)
604 604 $ hg revert -ar 14 --hidden
605 605 reverting a
606 606 $ hg commit --amend
607 607 $ hg id
608 608 37973c7e0b61 (a) tip
609 609
610 610 Test that rewriting leaving instability behind is allowed
611 611 ---------------------------------------------------------------------
612 612
613 613 $ hg up '.^'
614 614 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
615 615 $ echo 'b' >> a
616 616 $ hg log --style compact -r 'children(.)'
617 617 16[tip]:11 37973c7e0b61 1970-01-01 00:00 +0000 test
618 618 babar
619 619
620 620 $ hg commit --amend
621 621 1 new orphan changesets
622 622 $ hg log -r 'orphan()'
623 623 changeset: 16:37973c7e0b61
624 624 branch: a
625 625 parent: 11:0ddb275cfad1
626 626 user: test
627 627 date: Thu Jan 01 00:00:00 1970 +0000
628 628 instability: orphan
629 629 summary: babar
630 630
631 631
632 632 Amend a merge changeset (with renames and conflicts from the second parent):
633 633
634 634 $ hg up -q default
635 635 $ hg branch -q bar
636 636 $ hg cp a aa
637 637 $ hg mv z zz
638 638 $ echo cc > cc
639 639 $ hg add cc
640 640 $ hg ci -m aazzcc
641 641 $ hg up -q default
642 642 $ echo a >> a
643 643 $ echo dd > cc
644 644 $ hg add cc
645 645 $ hg ci -m aa
646 646 $ hg merge -q bar
647 647 warning: conflicts while merging cc! (edit, then use 'hg resolve --mark')
648 648 [1]
649 649 $ hg resolve -m cc
650 650 (no more unresolved files)
651 651 $ hg ci -m 'merge bar'
652 652 $ hg log --config diff.git=1 -pr .
653 653 changeset: 20:5aba7f3726e6
654 654 tag: tip
655 655 parent: 19:30d96aeaf27b
656 656 parent: 18:1aa437659d19
657 657 user: test
658 658 date: Thu Jan 01 00:00:00 1970 +0000
659 659 summary: merge bar
660 660
661 661 diff --git a/a b/aa
662 662 copy from a
663 663 copy to aa
664 664 diff --git a/cc b/cc
665 665 --- a/cc
666 666 +++ b/cc
667 667 @@ -1,1 +1,5 @@
668 668 +<<<<<<< working copy: 30d96aeaf27b - test: aa
669 669 dd
670 670 +=======
671 671 +cc
672 672 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
673 673 diff --git a/z b/zz
674 674 rename from z
675 675 rename to zz
676 676
677 677 $ hg debugrename aa
678 678 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
679 679 $ hg debugrename zz
680 680 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
681 681 $ hg debugrename cc
682 682 cc not renamed
683 683 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit
684 684 HGEDITFORM=commit.amend.merge
685 685 $ hg log --config diff.git=1 -pr .
686 686 changeset: 21:4b0631ef043e
687 687 tag: tip
688 688 parent: 19:30d96aeaf27b
689 689 parent: 18:1aa437659d19
690 690 user: test
691 691 date: Thu Jan 01 00:00:00 1970 +0000
692 692 summary: merge bar (amend message)
693 693
694 694 diff --git a/a b/aa
695 695 copy from a
696 696 copy to aa
697 697 diff --git a/cc b/cc
698 698 --- a/cc
699 699 +++ b/cc
700 700 @@ -1,1 +1,5 @@
701 701 +<<<<<<< working copy: 30d96aeaf27b - test: aa
702 702 dd
703 703 +=======
704 704 +cc
705 705 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
706 706 diff --git a/z b/zz
707 707 rename from z
708 708 rename to zz
709 709
710 710 $ hg debugrename aa
711 711 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
712 712 $ hg debugrename zz
713 713 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
714 714 $ hg debugrename cc
715 715 cc not renamed
716 716 $ hg mv zz z
717 717 $ hg ci --amend -m 'merge bar (undo rename)'
718 718 $ hg log --config diff.git=1 -pr .
719 719 changeset: 22:06423be42d60
720 720 tag: tip
721 721 parent: 19:30d96aeaf27b
722 722 parent: 18:1aa437659d19
723 723 user: test
724 724 date: Thu Jan 01 00:00:00 1970 +0000
725 725 summary: merge bar (undo rename)
726 726
727 727 diff --git a/a b/aa
728 728 copy from a
729 729 copy to aa
730 730 diff --git a/cc b/cc
731 731 --- a/cc
732 732 +++ b/cc
733 733 @@ -1,1 +1,5 @@
734 734 +<<<<<<< working copy: 30d96aeaf27b - test: aa
735 735 dd
736 736 +=======
737 737 +cc
738 738 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
739 739
740 740 $ hg debugrename z
741 741 z not renamed
742 742
743 743 Amend a merge changeset (with renames during the merge):
744 744
745 745 $ hg up -q bar
746 746 $ echo x > x
747 747 $ hg add x
748 748 $ hg ci -m x
749 749 $ hg up -q default
750 750 $ hg merge -q bar
751 751 $ hg mv aa aaa
752 752 $ echo aa >> aaa
753 753 $ hg ci -m 'merge bar again'
754 754 $ hg log --config diff.git=1 -pr .
755 755 changeset: 24:a89974a20457
756 756 tag: tip
757 757 parent: 22:06423be42d60
758 758 parent: 23:4c94d5bc65f5
759 759 user: test
760 760 date: Thu Jan 01 00:00:00 1970 +0000
761 761 summary: merge bar again
762 762
763 763 diff --git a/aa b/aa
764 764 deleted file mode 100644
765 765 --- a/aa
766 766 +++ /dev/null
767 767 @@ -1,2 +0,0 @@
768 768 -a
769 769 -a
770 770 diff --git a/aaa b/aaa
771 771 new file mode 100644
772 772 --- /dev/null
773 773 +++ b/aaa
774 774 @@ -0,0 +1,3 @@
775 775 +a
776 776 +a
777 777 +aa
778 778 diff --git a/x b/x
779 779 new file mode 100644
780 780 --- /dev/null
781 781 +++ b/x
782 782 @@ -0,0 +1,1 @@
783 783 +x
784 784
785 785 $ hg debugrename aaa
786 786 aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980
787 787
788 788 Update to p1 with 'aaa' modified. 'aaa' was renamed from 'aa' in p2. 'aa' exists
789 789 in p1 too, but it was recorded as copied from p2.
790 790 $ echo modified >> aaa
791 791 $ hg co -m '.^' -t :merge3
792 792 file 'aaa' was deleted in other [destination] but was modified in local [working copy].
793 793 You can use (c)hanged version, (d)elete, or leave (u)nresolved.
794 794 What do you want to do? u
795 795 1 files updated, 0 files merged, 1 files removed, 1 files unresolved
796 796 use 'hg resolve' to retry unresolved file merges
797 797 [1]
798 798 $ hg co -C tip
799 799 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
800 800
801 801 $ hg mv aaa aa
802 802 $ hg ci --amend -m 'merge bar again (undo rename)'
803 803 $ hg log --config diff.git=1 -pr .
804 804 changeset: 25:282080768800
805 805 tag: tip
806 806 parent: 22:06423be42d60
807 807 parent: 23:4c94d5bc65f5
808 808 user: test
809 809 date: Thu Jan 01 00:00:00 1970 +0000
810 810 summary: merge bar again (undo rename)
811 811
812 812 diff --git a/aa b/aa
813 813 --- a/aa
814 814 +++ b/aa
815 815 @@ -1,2 +1,3 @@
816 816 a
817 817 a
818 818 +aa
819 819 diff --git a/x b/x
820 820 new file mode 100644
821 821 --- /dev/null
822 822 +++ b/x
823 823 @@ -0,0 +1,1 @@
824 824 +x
825 825
826 826 $ hg debugrename aa
827 827 aa not renamed
828 828 $ hg debugrename -r '.^' aa
829 829 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
830 830
831 831 Amend a merge changeset (with manifest-level conflicts):
832 832
833 833 $ hg up -q bar
834 834 $ hg rm aa
835 835 $ hg ci -m 'rm aa'
836 836 $ hg up -q default
837 837 $ echo aa >> aa
838 838 $ hg ci -m aa
839 839 $ hg merge -q bar --config ui.interactive=True << EOF
840 840 > c
841 841 > EOF
842 842 file 'aa' was deleted in other [merge rev] but was modified in local [working copy].
843 843 You can use (c)hanged version, (d)elete, or leave (u)nresolved.
844 844 What do you want to do? c
845 845 $ hg ci -m 'merge bar (with conflicts)'
846 846 $ hg log --config diff.git=1 -pr .
847 847 changeset: 28:ed15db12298d
848 848 tag: tip
849 849 parent: 27:eb5adec0b43b
850 850 parent: 26:67db8847a540
851 851 user: test
852 852 date: Thu Jan 01 00:00:00 1970 +0000
853 853 summary: merge bar (with conflicts)
854 854
855 855
856 856 $ hg rm aa
857 857 $ hg ci --amend -m 'merge bar (with conflicts, amended)'
858 858 $ hg log --config diff.git=1 -pr .
859 859 changeset: 29:0eeafd043f63
860 860 tag: tip
861 861 parent: 27:eb5adec0b43b
862 862 parent: 26:67db8847a540
863 863 user: test
864 864 date: Thu Jan 01 00:00:00 1970 +0000
865 865 summary: merge bar (with conflicts, amended)
866 866
867 867 diff --git a/aa b/aa
868 868 deleted file mode 100644
869 869 --- a/aa
870 870 +++ /dev/null
871 871 @@ -1,4 +0,0 @@
872 872 -a
873 873 -a
874 874 -aa
875 875 -aa
876 876
877 877 Issue 3445: amending with --close-branch a commit that created a new head should fail
878 878 This shouldn't be possible:
879 879
880 880 $ hg up -q default
881 881 $ hg branch closewithamend
882 882 marked working directory as branch closewithamend
883 883 $ echo foo > foo
884 884 $ hg add foo
885 885 $ hg ci -m..
886 886 $ hg ci --amend --close-branch -m 'closing'
887 887 abort: can only close branch heads
888 888 [10]
889 889
890 890 This silliness fails:
891 891
892 892 $ hg branch silliness
893 893 marked working directory as branch silliness
894 894 $ echo b >> b
895 895 $ hg ci --close-branch -m'open and close'
896 896 abort: branch "silliness" has no heads to close
897 897 [10]
898 898
899 899 Test that amend with --secret creates new secret changeset forcibly
900 900 ---------------------------------------------------------------------
901 901
902 902 $ hg phase '.^::.'
903 903 29: draft
904 904 30: draft
905 905 $ hg commit --amend --secret -m 'amend as secret' -q
906 906 $ hg phase '.^::.'
907 907 29: draft
908 908 31: secret
909 909
910 910 Test that amend with --edit invokes editor forcibly
911 911 ---------------------------------------------------
912 912
913 913 $ hg parents --template "{desc}\n"
914 914 amend as secret
915 915 $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed"
916 916 $ hg parents --template "{desc}\n"
917 917 editor should be suppressed
918 918
919 919 $ hg status --rev '.^1::.'
920 920 A foo
921 921 $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit
922 922 editor should be invoked
923 923
924 924
925 925 HG: Enter commit message. Lines beginning with 'HG:' are removed.
926 926 HG: Leave message empty to abort commit.
927 927 HG: --
928 928 HG: user: test
929 929 HG: branch 'silliness'
930 930 HG: added foo
931 931 $ hg parents --template "{desc}\n"
932 932 editor should be invoked
933 933
934 934 Test that amend with --no-edit avoids the editor
935 935 ------------------------------------------------
936 936
937 937 $ hg commit --amend -m "before anything happens"
938 938 $ hg parents --template "{desc}\n"
939 939 before anything happens
940 940 $ HGEDITOR=cat hg commit --amend --no-edit -m "editor should be suppressed"
941 941 $ hg parents --template "{desc}\n"
942 942 editor should be suppressed
943 943
944 944 (We need a file change here since we won't have a message change)
945 945 $ cp foo foo.orig
946 946 $ echo hi >> foo
947 947 $ HGEDITOR=cat hg commit --amend --no-edit
948 948 $ hg parents --template "{desc}\n"
949 949 editor should be suppressed
950 950 $ hg status -mar
951 951 (Let's undo adding that "hi" so later tests don't need to be adjusted)
952 952 $ mv foo.orig foo
953 953 $ hg commit --amend --no-edit
954 954
955 955 Test that "diff()" in committemplate works correctly for amending
956 956 -----------------------------------------------------------------
957 957
958 958 $ cat >> .hg/hgrc <<EOF
959 959 > [committemplate]
960 960 > changeset.commit.amend = {desc}\n
961 961 > HG: {revset('parents()') % 'parent: {desc|firstline}\n'}
962 962 > HG: M: {file_mods}
963 963 > HG: A: {file_adds}
964 964 > HG: R: {file_dels}
965 965 > {splitlines(diff()) % 'HG: {line}\n'}
966 966 > EOF
967 967
968 968 $ hg parents --template "M: {file_mods}\nA: {file_adds}\nR: {file_dels}\n"
969 969 M:
970 970 A: foo
971 971 R:
972 972 $ hg status -amr
973 973 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo"
974 974 expecting diff of foo
975 975
976 976 HG: parent: editor should be suppressed
977 977
978 978 HG: M:
979 979 HG: A: foo
980 980 HG: R:
981 981 HG: diff -r 0eeafd043f63 foo
982 982 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
983 983 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
984 984 HG: @@ -0,0 +1,1 @@
985 985 HG: +foo
986 986
987 987 $ echo y > y
988 988 $ hg add y
989 989 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo and y"
990 990 expecting diff of foo and y
991 991
992 992 HG: parent: expecting diff of foo
993 993
994 994 HG: M:
995 995 HG: A: foo y
996 996 HG: R:
997 997 HG: diff -r 0eeafd043f63 foo
998 998 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
999 999 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1000 1000 HG: @@ -0,0 +1,1 @@
1001 1001 HG: +foo
1002 1002 HG: diff -r 0eeafd043f63 y
1003 1003 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1004 1004 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1005 1005 HG: @@ -0,0 +1,1 @@
1006 1006 HG: +y
1007 1007
1008 1008 $ hg rm a
1009 1009 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo and y"
1010 1010 expecting diff of a, foo and y
1011 1011
1012 1012 HG: parent: expecting diff of foo and y
1013 1013
1014 1014 HG: M:
1015 1015 HG: A: foo y
1016 1016 HG: R: a
1017 1017 HG: diff -r 0eeafd043f63 a
1018 1018 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1019 1019 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1020 1020 HG: @@ -1,2 +0,0 @@
1021 1021 HG: -a
1022 1022 HG: -a
1023 1023 HG: diff -r 0eeafd043f63 foo
1024 1024 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1025 1025 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1026 1026 HG: @@ -0,0 +1,1 @@
1027 1027 HG: +foo
1028 1028 HG: diff -r 0eeafd043f63 y
1029 1029 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1030 1030 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1031 1031 HG: @@ -0,0 +1,1 @@
1032 1032 HG: +y
1033 1033
1034 1034 $ hg rm x
1035 1035 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo, x and y"
1036 1036 expecting diff of a, foo, x and y
1037 1037
1038 1038 HG: parent: expecting diff of a, foo and y
1039 1039
1040 1040 HG: M:
1041 1041 HG: A: foo y
1042 1042 HG: R: a x
1043 1043 HG: diff -r 0eeafd043f63 a
1044 1044 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1045 1045 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1046 1046 HG: @@ -1,2 +0,0 @@
1047 1047 HG: -a
1048 1048 HG: -a
1049 1049 HG: diff -r 0eeafd043f63 foo
1050 1050 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1051 1051 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1052 1052 HG: @@ -0,0 +1,1 @@
1053 1053 HG: +foo
1054 1054 HG: diff -r 0eeafd043f63 x
1055 1055 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1056 1056 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1057 1057 HG: @@ -1,1 +0,0 @@
1058 1058 HG: -x
1059 1059 HG: diff -r 0eeafd043f63 y
1060 1060 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1061 1061 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1062 1062 HG: @@ -0,0 +1,1 @@
1063 1063 HG: +y
1064 1064
1065 1065 $ echo cccc >> cc
1066 1066 $ hg status -amr
1067 1067 M cc
1068 1068 $ HGEDITOR=cat hg commit --amend -e -m "cc should be excluded" -X cc
1069 1069 cc should be excluded
1070 1070
1071 1071 HG: parent: expecting diff of a, foo, x and y
1072 1072
1073 1073 HG: M:
1074 1074 HG: A: foo y
1075 1075 HG: R: a x
1076 1076 HG: diff -r 0eeafd043f63 a
1077 1077 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1078 1078 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1079 1079 HG: @@ -1,2 +0,0 @@
1080 1080 HG: -a
1081 1081 HG: -a
1082 1082 HG: diff -r 0eeafd043f63 foo
1083 1083 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1084 1084 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1085 1085 HG: @@ -0,0 +1,1 @@
1086 1086 HG: +foo
1087 1087 HG: diff -r 0eeafd043f63 x
1088 1088 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1089 1089 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1090 1090 HG: @@ -1,1 +0,0 @@
1091 1091 HG: -x
1092 1092 HG: diff -r 0eeafd043f63 y
1093 1093 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1094 1094 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1095 1095 HG: @@ -0,0 +1,1 @@
1096 1096 HG: +y
1097 1097
1098 1098 Check for issue4405
1099 1099 -------------------
1100 1100
1101 1101 Setup the repo with a file that gets moved in a second commit.
1102 1102 $ hg init repo
1103 1103 $ cd repo
1104 1104 $ touch a0
1105 1105 $ hg add a0
1106 1106 $ hg commit -m a0
1107 1107 $ hg mv a0 a1
1108 1108 $ hg commit -m a1
1109 1109 $ hg up -q 0
1110 1110 $ hg log -G --template '{rev} {desc}'
1111 1111 o 1 a1
1112 1112 |
1113 1113 @ 0 a0
1114 1114
1115 1115
1116 1116 Now we branch the repro, but re-use the file contents, so we have a divergence
1117 1117 in the file revlog topology and the changelog topology.
1118 1118 $ hg revert --rev 1 --all
1119 1119 removing a0
1120 1120 adding a1
1121 1121 $ hg ci -qm 'a1-amend'
1122 1122 $ hg log -G --template '{rev} {desc}'
1123 1123 @ 2 a1-amend
1124 1124 |
1125 1125 | o 1 a1
1126 1126 |/
1127 1127 o 0 a0
1128 1128
1129 1129
1130 1130 The way mercurial does amends is by folding the working copy and old commit
1131 1131 together into another commit (rev 3). During this process, _findlimit is called
1132 1132 to check how far back to look for the transitive closure of file copy
1133 1133 information, but due to the divergence of the filelog and changelog graph
1134 1134 topologies, before _findlimit was fixed, it returned a rev which was not far
1135 1135 enough back in this case.
1136 1136 $ hg mv a1 a2
1137 1137 $ hg status --copies --rev 0
1138 1138 A a2
1139 1139 a0
1140 1140 R a0
1141 1141 $ hg ci --amend -q
1142 1142 $ hg log -G --template '{rev} {desc}'
1143 1143 @ 3 a1-amend
1144 1144 |
1145 1145 | o 1 a1
1146 1146 |/
1147 1147 o 0 a0
1148 1148
1149 1149
1150 1150 Before the fix, the copy information was lost.
1151 1151 $ hg status --copies --rev 0
1152 1152 A a2
1153 1153 a0
1154 1154 R a0
1155 1155 $ cd ..
1156 1156
1157 1157 Check that amend properly preserve rename from directory rename (issue-4516)
1158 1158
1159 1159 If a parent of the merge renames a full directory, any files added to the old
1160 1160 directory in the other parent will be renamed to the new directory. For some
1161 1161 reason, the rename metadata was when amending such merge. This test ensure we
1162 1162 do not regress. We have a dedicated repo because it needs a setup with renamed
1163 1163 directory)
1164 1164
1165 1165 $ hg init issue4516
1166 1166 $ cd issue4516
1167 1167 $ mkdir olddirname
1168 1168 $ echo line1 > olddirname/commonfile.py
1169 1169 $ hg add olddirname/commonfile.py
1170 1170 $ hg ci -m first
1171 1171
1172 1172 $ hg branch newdirname
1173 1173 marked working directory as branch newdirname
1174 1174 (branches are permanent and global, did you want a bookmark?)
1175 1175 $ hg mv olddirname newdirname
1176 1176 moving olddirname/commonfile.py to newdirname/commonfile.py
1177 1177 $ hg ci -m rename
1178 1178
1179 1179 $ hg update default
1180 1180 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1181 1181 $ echo line1 > olddirname/newfile.py
1182 1182 $ hg add olddirname/newfile.py
1183 1183 $ hg ci -m log
1184 1184
1185 1185 $ hg up newdirname
1186 1186 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1187 1187 $ # create newdirname/newfile.py
1188 1188 $ hg merge default
1189 1189 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1190 1190 (branch merge, don't forget to commit)
1191 1191 $ hg ci -m add
1192 1192 $
1193 1193 $ hg debugrename newdirname/newfile.py
1194 1194 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
1195 1195 $ hg status -C --change .
1196 1196 A newdirname/newfile.py
1197 1197 $ hg status -C --rev 1
1198 1198 A newdirname/newfile.py
1199 1199 $ hg status -C --rev 2
1200 1200 A newdirname/commonfile.py
1201 1201 olddirname/commonfile.py
1202 1202 A newdirname/newfile.py
1203 1203 olddirname/newfile.py
1204 1204 R olddirname/commonfile.py
1205 1205 R olddirname/newfile.py
1206 1206 $ hg debugindex newdirname/newfile.py
1207 1207 rev linkrev nodeid p1-nodeid p2-nodeid
1208 1208 0 3 34a4d536c0c0 000000000000 000000000000
1209 1209
1210 1210 $ echo a >> newdirname/commonfile.py
1211 1211 $ hg ci --amend -m bug
1212 1212 $ hg debugrename newdirname/newfile.py
1213 1213 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
1214 1214 $ hg debugindex newdirname/newfile.py
1215 1215 rev linkrev nodeid p1-nodeid p2-nodeid
1216 1216 0 3 34a4d536c0c0 000000000000 000000000000
1217 1217
1218 1218 #if execbit
1219 1219
1220 1220 Test if amend preserves executable bit changes
1221 1221 $ chmod +x newdirname/commonfile.py
1222 1222 $ hg ci -m chmod
1223 1223 $ hg ci --amend -m "chmod amended"
1224 1224 $ hg ci --amend -m "chmod amended second time"
1225 1225 $ hg log -p --git -r .
1226 1226 changeset: 7:b1326f52dddf
1227 1227 branch: newdirname
1228 1228 tag: tip
1229 1229 parent: 4:7fd235f7cb2f
1230 1230 user: test
1231 1231 date: Thu Jan 01 00:00:00 1970 +0000
1232 1232 summary: chmod amended second time
1233 1233
1234 1234 diff --git a/newdirname/commonfile.py b/newdirname/commonfile.py
1235 1235 old mode 100644
1236 1236 new mode 100755
1237 1237
1238 1238 #endif
1239 1239
1240 1240 Test amend with file inclusion options
1241 1241 --------------------------------------
1242 1242
1243 1243 These tests ensure that we are always amending some files that were part of the
1244 1244 pre-amend commit. We want to test that the remaining files in the pre-amend
1245 1245 commit were not changed in the amended commit. We do so by performing a diff of
1246 1246 the amended commit against its parent commit.
1247 1247 $ cd ..
1248 1248 $ hg init testfileinclusions
1249 1249 $ cd testfileinclusions
1250 1250 $ echo a > a
1251 1251 $ echo b > b
1252 1252 $ hg commit -Aqm "Adding a and b"
1253 1253
1254 1254 Only add changes to a particular file
1255 1255 $ echo a >> a
1256 1256 $ echo b >> b
1257 1257 $ hg commit --amend -I a
1258 1258 $ hg diff --git -r null -r .
1259 1259 diff --git a/a b/a
1260 1260 new file mode 100644
1261 1261 --- /dev/null
1262 1262 +++ b/a
1263 1263 @@ -0,0 +1,2 @@
1264 1264 +a
1265 1265 +a
1266 1266 diff --git a/b b/b
1267 1267 new file mode 100644
1268 1268 --- /dev/null
1269 1269 +++ b/b
1270 1270 @@ -0,0 +1,1 @@
1271 1271 +b
1272 1272
1273 1273 $ echo a >> a
1274 1274 $ hg commit --amend b
1275 1275 $ hg diff --git -r null -r .
1276 1276 diff --git a/a b/a
1277 1277 new file mode 100644
1278 1278 --- /dev/null
1279 1279 +++ b/a
1280 1280 @@ -0,0 +1,2 @@
1281 1281 +a
1282 1282 +a
1283 1283 diff --git a/b b/b
1284 1284 new file mode 100644
1285 1285 --- /dev/null
1286 1286 +++ b/b
1287 1287 @@ -0,0 +1,2 @@
1288 1288 +b
1289 1289 +b
1290 1290
1291 1291 Exclude changes to a particular file
1292 1292 $ echo b >> b
1293 1293 $ hg commit --amend -X a
1294 1294 $ hg diff --git -r null -r .
1295 1295 diff --git a/a b/a
1296 1296 new file mode 100644
1297 1297 --- /dev/null
1298 1298 +++ b/a
1299 1299 @@ -0,0 +1,2 @@
1300 1300 +a
1301 1301 +a
1302 1302 diff --git a/b b/b
1303 1303 new file mode 100644
1304 1304 --- /dev/null
1305 1305 +++ b/b
1306 1306 @@ -0,0 +1,3 @@
1307 1307 +b
1308 1308 +b
1309 1309 +b
1310 1310
1311 1311 Check the addremove flag
1312 1312 $ echo c > c
1313 1313 $ rm a
1314 1314 $ hg commit --amend -A
1315 1315 removing a
1316 1316 adding c
1317 1317 $ hg diff --git -r null -r .
1318 1318 diff --git a/b b/b
1319 1319 new file mode 100644
1320 1320 --- /dev/null
1321 1321 +++ b/b
1322 1322 @@ -0,0 +1,3 @@
1323 1323 +b
1324 1324 +b
1325 1325 +b
1326 1326 diff --git a/c b/c
1327 1327 new file mode 100644
1328 1328 --- /dev/null
1329 1329 +++ b/c
1330 1330 @@ -0,0 +1,1 @@
1331 1331 +c
@@ -1,172 +1,172 b''
1 1 #require no-reposimplestore no-chg
2 2
3 3 XXX-CHG this test hangs if `hg` is really `chg`. This was hidden by the use of
4 4 `alias hg=chg` by run-tests.py. With such alias removed, this test is revealed
5 5 buggy. This need to be resolved sooner than later.
6 6
7 7
8 8 Testing infinipush extension and the confi options provided by it
9 9
10 10 Setup
11 11
12 12 $ . "$TESTDIR/library-infinitepush.sh"
13 13 $ cp $HGRCPATH $TESTTMP/defaulthgrc
14 14 $ setupcommon
15 15 $ hg init repo
16 16 $ cd repo
17 17 $ setupserver
18 18 $ echo initialcommit > initialcommit
19 19 $ hg ci -Aqm "initialcommit"
20 20 $ hg phase --public .
21 21
22 22 $ cd ..
23 23 $ hg clone ssh://user@dummy/repo client -q
24 24
25 25 Create two heads. Push first head alone, then two heads together. Make sure that
26 26 multihead push works.
27 27 $ cd client
28 28 $ echo multihead1 > multihead1
29 29 $ hg add multihead1
30 30 $ hg ci -m "multihead1"
31 31 $ hg up null
32 32 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
33 33 $ echo multihead2 > multihead2
34 34 $ hg ci -Am "multihead2"
35 35 adding multihead2
36 36 created new head
37 37 $ hg push -r . --bundle-store
38 38 pushing to ssh://user@dummy/repo
39 39 searching for changes
40 40 remote: pushing 1 commit:
41 41 remote: ee4802bf6864 multihead2
42 42 $ hg push -r '1:2' --bundle-store
43 43 pushing to ssh://user@dummy/repo
44 44 searching for changes
45 45 remote: pushing 2 commits:
46 46 remote: bc22f9a30a82 multihead1
47 47 remote: ee4802bf6864 multihead2
48 48 $ scratchnodes
49 bc22f9a30a821118244deacbd732e394ed0b686c ab1bc557aa090a9e4145512c734b6e8a828393a5
50 ee4802bf6864326a6b3dcfff5a03abc2a0a69b8f ab1bc557aa090a9e4145512c734b6e8a828393a5
49 bc22f9a30a821118244deacbd732e394ed0b686c de1b7d132ba98f0172cd974e3e69dfa80faa335c
50 ee4802bf6864326a6b3dcfff5a03abc2a0a69b8f de1b7d132ba98f0172cd974e3e69dfa80faa335c
51 51
52 52 Create two new scratch bookmarks
53 53 $ hg up 0
54 54 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
55 55 $ echo scratchfirstpart > scratchfirstpart
56 56 $ hg ci -Am "scratchfirstpart"
57 57 adding scratchfirstpart
58 58 created new head
59 59 $ hg push -r . -B scratch/firstpart
60 60 pushing to ssh://user@dummy/repo
61 61 searching for changes
62 62 remote: pushing 1 commit:
63 63 remote: 176993b87e39 scratchfirstpart
64 64 $ hg up 0
65 65 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
66 66 $ echo scratchsecondpart > scratchsecondpart
67 67 $ hg ci -Am "scratchsecondpart"
68 68 adding scratchsecondpart
69 69 created new head
70 70 $ hg push -r . -B scratch/secondpart
71 71 pushing to ssh://user@dummy/repo
72 72 searching for changes
73 73 remote: pushing 1 commit:
74 74 remote: 8db3891c220e scratchsecondpart
75 75
76 76 Pull two bookmarks from the second client
77 77 $ cd ..
78 78 $ hg clone ssh://user@dummy/repo client2 -q
79 79 $ cd client2
80 80 $ hg pull -B scratch/firstpart -B scratch/secondpart
81 81 pulling from ssh://user@dummy/repo
82 82 searching for changes
83 83 adding changesets
84 84 adding manifests
85 85 adding file changes
86 86 adding changesets
87 87 adding manifests
88 88 adding file changes
89 89 added 2 changesets with 2 changes to 2 files (+1 heads)
90 90 new changesets * (glob)
91 91 (run 'hg heads' to see heads, 'hg merge' to merge)
92 92 $ hg log -r scratch/secondpart -T '{node}'
93 93 8db3891c220e216f6da214e8254bd4371f55efca (no-eol)
94 94 $ hg log -r scratch/firstpart -T '{node}'
95 95 176993b87e39bd88d66a2cccadabe33f0b346339 (no-eol)
96 96 Make two commits to the scratch branch
97 97
98 98 $ echo testpullbycommithash1 > testpullbycommithash1
99 99 $ hg ci -Am "testpullbycommithash1"
100 100 adding testpullbycommithash1
101 101 created new head
102 102 $ hg log -r '.' -T '{node}\n' > ../testpullbycommithash1
103 103 $ echo testpullbycommithash2 > testpullbycommithash2
104 104 $ hg ci -Aqm "testpullbycommithash2"
105 105 $ hg push -r . -B scratch/mybranch -q
106 106
107 107 Create third client and pull by commit hash.
108 108 Make sure testpullbycommithash2 has not fetched
109 109 $ cd ..
110 110 $ hg clone ssh://user@dummy/repo client3 -q
111 111 $ cd client3
112 112 $ hg pull -r `cat ../testpullbycommithash1`
113 113 pulling from ssh://user@dummy/repo
114 114 searching for changes
115 115 adding changesets
116 116 adding manifests
117 117 adding file changes
118 118 added 1 changesets with 1 changes to 1 files
119 119 new changesets 33910bfe6ffe (1 drafts)
120 120 (run 'hg update' to get a working copy)
121 121 $ hg log -G -T '{desc} {phase} {bookmarks}'
122 122 o testpullbycommithash1 draft
123 123 |
124 124 @ initialcommit public
125 125
126 126 Make public commit in the repo and pull it.
127 127 Make sure phase on the client is public.
128 128 $ cd ../repo
129 129 $ echo publiccommit > publiccommit
130 130 $ hg ci -Aqm "publiccommit"
131 131 $ hg phase --public .
132 132 $ cd ../client3
133 133 $ hg pull
134 134 pulling from ssh://user@dummy/repo
135 135 searching for changes
136 136 adding changesets
137 137 adding manifests
138 138 adding file changes
139 139 added 1 changesets with 1 changes to 1 files (+1 heads)
140 140 new changesets a79b6597f322
141 141 (run 'hg heads' to see heads, 'hg merge' to merge)
142 142 $ hg log -G -T '{desc} {phase} {bookmarks} {node|short}'
143 143 o publiccommit public a79b6597f322
144 144 |
145 145 | o testpullbycommithash1 draft 33910bfe6ffe
146 146 |/
147 147 @ initialcommit public 67145f466344
148 148
149 149 $ hg up a79b6597f322
150 150 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
151 151 $ echo scratchontopofpublic > scratchontopofpublic
152 152 $ hg ci -Aqm "scratchontopofpublic"
153 153 $ hg push -r . -B scratch/scratchontopofpublic
154 154 pushing to ssh://user@dummy/repo
155 155 searching for changes
156 156 remote: pushing 1 commit:
157 157 remote: c70aee6da07d scratchontopofpublic
158 158 $ cd ../client2
159 159 $ hg pull -B scratch/scratchontopofpublic
160 160 pulling from ssh://user@dummy/repo
161 161 searching for changes
162 162 adding changesets
163 163 adding manifests
164 164 adding file changes
165 165 adding changesets
166 166 adding manifests
167 167 adding file changes
168 168 added 2 changesets with 2 changes to 2 files (+1 heads)
169 169 new changesets a79b6597f322:c70aee6da07d (1 drafts)
170 170 (run 'hg heads .' to see heads, 'hg merge' to merge)
171 171 $ hg log -r scratch/scratchontopofpublic -T '{phase}'
172 172 draft (no-eol)
@@ -1,1892 +1,1892 b''
1 1 This file used to contains all largefile tests.
2 2 Do not add any new tests in this file as it his already far too long to run.
3 3
4 4 It contains all the testing of the basic concepts of large file in a single block.
5 5
6 6 $ USERCACHE="$TESTTMP/cache"; export USERCACHE
7 7 $ mkdir "${USERCACHE}"
8 8 $ cat >> $HGRCPATH <<EOF
9 9 > [extensions]
10 10 > largefiles=
11 11 > purge=
12 12 > rebase=
13 13 > transplant=
14 14 > [phases]
15 15 > publish=False
16 16 > [largefiles]
17 17 > minsize=2
18 18 > patterns=glob:**.dat
19 19 > usercache=${USERCACHE}
20 20 > [hooks]
21 21 > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status"
22 22 > EOF
23 23
24 24 Create the repo with a couple of revisions of both large and normal
25 25 files.
26 26 Test status and dirstate of largefiles and that summary output is correct.
27 27
28 28 $ hg init a
29 29 $ cd a
30 30 $ mkdir sub
31 31 $ echo normal1 > normal1
32 32 $ echo normal2 > sub/normal2
33 33 $ echo large1 > large1
34 34 $ echo large2 > sub/large2
35 35 $ hg add normal1 sub/normal2
36 36 $ hg add --large large1 sub/large2
37 37 $ hg commit -m "add files"
38 38 Invoking status precommit hook
39 39 A large1
40 40 A normal1
41 41 A sub/large2
42 42 A sub/normal2
43 43 $ touch large1 sub/large2
44 44 $ sleep 1
45 45 $ hg st
46 46 $ hg debugstate --no-dates
47 47 n 644 41 set .hglf/large1
48 48 n 644 41 set .hglf/sub/large2
49 49 n 644 8 set normal1
50 50 n 644 8 set sub/normal2
51 51 $ hg debugstate --large --no-dates
52 52 n 644 7 set large1
53 53 n 644 7 set sub/large2
54 54 $ echo normal11 > normal1
55 55 $ echo normal22 > sub/normal2
56 56 $ echo large11 > large1
57 57 $ echo large22 > sub/large2
58 58 $ hg commit -m "edit files"
59 59 Invoking status precommit hook
60 60 M large1
61 61 M normal1
62 62 M sub/large2
63 63 M sub/normal2
64 64 $ hg sum --large
65 65 parent: 1:ce8896473775 tip
66 66 edit files
67 67 branch: default
68 68 commit: (clean)
69 69 update: (current)
70 70 phases: 2 draft
71 71 largefiles: (no remote repo)
72 72
73 73 Commit preserved largefile contents.
74 74
75 75 $ cat normal1
76 76 normal11
77 77 $ cat large1
78 78 large11
79 79 $ cat sub/normal2
80 80 normal22
81 81 $ cat sub/large2
82 82 large22
83 83
84 84 Test status, subdir and unknown files
85 85
86 86 $ echo unknown > sub/unknown
87 87 $ hg st --all
88 88 ? sub/unknown
89 89 C large1
90 90 C normal1
91 91 C sub/large2
92 92 C sub/normal2
93 93 $ hg st --all sub
94 94 ? sub/unknown
95 95 C sub/large2
96 96 C sub/normal2
97 97 $ rm sub/unknown
98 98
99 99 Test messages and exit codes for remove warning cases
100 100
101 101 $ hg remove -A large1
102 102 not removing large1: file still exists
103 103 [1]
104 104 $ echo 'modified' > large1
105 105 $ hg remove large1
106 106 not removing large1: file is modified (use -f to force removal)
107 107 [1]
108 108 $ echo 'new' > normalnew
109 109 $ hg add normalnew
110 110 $ echo 'new' > largenew
111 111 $ hg add --large normalnew
112 112 normalnew already tracked!
113 113 $ hg remove normalnew largenew
114 114 not removing largenew: file is untracked
115 115 not removing normalnew: file has been marked for add (use 'hg forget' to undo add)
116 116 [1]
117 117 $ rm normalnew largenew
118 118 $ hg up -Cq
119 119
120 120 Remove both largefiles and normal files.
121 121
122 122 $ hg remove normal1 large1
123 123 $ hg status large1
124 124 R large1
125 125 $ hg commit -m "remove files"
126 126 Invoking status precommit hook
127 127 R large1
128 128 R normal1
129 129 $ ls -A
130 130 .hg
131 131 .hglf
132 132 sub
133 133 $ echo "testlargefile" > large1-test
134 134 $ hg add --large large1-test
135 135 $ hg st
136 136 A large1-test
137 137 $ hg rm large1-test
138 138 not removing large1-test: file has been marked for add (use forget to undo)
139 139 [1]
140 140 $ hg st
141 141 A large1-test
142 142 $ hg forget large1-test
143 143 $ hg st
144 144 ? large1-test
145 145 $ hg remove large1-test
146 146 not removing large1-test: file is untracked
147 147 [1]
148 148 $ hg forget large1-test
149 149 not removing large1-test: file is already untracked
150 150 [1]
151 151 $ rm large1-test
152 152
153 153 Copy both largefiles and normal files (testing that status output is correct).
154 154
155 155 $ hg cp sub/normal2 normal1
156 156 $ hg cp sub/large2 large1
157 157 $ hg commit -m "copy files"
158 158 Invoking status precommit hook
159 159 A large1
160 160 A normal1
161 161 $ cat normal1
162 162 normal22
163 163 $ cat large1
164 164 large22
165 165
166 166 Test moving largefiles and verify that normal files are also unaffected.
167 167
168 168 $ hg mv normal1 normal3
169 169 $ hg mv large1 large3
170 170 $ hg mv sub/normal2 sub/normal4
171 171 $ hg mv sub/large2 sub/large4
172 172 $ hg commit -m "move files"
173 173 Invoking status precommit hook
174 174 A large3
175 175 A normal3
176 176 A sub/large4
177 177 A sub/normal4
178 178 R large1
179 179 R normal1
180 180 R sub/large2
181 181 R sub/normal2
182 182 $ cat normal3
183 183 normal22
184 184 $ cat large3
185 185 large22
186 186 $ cat sub/normal4
187 187 normal22
188 188 $ cat sub/large4
189 189 large22
190 190
191 191
192 192 #if serve
193 193 Test display of largefiles in hgweb
194 194
195 195 $ hg serve -d -p $HGPORT --pid-file ../hg.pid
196 196 $ cat ../hg.pid >> $DAEMON_PIDS
197 197 $ get-with-headers.py $LOCALIP:$HGPORT 'file/tip/?style=raw'
198 198 200 Script output follows
199 199
200 200
201 201 drwxr-xr-x sub
202 202 -rw-r--r-- 41 large3
203 203 -rw-r--r-- 9 normal3
204 204
205 205
206 206 $ get-with-headers.py $LOCALIP:$HGPORT 'file/tip/sub/?style=raw'
207 207 200 Script output follows
208 208
209 209
210 210 -rw-r--r-- 41 large4
211 211 -rw-r--r-- 9 normal4
212 212
213 213
214 214 $ killdaemons.py
215 215 #endif
216 216
217 217 Test largefiles can be loaded in hgweb (wrapcommand() shouldn't fail)
218 218
219 219 $ cat <<EOF > "$TESTTMP/hgweb.cgi"
220 220 > #!$PYTHON
221 221 > from mercurial import demandimport; demandimport.enable()
222 222 > from mercurial.hgweb import hgweb
223 223 > from mercurial.hgweb import wsgicgi
224 224 > application = hgweb(b'.', b'test repo')
225 225 > wsgicgi.launch(application)
226 226 > EOF
227 227 $ . "$TESTDIR/cgienv"
228 228
229 229 $ SCRIPT_NAME='' \
230 230 > "$PYTHON" "$TESTTMP/hgweb.cgi" > /dev/null
231 231
232 232 Test archiving the various revisions. These hit corner cases known with
233 233 archiving.
234 234
235 235 $ hg archive -r 0 ../archive0
236 236 $ hg archive -r 1 ../archive1
237 237 $ hg archive -r 2 ../archive2
238 238 $ hg archive -r 3 ../archive3
239 239 $ hg archive -r 4 ../archive4
240 240 $ cd ../archive0
241 241 $ cat normal1
242 242 normal1
243 243 $ cat large1
244 244 large1
245 245 $ cat sub/normal2
246 246 normal2
247 247 $ cat sub/large2
248 248 large2
249 249 $ cd ../archive1
250 250 $ cat normal1
251 251 normal11
252 252 $ cat large1
253 253 large11
254 254 $ cat sub/normal2
255 255 normal22
256 256 $ cat sub/large2
257 257 large22
258 258 $ cd ../archive2
259 259 $ ls -A
260 260 .hg_archival.txt
261 261 sub
262 262 $ cat sub/normal2
263 263 normal22
264 264 $ cat sub/large2
265 265 large22
266 266 $ cd ../archive3
267 267 $ cat normal1
268 268 normal22
269 269 $ cat large1
270 270 large22
271 271 $ cat sub/normal2
272 272 normal22
273 273 $ cat sub/large2
274 274 large22
275 275 $ cd ../archive4
276 276 $ cat normal3
277 277 normal22
278 278 $ cat large3
279 279 large22
280 280 $ cat sub/normal4
281 281 normal22
282 282 $ cat sub/large4
283 283 large22
284 284
285 285 Commit corner case: specify files to commit.
286 286
287 287 $ cd ../a
288 288 $ echo normal3 > normal3
289 289 $ echo large3 > large3
290 290 $ echo normal4 > sub/normal4
291 291 $ echo large4 > sub/large4
292 292 $ hg commit normal3 large3 sub/normal4 sub/large4 -m "edit files again"
293 293 Invoking status precommit hook
294 294 M large3
295 295 M normal3
296 296 M sub/large4
297 297 M sub/normal4
298 298 $ cat normal3
299 299 normal3
300 300 $ cat large3
301 301 large3
302 302 $ cat sub/normal4
303 303 normal4
304 304 $ cat sub/large4
305 305 large4
306 306
307 307 One more commit corner case: commit from a subdirectory.
308 308
309 309 $ cd ../a
310 310 $ echo normal33 > normal3
311 311 $ echo large33 > large3
312 312 $ echo normal44 > sub/normal4
313 313 $ echo large44 > sub/large4
314 314 $ cd sub
315 315 $ hg commit -m "edit files yet again"
316 316 Invoking status precommit hook
317 317 M large3
318 318 M normal3
319 319 M sub/large4
320 320 M sub/normal4
321 321 $ cat ../normal3
322 322 normal33
323 323 $ cat ../large3
324 324 large33
325 325 $ cat normal4
326 326 normal44
327 327 $ cat large4
328 328 large44
329 329
330 330 Committing standins is not allowed.
331 331
332 332 $ cd ..
333 333 $ echo large3 > large3
334 334 $ hg commit .hglf/large3 -m "try to commit standin"
335 335 abort: file ".hglf/large3" is a largefile standin
336 336 (commit the largefile itself instead)
337 337 [255]
338 338
339 339 Corner cases for adding largefiles.
340 340
341 341 $ echo large5 > large5
342 342 $ hg add --large large5
343 343 $ hg add --large large5
344 344 large5 already a largefile
345 345 $ mkdir sub2
346 346 $ echo large6 > sub2/large6
347 347 $ echo large7 > sub2/large7
348 348 $ hg add --large sub2
349 349 adding sub2/large6 as a largefile
350 350 adding sub2/large7 as a largefile
351 351 $ hg st
352 352 M large3
353 353 A large5
354 354 A sub2/large6
355 355 A sub2/large7
356 356
357 357 Committing directories containing only largefiles.
358 358
359 359 $ mkdir -p z/y/x/m
360 360 $ touch z/y/x/m/large1
361 361 $ touch z/y/x/large2
362 362 $ hg add --large z/y/x/m/large1 z/y/x/large2
363 363 $ hg commit -m "Subdir with directory only containing largefiles" z
364 364 Invoking status precommit hook
365 365 M large3
366 366 A large5
367 367 A sub2/large6
368 368 A sub2/large7
369 369 A z/y/x/large2
370 370 A z/y/x/m/large1
371 371
372 372 (and a bit of log testing)
373 373
374 374 $ hg log -T '{rev}\n' z/y/x/m/large1
375 375 7
376 376 $ hg log -T '{rev}\n' z/y/x/m # with only a largefile
377 377 7
378 378
379 379 $ hg rollback --quiet
380 380 $ touch z/y/x/m/normal
381 381 $ hg add z/y/x/m/normal
382 382 $ hg commit -m "Subdir with mixed contents" z
383 383 Invoking status precommit hook
384 384 M large3
385 385 A large5
386 386 A sub2/large6
387 387 A sub2/large7
388 388 A z/y/x/large2
389 389 A z/y/x/m/large1
390 390 A z/y/x/m/normal
391 391 $ hg st
392 392 M large3
393 393 A large5
394 394 A sub2/large6
395 395 A sub2/large7
396 396 $ hg rollback --quiet
397 397 $ hg revert z/y/x/large2 z/y/x/m/large1
398 398 $ rm z/y/x/large2 z/y/x/m/large1
399 399 $ hg commit -m "Subdir with normal contents" z
400 400 Invoking status precommit hook
401 401 M large3
402 402 A large5
403 403 A sub2/large6
404 404 A sub2/large7
405 405 A z/y/x/m/normal
406 406 $ hg st
407 407 M large3
408 408 A large5
409 409 A sub2/large6
410 410 A sub2/large7
411 411 $ hg rollback --quiet
412 412 $ hg revert --quiet z
413 413 $ hg commit -m "Empty subdir" z
414 414 abort: z: no match under directory!
415 415 [10]
416 416 $ rm -rf z
417 417 $ hg ci -m "standin" .hglf
418 418 abort: file ".hglf" is a largefile standin
419 419 (commit the largefile itself instead)
420 420 [255]
421 421
422 422 Test "hg status" with combination of 'file pattern' and 'directory
423 423 pattern' for largefiles:
424 424
425 425 $ hg status sub2/large6 sub2
426 426 A sub2/large6
427 427 A sub2/large7
428 428
429 429 Config settings (pattern **.dat, minsize 2 MB) are respected.
430 430
431 431 $ echo testdata > test.dat
432 432 $ dd bs=1k count=2k if=/dev/zero of=reallylarge > /dev/null 2> /dev/null
433 433 $ hg add
434 434 adding reallylarge as a largefile
435 435 adding test.dat as a largefile
436 436
437 437 Test that minsize and --lfsize handle float values;
438 438 also tests that --lfsize overrides largefiles.minsize.
439 439 (0.250 MB = 256 kB = 262144 B)
440 440
441 441 $ dd if=/dev/zero of=ratherlarge bs=1024 count=256 > /dev/null 2> /dev/null
442 442 $ dd if=/dev/zero of=medium bs=1024 count=128 > /dev/null 2> /dev/null
443 443 $ hg --config largefiles.minsize=.25 add
444 444 adding ratherlarge as a largefile
445 445 adding medium
446 446 $ hg forget medium
447 447 $ hg --config largefiles.minsize=.25 add --lfsize=.125
448 448 adding medium as a largefile
449 449 $ dd if=/dev/zero of=notlarge bs=1024 count=127 > /dev/null 2> /dev/null
450 450 $ hg --config largefiles.minsize=.25 add --lfsize=.125
451 451 adding notlarge
452 452 $ hg forget notlarge
453 453
454 454 Test forget on largefiles.
455 455
456 456 $ hg forget large3 large5 test.dat reallylarge ratherlarge medium
457 457 $ hg commit -m "add/edit more largefiles"
458 458 Invoking status precommit hook
459 459 A sub2/large6
460 460 A sub2/large7
461 461 R large3
462 462 ? large5
463 463 ? medium
464 464 ? notlarge
465 465 ? ratherlarge
466 466 ? reallylarge
467 467 ? test.dat
468 468 $ hg st
469 469 ? large3
470 470 ? large5
471 471 ? medium
472 472 ? notlarge
473 473 ? ratherlarge
474 474 ? reallylarge
475 475 ? test.dat
476 476
477 477 Purge with largefiles: verify that largefiles are still in the working
478 478 dir after a purge.
479 479
480 480 $ hg purge --all
481 481 $ cat sub/large4
482 482 large44
483 483 $ cat sub2/large6
484 484 large6
485 485 $ cat sub2/large7
486 486 large7
487 487
488 488 Test addremove: verify that files that should be added as largefiles are added as
489 489 such and that already-existing largefiles are not added as normal files by
490 490 accident.
491 491
492 492 $ rm normal3
493 493 $ rm sub/large4
494 494 $ echo "testing addremove with patterns" > testaddremove.dat
495 495 $ echo "normaladdremove" > normaladdremove
496 496 $ hg addremove
497 497 removing sub/large4
498 498 adding testaddremove.dat as a largefile
499 499 removing normal3
500 500 adding normaladdremove
501 501
502 502 Test addremove with -R
503 503
504 504 $ hg up -C
505 505 getting changed largefiles
506 506 1 largefiles updated, 0 removed
507 507 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
508 508 $ rm normal3
509 509 $ rm sub/large4
510 510 $ echo "testing addremove with patterns" > testaddremove.dat
511 511 $ echo "normaladdremove" > normaladdremove
512 512 $ cd ..
513 513 $ hg -R a -v addremove
514 514 removing sub/large4
515 515 adding testaddremove.dat as a largefile
516 516 removing normal3
517 517 adding normaladdremove
518 518 $ cd a
519 519
520 520 Test 3364
521 521 $ hg clone . ../addrm
522 522 updating to branch default
523 523 getting changed largefiles
524 524 3 largefiles updated, 0 removed
525 525 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
526 526 $ cd ../addrm
527 527 $ cat >> .hg/hgrc <<EOF
528 528 > [hooks]
529 529 > post-commit.stat=sh -c "echo \\"Invoking status postcommit hook\\"; hg status -A"
530 530 > EOF
531 531 $ touch foo
532 532 $ hg add --large foo
533 533 $ hg ci -m "add foo"
534 534 Invoking status precommit hook
535 535 A foo
536 536 Invoking status postcommit hook
537 537 C foo
538 538 C normal3
539 539 C sub/large4
540 540 C sub/normal4
541 541 C sub2/large6
542 542 C sub2/large7
543 543 $ rm foo
544 544 $ hg st
545 545 ! foo
546 546 hmm.. no precommit invoked, but there is a postcommit??
547 547 $ hg ci -m "will not checkin"
548 548 nothing changed (1 missing files, see 'hg status')
549 549 Invoking status postcommit hook
550 550 ! foo
551 551 C normal3
552 552 C sub/large4
553 553 C sub/normal4
554 554 C sub2/large6
555 555 C sub2/large7
556 556 [1]
557 557 $ hg addremove
558 558 removing foo
559 559 $ hg st
560 560 R foo
561 561 $ hg ci -m "used to say nothing changed"
562 562 Invoking status precommit hook
563 563 R foo
564 564 Invoking status postcommit hook
565 565 C normal3
566 566 C sub/large4
567 567 C sub/normal4
568 568 C sub2/large6
569 569 C sub2/large7
570 570 $ hg st
571 571
572 572 Test 3507 (both normal files and largefiles were a problem)
573 573
574 574 $ touch normal
575 575 $ touch large
576 576 $ hg add normal
577 577 $ hg add --large large
578 578 $ hg ci -m "added"
579 579 Invoking status precommit hook
580 580 A large
581 581 A normal
582 582 Invoking status postcommit hook
583 583 C large
584 584 C normal
585 585 C normal3
586 586 C sub/large4
587 587 C sub/normal4
588 588 C sub2/large6
589 589 C sub2/large7
590 590 $ hg remove normal
591 591 $ hg addremove --traceback
592 592 $ hg ci -m "addremoved normal"
593 593 Invoking status precommit hook
594 594 R normal
595 595 Invoking status postcommit hook
596 596 C large
597 597 C normal3
598 598 C sub/large4
599 599 C sub/normal4
600 600 C sub2/large6
601 601 C sub2/large7
602 602 $ hg up -C '.^'
603 603 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
604 604 $ hg remove large
605 605 $ hg addremove --traceback
606 606 $ hg ci -m "removed large"
607 607 Invoking status precommit hook
608 608 R large
609 609 created new head
610 610 Invoking status postcommit hook
611 611 C normal
612 612 C normal3
613 613 C sub/large4
614 614 C sub/normal4
615 615 C sub2/large6
616 616 C sub2/large7
617 617
618 618 Test commit -A (issue3542)
619 619 $ echo large8 > large8
620 620 $ hg add --large large8
621 621 $ hg ci -Am 'this used to add large8 as normal and commit both'
622 622 Invoking status precommit hook
623 623 A large8
624 624 Invoking status postcommit hook
625 625 C large8
626 626 C normal
627 627 C normal3
628 628 C sub/large4
629 629 C sub/normal4
630 630 C sub2/large6
631 631 C sub2/large7
632 632 $ rm large8
633 633 $ hg ci -Am 'this used to not notice the rm'
634 634 removing large8
635 635 Invoking status precommit hook
636 636 R large8
637 637 Invoking status postcommit hook
638 638 C normal
639 639 C normal3
640 640 C sub/large4
641 641 C sub/normal4
642 642 C sub2/large6
643 643 C sub2/large7
644 644
645 645 Test that a standin can't be added as a large file
646 646
647 647 $ touch large
648 648 $ hg add --large large
649 649 $ hg ci -m "add"
650 650 Invoking status precommit hook
651 651 A large
652 652 Invoking status postcommit hook
653 653 C large
654 654 C normal
655 655 C normal3
656 656 C sub/large4
657 657 C sub/normal4
658 658 C sub2/large6
659 659 C sub2/large7
660 660 $ hg remove large
661 661 $ touch large
662 662 $ hg addremove --config largefiles.patterns=**large --traceback
663 663 adding large as a largefile
664 664
665 665 Test that outgoing --large works (with revsets too)
666 666 $ hg outgoing --rev '.^' --large
667 667 comparing with $TESTTMP/a
668 668 searching for changes
669 669 changeset: 8:c02fd3b77ec4
670 670 user: test
671 671 date: Thu Jan 01 00:00:00 1970 +0000
672 672 summary: add foo
673 673
674 674 changeset: 9:289dd08c9bbb
675 675 user: test
676 676 date: Thu Jan 01 00:00:00 1970 +0000
677 677 summary: used to say nothing changed
678 678
679 679 changeset: 10:34f23ac6ac12
680 680 user: test
681 681 date: Thu Jan 01 00:00:00 1970 +0000
682 682 summary: added
683 683
684 684 changeset: 12:710c1b2f523c
685 685 parent: 10:34f23ac6ac12
686 686 user: test
687 687 date: Thu Jan 01 00:00:00 1970 +0000
688 688 summary: removed large
689 689
690 690 changeset: 13:0a3e75774479
691 691 user: test
692 692 date: Thu Jan 01 00:00:00 1970 +0000
693 693 summary: this used to add large8 as normal and commit both
694 694
695 695 changeset: 14:84f3d378175c
696 696 user: test
697 697 date: Thu Jan 01 00:00:00 1970 +0000
698 698 summary: this used to not notice the rm
699 699
700 700 largefiles to upload (1 entities):
701 701 large8
702 702
703 703 $ cd ../a
704 704
705 705 Clone a largefiles repo.
706 706
707 707 $ hg clone . ../b
708 708 updating to branch default
709 709 getting changed largefiles
710 710 3 largefiles updated, 0 removed
711 711 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
712 712 $ cd ../b
713 713 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
714 714 7:daea875e9014 add/edit more largefiles
715 715 6:4355d653f84f edit files yet again
716 716 5:9d5af5072dbd edit files again
717 717 4:74c02385b94c move files
718 718 3:9e8fbc4bce62 copy files
719 719 2:51a0ae4d5864 remove files
720 720 1:ce8896473775 edit files
721 721 0:30d30fe6a5be add files
722 722 $ cat normal3
723 723 normal33
724 724
725 725 Test graph log
726 726
727 727 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n'
728 728 @ 7:daea875e9014 add/edit more largefiles
729 729 |
730 730 o 6:4355d653f84f edit files yet again
731 731 |
732 732 o 5:9d5af5072dbd edit files again
733 733 |
734 734 o 4:74c02385b94c move files
735 735 |
736 736 o 3:9e8fbc4bce62 copy files
737 737 |
738 738 o 2:51a0ae4d5864 remove files
739 739 |
740 740 o 1:ce8896473775 edit files
741 741 |
742 742 o 0:30d30fe6a5be add files
743 743
744 744
745 745 Test log with --patch
746 746
747 747 $ hg log --patch -r 6::7
748 748 changeset: 6:4355d653f84f
749 749 user: test
750 750 date: Thu Jan 01 00:00:00 1970 +0000
751 751 summary: edit files yet again
752 752
753 753 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/large3
754 754 --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
755 755 +++ b/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
756 756 @@ -1,1 +1,1 @@
757 757 -baaf12afde9d8d67f25dab6dced0d2bf77dba47c
758 758 +7838695e10da2bb75ac1156565f40a2595fa2fa0
759 759 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4
760 760 --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
761 761 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
762 762 @@ -1,1 +1,1 @@
763 763 -aeb2210d19f02886dde00dac279729a48471e2f9
764 764 +971fb41e78fea4f8e0ba5244784239371cb00591
765 765 diff -r 9d5af5072dbd -r 4355d653f84f normal3
766 766 --- a/normal3 Thu Jan 01 00:00:00 1970 +0000
767 767 +++ b/normal3 Thu Jan 01 00:00:00 1970 +0000
768 768 @@ -1,1 +1,1 @@
769 769 -normal3
770 770 +normal33
771 771 diff -r 9d5af5072dbd -r 4355d653f84f sub/normal4
772 772 --- a/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
773 773 +++ b/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
774 774 @@ -1,1 +1,1 @@
775 775 -normal4
776 776 +normal44
777 777
778 778 changeset: 7:daea875e9014
779 779 tag: tip
780 780 user: test
781 781 date: Thu Jan 01 00:00:00 1970 +0000
782 782 summary: add/edit more largefiles
783 783
784 784 diff -r 4355d653f84f -r daea875e9014 .hglf/large3
785 785 --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
786 786 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
787 787 @@ -1,1 +0,0 @@
788 788 -7838695e10da2bb75ac1156565f40a2595fa2fa0
789 789 diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large6
790 790 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
791 791 +++ b/.hglf/sub2/large6 Thu Jan 01 00:00:00 1970 +0000
792 792 @@ -0,0 +1,1 @@
793 793 +0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30
794 794 diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large7
795 795 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
796 796 +++ b/.hglf/sub2/large7 Thu Jan 01 00:00:00 1970 +0000
797 797 @@ -0,0 +1,1 @@
798 798 +bb3151689acb10f0c3125c560d5e63df914bc1af
799 799
800 800
801 801 $ hg log --patch -r 6::7 sub/
802 802 changeset: 6:4355d653f84f
803 803 user: test
804 804 date: Thu Jan 01 00:00:00 1970 +0000
805 805 summary: edit files yet again
806 806
807 807 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4
808 808 --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
809 809 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
810 810 @@ -1,1 +1,1 @@
811 811 -aeb2210d19f02886dde00dac279729a48471e2f9
812 812 +971fb41e78fea4f8e0ba5244784239371cb00591
813 813 diff -r 9d5af5072dbd -r 4355d653f84f sub/normal4
814 814 --- a/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
815 815 +++ b/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
816 816 @@ -1,1 +1,1 @@
817 817 -normal4
818 818 +normal44
819 819
820 820
821 821 log with both --follow and --patch
822 822
823 823 $ hg log --follow --patch --limit 2
824 824 changeset: 7:daea875e9014
825 825 tag: tip
826 826 user: test
827 827 date: Thu Jan 01 00:00:00 1970 +0000
828 828 summary: add/edit more largefiles
829 829
830 830 diff -r 4355d653f84f -r daea875e9014 .hglf/large3
831 831 --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
832 832 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
833 833 @@ -1,1 +0,0 @@
834 834 -7838695e10da2bb75ac1156565f40a2595fa2fa0
835 835 diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large6
836 836 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
837 837 +++ b/.hglf/sub2/large6 Thu Jan 01 00:00:00 1970 +0000
838 838 @@ -0,0 +1,1 @@
839 839 +0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30
840 840 diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large7
841 841 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
842 842 +++ b/.hglf/sub2/large7 Thu Jan 01 00:00:00 1970 +0000
843 843 @@ -0,0 +1,1 @@
844 844 +bb3151689acb10f0c3125c560d5e63df914bc1af
845 845
846 846 changeset: 6:4355d653f84f
847 847 user: test
848 848 date: Thu Jan 01 00:00:00 1970 +0000
849 849 summary: edit files yet again
850 850
851 851 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/large3
852 852 --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
853 853 +++ b/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
854 854 @@ -1,1 +1,1 @@
855 855 -baaf12afde9d8d67f25dab6dced0d2bf77dba47c
856 856 +7838695e10da2bb75ac1156565f40a2595fa2fa0
857 857 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4
858 858 --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
859 859 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
860 860 @@ -1,1 +1,1 @@
861 861 -aeb2210d19f02886dde00dac279729a48471e2f9
862 862 +971fb41e78fea4f8e0ba5244784239371cb00591
863 863 diff -r 9d5af5072dbd -r 4355d653f84f normal3
864 864 --- a/normal3 Thu Jan 01 00:00:00 1970 +0000
865 865 +++ b/normal3 Thu Jan 01 00:00:00 1970 +0000
866 866 @@ -1,1 +1,1 @@
867 867 -normal3
868 868 +normal33
869 869 diff -r 9d5af5072dbd -r 4355d653f84f sub/normal4
870 870 --- a/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
871 871 +++ b/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
872 872 @@ -1,1 +1,1 @@
873 873 -normal4
874 874 +normal44
875 875
876 876 $ hg log --follow --patch sub/large4
877 877 changeset: 6:4355d653f84f
878 878 user: test
879 879 date: Thu Jan 01 00:00:00 1970 +0000
880 880 summary: edit files yet again
881 881
882 882 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4
883 883 --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
884 884 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
885 885 @@ -1,1 +1,1 @@
886 886 -aeb2210d19f02886dde00dac279729a48471e2f9
887 887 +971fb41e78fea4f8e0ba5244784239371cb00591
888 888
889 889 changeset: 5:9d5af5072dbd
890 890 user: test
891 891 date: Thu Jan 01 00:00:00 1970 +0000
892 892 summary: edit files again
893 893
894 894 diff -r 74c02385b94c -r 9d5af5072dbd .hglf/sub/large4
895 895 --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
896 896 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
897 897 @@ -1,1 +1,1 @@
898 898 -eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
899 899 +aeb2210d19f02886dde00dac279729a48471e2f9
900 900
901 901 changeset: 4:74c02385b94c
902 902 user: test
903 903 date: Thu Jan 01 00:00:00 1970 +0000
904 904 summary: move files
905 905
906 906 diff -r 9e8fbc4bce62 -r 74c02385b94c .hglf/sub/large4
907 907 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
908 908 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
909 909 @@ -0,0 +1,1 @@
910 910 +eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
911 911
912 912 changeset: 1:ce8896473775
913 913 user: test
914 914 date: Thu Jan 01 00:00:00 1970 +0000
915 915 summary: edit files
916 916
917 917 diff -r 30d30fe6a5be -r ce8896473775 .hglf/sub/large2
918 918 --- a/.hglf/sub/large2 Thu Jan 01 00:00:00 1970 +0000
919 919 +++ b/.hglf/sub/large2 Thu Jan 01 00:00:00 1970 +0000
920 920 @@ -1,1 +1,1 @@
921 921 -1deebade43c8c498a3c8daddac0244dc55d1331d
922 922 +eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
923 923
924 924 changeset: 0:30d30fe6a5be
925 925 user: test
926 926 date: Thu Jan 01 00:00:00 1970 +0000
927 927 summary: add files
928 928
929 929 diff -r 000000000000 -r 30d30fe6a5be .hglf/sub/large2
930 930 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
931 931 +++ b/.hglf/sub/large2 Thu Jan 01 00:00:00 1970 +0000
932 932 @@ -0,0 +1,1 @@
933 933 +1deebade43c8c498a3c8daddac0244dc55d1331d
934 934
935 935 $ cat sub/normal4
936 936 normal44
937 937 $ cat sub/large4
938 938 large44
939 939 $ cat sub2/large6
940 940 large6
941 941 $ cat sub2/large7
942 942 large7
943 943 $ hg log -qf sub2/large7
944 944 7:daea875e9014
945 945 $ hg log -Gqf sub2/large7
946 946 @ 7:daea875e9014
947 947 |
948 948 ~
949 949 $ cd ..
950 950
951 951 Test log from outside repo
952 952
953 953 $ hg log b/sub -T '{rev}:{node|short} {desc|firstline}\n'
954 954 6:4355d653f84f edit files yet again
955 955 5:9d5af5072dbd edit files again
956 956 4:74c02385b94c move files
957 957 1:ce8896473775 edit files
958 958 0:30d30fe6a5be add files
959 959
960 960 Test clone at revision
961 961
962 962 $ hg clone a -r 3 c
963 963 adding changesets
964 964 adding manifests
965 965 adding file changes
966 966 added 4 changesets with 10 changes to 4 files
967 967 new changesets 30d30fe6a5be:9e8fbc4bce62 (4 drafts)
968 968 updating to branch default
969 969 getting changed largefiles
970 970 2 largefiles updated, 0 removed
971 971 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
972 972 $ cd c
973 973 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
974 974 3:9e8fbc4bce62 copy files
975 975 2:51a0ae4d5864 remove files
976 976 1:ce8896473775 edit files
977 977 0:30d30fe6a5be add files
978 978 $ cat normal1
979 979 normal22
980 980 $ cat large1
981 981 large22
982 982 $ cat sub/normal2
983 983 normal22
984 984 $ cat sub/large2
985 985 large22
986 986
987 987 Old revisions of a clone have correct largefiles content (this also
988 988 tests update).
989 989
990 990 $ hg update -r 1
991 991 getting changed largefiles
992 992 1 largefiles updated, 0 removed
993 993 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
994 994 $ cat large1
995 995 large11
996 996 $ cat sub/large2
997 997 large22
998 998 $ cd ..
999 999
1000 1000 Test cloning with --all-largefiles flag
1001 1001
1002 1002 $ rm "${USERCACHE}"/*
1003 1003 $ hg clone --all-largefiles a a-backup
1004 1004 updating to branch default
1005 1005 getting changed largefiles
1006 1006 3 largefiles updated, 0 removed
1007 1007 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1008 1008 7 additional largefiles cached
1009 1009
1010 1010 $ rm "${USERCACHE}"/*
1011 1011 $ hg clone --all-largefiles -u 0 a a-clone0
1012 1012 updating to branch default
1013 1013 getting changed largefiles
1014 1014 2 largefiles updated, 0 removed
1015 1015 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1016 1016 8 additional largefiles cached
1017 1017 $ hg -R a-clone0 sum
1018 1018 parent: 0:30d30fe6a5be
1019 1019 add files
1020 1020 branch: default
1021 1021 commit: (clean)
1022 1022 update: 7 new changesets (update)
1023 1023 phases: 8 draft
1024 1024
1025 1025 $ rm "${USERCACHE}"/*
1026 1026 $ hg clone --all-largefiles -u 1 a a-clone1
1027 1027 updating to branch default
1028 1028 getting changed largefiles
1029 1029 2 largefiles updated, 0 removed
1030 1030 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1031 1031 8 additional largefiles cached
1032 1032 $ hg -R a-clone1 verify --large --lfa --lfc
1033 1033 checking changesets
1034 1034 checking manifests
1035 1035 crosschecking files in changesets and manifests
1036 1036 checking files
1037 1037 checked 8 changesets with 24 changes to 10 files
1038 1038 searching 8 changesets for largefiles
1039 1039 verified contents of 13 revisions of 6 largefiles
1040 1040 $ hg -R a-clone1 sum
1041 1041 parent: 1:ce8896473775
1042 1042 edit files
1043 1043 branch: default
1044 1044 commit: (clean)
1045 1045 update: 6 new changesets (update)
1046 1046 phases: 8 draft
1047 1047
1048 1048 $ rm "${USERCACHE}"/*
1049 1049 $ hg clone --all-largefiles -U a a-clone-u
1050 1050 10 additional largefiles cached
1051 1051 $ hg -R a-clone-u sum
1052 1052 parent: -1:000000000000 (no revision checked out)
1053 1053 branch: default
1054 1054 commit: (clean)
1055 1055 update: 8 new changesets (update)
1056 1056 phases: 8 draft
1057 1057
1058 1058 Show computed destination directory:
1059 1059
1060 1060 $ mkdir xyz
1061 1061 $ cd xyz
1062 1062 $ hg clone ../a
1063 1063 destination directory: a
1064 1064 updating to branch default
1065 1065 getting changed largefiles
1066 1066 3 largefiles updated, 0 removed
1067 1067 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1068 1068 $ cd ..
1069 1069
1070 1070 Clone URL without path:
1071 1071
1072 1072 $ hg clone file://
1073 1073 abort: repository / not found
1074 1074 [255]
1075 1075
1076 1076 Ensure base clone command argument validation
1077 1077
1078 1078 $ hg clone -U -u 0 a a-clone-failure
1079 1079 abort: cannot specify both --noupdate and --updaterev
1080 1080 [10]
1081 1081
1082 1082 $ hg clone --all-largefiles a ssh://localhost/a
1083 1083 abort: --all-largefiles is incompatible with non-local destination ssh://localhost/a
1084 1084 [255]
1085 1085
1086 1086 Test pulling with --all-largefiles flag. Also test that the largefiles are
1087 1087 downloaded from 'default' instead of 'default-push' when no source is specified
1088 1088 (issue3584)
1089 1089
1090 1090 $ rm -Rf a-backup
1091 1091 $ hg clone -r 1 a a-backup
1092 1092 adding changesets
1093 1093 adding manifests
1094 1094 adding file changes
1095 1095 added 2 changesets with 8 changes to 4 files
1096 1096 new changesets 30d30fe6a5be:ce8896473775 (2 drafts)
1097 1097 updating to branch default
1098 1098 getting changed largefiles
1099 1099 2 largefiles updated, 0 removed
1100 1100 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1101 1101 $ rm "${USERCACHE}"/*
1102 1102 $ cd a-backup
1103 1103 $ hg pull --all-largefiles --config paths.default-push=bogus/path
1104 1104 pulling from $TESTTMP/a
1105 1105 searching for changes
1106 1106 adding changesets
1107 1107 adding manifests
1108 1108 adding file changes
1109 1109 added 6 changesets with 16 changes to 8 files
1110 1110 new changesets 51a0ae4d5864:daea875e9014 (6 drafts)
1111 1111 (run 'hg update' to get a working copy)
1112 1112 6 largefiles cached
1113 1113
1114 1114 redo pull with --lfrev and check it pulls largefiles for the right revs
1115 1115
1116 1116 $ hg rollback
1117 1117 repository tip rolled back to revision 1 (undo pull)
1118 1118 $ hg pull -v --lfrev 'heads(pulled())+min(pulled())'
1119 1119 pulling from $TESTTMP/a
1120 1120 searching for changes
1121 1121 all local changesets known remotely
1122 1122 6 changesets found
1123 1123 uncompressed size of bundle content:
1124 1124 1389 (changelog)
1125 1599 (manifests)
1125 1698 (manifests)
1126 1126 254 .hglf/large1
1127 1127 564 .hglf/large3
1128 1128 572 .hglf/sub/large4
1129 1129 182 .hglf/sub2/large6
1130 1130 182 .hglf/sub2/large7
1131 1131 212 normal1
1132 1132 457 normal3
1133 1133 465 sub/normal4
1134 1134 adding changesets
1135 1135 adding manifests
1136 1136 adding file changes
1137 1137 added 6 changesets with 16 changes to 8 files
1138 1138 new changesets 51a0ae4d5864:daea875e9014 (6 drafts)
1139 1139 calling hook changegroup.lfiles: hgext.largefiles.reposetup.checkrequireslfiles
1140 1140 (run 'hg update' to get a working copy)
1141 1141 pulling largefiles for revision 7
1142 1142 found 971fb41e78fea4f8e0ba5244784239371cb00591 in store
1143 1143 found 0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30 in store
1144 1144 found bb3151689acb10f0c3125c560d5e63df914bc1af in store
1145 1145 pulling largefiles for revision 2
1146 1146 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
1147 1147 0 largefiles cached
1148 1148
1149 1149 lfpull
1150 1150
1151 1151 $ hg lfpull -r : --config largefiles.usercache=usercache-lfpull
1152 1152 2 largefiles cached
1153 1153 $ hg lfpull -v -r 4+2 --config largefiles.usercache=usercache-lfpull
1154 1154 pulling largefiles for revision 4
1155 1155 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
1156 1156 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
1157 1157 pulling largefiles for revision 2
1158 1158 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
1159 1159 0 largefiles cached
1160 1160
1161 1161 $ ls usercache-lfpull/* | sort
1162 1162 usercache-lfpull/1deebade43c8c498a3c8daddac0244dc55d1331d
1163 1163 usercache-lfpull/4669e532d5b2c093a78eca010077e708a071bb64
1164 1164
1165 1165 $ cd ..
1166 1166
1167 1167 Rebasing between two repositories does not revert largefiles to old
1168 1168 revisions (this was a very bad bug that took a lot of work to fix).
1169 1169
1170 1170 $ hg clone a d
1171 1171 updating to branch default
1172 1172 getting changed largefiles
1173 1173 3 largefiles updated, 0 removed
1174 1174 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1175 1175 $ cd b
1176 1176 $ echo large4-modified > sub/large4
1177 1177 $ echo normal3-modified > normal3
1178 1178 $ hg commit -m "modify normal file and largefile in repo b"
1179 1179 Invoking status precommit hook
1180 1180 M normal3
1181 1181 M sub/large4
1182 1182 $ cd ../d
1183 1183 $ echo large6-modified > sub2/large6
1184 1184 $ echo normal4-modified > sub/normal4
1185 1185 $ hg commit -m "modify normal file largefile in repo d"
1186 1186 Invoking status precommit hook
1187 1187 M sub/normal4
1188 1188 M sub2/large6
1189 1189 $ cd ..
1190 1190 $ hg clone d e
1191 1191 updating to branch default
1192 1192 getting changed largefiles
1193 1193 3 largefiles updated, 0 removed
1194 1194 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1195 1195 $ cd d
1196 1196
1197 1197 More rebase testing, but also test that the largefiles are downloaded from
1198 1198 'default-push' when no source is specified (issue3584). (The largefile from the
1199 1199 pulled revision is however not downloaded but found in the local cache.)
1200 1200 Largefiles are fetched for the new pulled revision, not for existing revisions,
1201 1201 rebased or not.
1202 1202
1203 1203 $ [ ! -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ]
1204 1204 $ hg pull --rebase --all-largefiles --config paths.default-push=bogus/path --config paths.default=../b
1205 1205 pulling from $TESTTMP/b
1206 1206 searching for changes
1207 1207 adding changesets
1208 1208 adding manifests
1209 1209 adding file changes
1210 1210 added 1 changesets with 2 changes to 2 files (+1 heads)
1211 1211 new changesets a381d2c8c80e (1 drafts)
1212 1212 0 largefiles cached
1213 1213 rebasing 8:f574fb32bb45 "modify normal file largefile in repo d"
1214 1214 Invoking status precommit hook
1215 1215 M sub/normal4
1216 1216 M sub2/large6
1217 1217 saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-dd1d9f80-rebase.hg
1218 1218 $ [ -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ]
1219 1219 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1220 1220 9:598410d3eb9a modify normal file largefile in repo d
1221 1221 8:a381d2c8c80e modify normal file and largefile in repo b
1222 1222 7:daea875e9014 add/edit more largefiles
1223 1223 6:4355d653f84f edit files yet again
1224 1224 5:9d5af5072dbd edit files again
1225 1225 4:74c02385b94c move files
1226 1226 3:9e8fbc4bce62 copy files
1227 1227 2:51a0ae4d5864 remove files
1228 1228 1:ce8896473775 edit files
1229 1229 0:30d30fe6a5be add files
1230 1230 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n'
1231 1231 @ 9:598410d3eb9a modify normal file largefile in repo d
1232 1232 |
1233 1233 o 8:a381d2c8c80e modify normal file and largefile in repo b
1234 1234 |
1235 1235 o 7:daea875e9014 add/edit more largefiles
1236 1236 |
1237 1237 o 6:4355d653f84f edit files yet again
1238 1238 |
1239 1239 o 5:9d5af5072dbd edit files again
1240 1240 |
1241 1241 o 4:74c02385b94c move files
1242 1242 |
1243 1243 o 3:9e8fbc4bce62 copy files
1244 1244 |
1245 1245 o 2:51a0ae4d5864 remove files
1246 1246 |
1247 1247 o 1:ce8896473775 edit files
1248 1248 |
1249 1249 o 0:30d30fe6a5be add files
1250 1250
1251 1251 $ cat normal3
1252 1252 normal3-modified
1253 1253 $ cat sub/normal4
1254 1254 normal4-modified
1255 1255 $ cat sub/large4
1256 1256 large4-modified
1257 1257 $ cat sub2/large6
1258 1258 large6-modified
1259 1259 $ cat sub2/large7
1260 1260 large7
1261 1261 $ cd ../e
1262 1262 $ hg pull ../b
1263 1263 pulling from ../b
1264 1264 searching for changes
1265 1265 adding changesets
1266 1266 adding manifests
1267 1267 adding file changes
1268 1268 added 1 changesets with 2 changes to 2 files (+1 heads)
1269 1269 new changesets a381d2c8c80e (1 drafts)
1270 1270 (run 'hg heads' to see heads, 'hg merge' to merge)
1271 1271 $ hg rebase
1272 1272 rebasing 8:f574fb32bb45 "modify normal file largefile in repo d"
1273 1273 Invoking status precommit hook
1274 1274 M sub/normal4
1275 1275 M sub2/large6
1276 1276 saved backup bundle to $TESTTMP/e/.hg/strip-backup/f574fb32bb45-dd1d9f80-rebase.hg
1277 1277 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1278 1278 9:598410d3eb9a modify normal file largefile in repo d
1279 1279 8:a381d2c8c80e modify normal file and largefile in repo b
1280 1280 7:daea875e9014 add/edit more largefiles
1281 1281 6:4355d653f84f edit files yet again
1282 1282 5:9d5af5072dbd edit files again
1283 1283 4:74c02385b94c move files
1284 1284 3:9e8fbc4bce62 copy files
1285 1285 2:51a0ae4d5864 remove files
1286 1286 1:ce8896473775 edit files
1287 1287 0:30d30fe6a5be add files
1288 1288 $ cat normal3
1289 1289 normal3-modified
1290 1290 $ cat sub/normal4
1291 1291 normal4-modified
1292 1292 $ cat sub/large4
1293 1293 large4-modified
1294 1294 $ cat sub2/large6
1295 1295 large6-modified
1296 1296 $ cat sub2/large7
1297 1297 large7
1298 1298
1299 1299 Log on largefiles
1300 1300
1301 1301 - same output
1302 1302 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4
1303 1303 8:a381d2c8c80e modify normal file and largefile in repo b
1304 1304 6:4355d653f84f edit files yet again
1305 1305 5:9d5af5072dbd edit files again
1306 1306 4:74c02385b94c move files
1307 1307 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4
1308 1308 o 8:a381d2c8c80e modify normal file and largefile in repo b
1309 1309 :
1310 1310 o 6:4355d653f84f edit files yet again
1311 1311 |
1312 1312 o 5:9d5af5072dbd edit files again
1313 1313 |
1314 1314 o 4:74c02385b94c move files
1315 1315 |
1316 1316 ~
1317 1317 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub/large4
1318 1318 8:a381d2c8c80e modify normal file and largefile in repo b
1319 1319 6:4355d653f84f edit files yet again
1320 1320 5:9d5af5072dbd edit files again
1321 1321 4:74c02385b94c move files
1322 1322 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4
1323 1323 o 8:a381d2c8c80e modify normal file and largefile in repo b
1324 1324 :
1325 1325 o 6:4355d653f84f edit files yet again
1326 1326 |
1327 1327 o 5:9d5af5072dbd edit files again
1328 1328 |
1329 1329 o 4:74c02385b94c move files
1330 1330 |
1331 1331 ~
1332 1332
1333 1333 - .hglf only matches largefiles, without .hglf it matches 9 bco sub/normal
1334 1334 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub
1335 1335 8:a381d2c8c80e modify normal file and largefile in repo b
1336 1336 6:4355d653f84f edit files yet again
1337 1337 5:9d5af5072dbd edit files again
1338 1338 4:74c02385b94c move files
1339 1339 1:ce8896473775 edit files
1340 1340 0:30d30fe6a5be add files
1341 1341 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub
1342 1342 o 8:a381d2c8c80e modify normal file and largefile in repo b
1343 1343 :
1344 1344 o 6:4355d653f84f edit files yet again
1345 1345 |
1346 1346 o 5:9d5af5072dbd edit files again
1347 1347 |
1348 1348 o 4:74c02385b94c move files
1349 1349 :
1350 1350 o 1:ce8896473775 edit files
1351 1351 |
1352 1352 o 0:30d30fe6a5be add files
1353 1353
1354 1354 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub
1355 1355 9:598410d3eb9a modify normal file largefile in repo d
1356 1356 8:a381d2c8c80e modify normal file and largefile in repo b
1357 1357 6:4355d653f84f edit files yet again
1358 1358 5:9d5af5072dbd edit files again
1359 1359 4:74c02385b94c move files
1360 1360 1:ce8896473775 edit files
1361 1361 0:30d30fe6a5be add files
1362 1362 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' sub
1363 1363 @ 9:598410d3eb9a modify normal file largefile in repo d
1364 1364 |
1365 1365 o 8:a381d2c8c80e modify normal file and largefile in repo b
1366 1366 :
1367 1367 o 6:4355d653f84f edit files yet again
1368 1368 |
1369 1369 o 5:9d5af5072dbd edit files again
1370 1370 |
1371 1371 o 4:74c02385b94c move files
1372 1372 :
1373 1373 o 1:ce8896473775 edit files
1374 1374 |
1375 1375 o 0:30d30fe6a5be add files
1376 1376
1377 1377 - globbing gives same result
1378 1378 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' 'glob:sub/*'
1379 1379 9:598410d3eb9a modify normal file largefile in repo d
1380 1380 8:a381d2c8c80e modify normal file and largefile in repo b
1381 1381 6:4355d653f84f edit files yet again
1382 1382 5:9d5af5072dbd edit files again
1383 1383 4:74c02385b94c move files
1384 1384 1:ce8896473775 edit files
1385 1385 0:30d30fe6a5be add files
1386 1386 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' 'glob:sub/*'
1387 1387 @ 9:598410d3eb9a modify normal file largefile in repo d
1388 1388 |
1389 1389 o 8:a381d2c8c80e modify normal file and largefile in repo b
1390 1390 :
1391 1391 o 6:4355d653f84f edit files yet again
1392 1392 |
1393 1393 o 5:9d5af5072dbd edit files again
1394 1394 |
1395 1395 o 4:74c02385b94c move files
1396 1396 :
1397 1397 o 1:ce8896473775 edit files
1398 1398 |
1399 1399 o 0:30d30fe6a5be add files
1400 1400
1401 1401 Rollback on largefiles.
1402 1402
1403 1403 $ echo large4-modified-again > sub/large4
1404 1404 $ hg commit -m "Modify large4 again"
1405 1405 Invoking status precommit hook
1406 1406 M sub/large4
1407 1407 $ hg rollback
1408 1408 repository tip rolled back to revision 9 (undo commit)
1409 1409 working directory now based on revision 9
1410 1410 $ hg st
1411 1411 M sub/large4
1412 1412 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1413 1413 9:598410d3eb9a modify normal file largefile in repo d
1414 1414 8:a381d2c8c80e modify normal file and largefile in repo b
1415 1415 7:daea875e9014 add/edit more largefiles
1416 1416 6:4355d653f84f edit files yet again
1417 1417 5:9d5af5072dbd edit files again
1418 1418 4:74c02385b94c move files
1419 1419 3:9e8fbc4bce62 copy files
1420 1420 2:51a0ae4d5864 remove files
1421 1421 1:ce8896473775 edit files
1422 1422 0:30d30fe6a5be add files
1423 1423 $ cat sub/large4
1424 1424 large4-modified-again
1425 1425
1426 1426 "update --check" refuses to update with uncommitted changes.
1427 1427 $ hg update --check 8
1428 1428 abort: uncommitted changes
1429 1429 [255]
1430 1430
1431 1431 "update --clean" leaves correct largefiles in working copy, even when there is
1432 1432 .orig files from revert in .hglf.
1433 1433
1434 1434 $ echo mistake > sub2/large7
1435 1435 $ hg revert sub2/large7
1436 1436 $ cat sub2/large7
1437 1437 large7
1438 1438 $ cat sub2/large7.orig
1439 1439 mistake
1440 1440 $ test ! -f .hglf/sub2/large7.orig
1441 1441
1442 1442 $ hg -q update --clean -r null
1443 1443 $ hg update --clean
1444 1444 getting changed largefiles
1445 1445 3 largefiles updated, 0 removed
1446 1446 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1447 1447 $ cat normal3
1448 1448 normal3-modified
1449 1449 $ cat sub/normal4
1450 1450 normal4-modified
1451 1451 $ cat sub/large4
1452 1452 large4-modified
1453 1453 $ cat sub2/large6
1454 1454 large6-modified
1455 1455 $ cat sub2/large7
1456 1456 large7
1457 1457 $ cat sub2/large7.orig
1458 1458 mistake
1459 1459 $ test ! -f .hglf/sub2/large7.orig
1460 1460
1461 1461 verify that largefile .orig file no longer is overwritten on every update -C:
1462 1462 $ hg update --clean
1463 1463 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1464 1464 $ cat sub2/large7.orig
1465 1465 mistake
1466 1466 $ rm sub2/large7.orig
1467 1467
1468 1468 Now "update check" is happy.
1469 1469 $ hg update --check 8
1470 1470 getting changed largefiles
1471 1471 1 largefiles updated, 0 removed
1472 1472 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1473 1473 $ hg update --check
1474 1474 getting changed largefiles
1475 1475 1 largefiles updated, 0 removed
1476 1476 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1477 1477
1478 1478 Test removing empty largefiles directories on update
1479 1479 $ test -d sub2 && echo "sub2 exists"
1480 1480 sub2 exists
1481 1481 $ hg update -q null
1482 1482 $ test -d sub2 && echo "error: sub2 should not exist anymore"
1483 1483 [1]
1484 1484 $ hg update -q
1485 1485
1486 1486 Test hg remove removes empty largefiles directories
1487 1487 $ test -d sub2 && echo "sub2 exists"
1488 1488 sub2 exists
1489 1489 $ hg remove sub2/*
1490 1490 $ test -d sub2 && echo "error: sub2 should not exist anymore"
1491 1491 [1]
1492 1492 $ hg revert sub2/large6 sub2/large7
1493 1493
1494 1494 "revert" works on largefiles (and normal files too).
1495 1495 $ echo hack3 >> normal3
1496 1496 $ echo hack4 >> sub/normal4
1497 1497 $ echo hack4 >> sub/large4
1498 1498 $ rm sub2/large6
1499 1499 $ hg revert sub2/large6
1500 1500 $ hg rm sub2/large6
1501 1501 $ echo new >> sub2/large8
1502 1502 $ hg add --large sub2/large8
1503 1503 # XXX we don't really want to report that we're reverting the standin;
1504 1504 # that's just an implementation detail. But I don't see an obvious fix. ;-(
1505 1505 $ hg revert sub
1506 1506 reverting .hglf/sub/large4
1507 1507 reverting sub/normal4
1508 1508 $ hg status
1509 1509 M normal3
1510 1510 A sub2/large8
1511 1511 R sub2/large6
1512 1512 ? sub/large4.orig
1513 1513 ? sub/normal4.orig
1514 1514 $ cat sub/normal4
1515 1515 normal4-modified
1516 1516 $ cat sub/large4
1517 1517 large4-modified
1518 1518 $ hg revert -a --no-backup
1519 1519 forgetting .hglf/sub2/large8
1520 1520 reverting normal3
1521 1521 undeleting .hglf/sub2/large6
1522 1522 $ hg status
1523 1523 ? sub/large4.orig
1524 1524 ? sub/normal4.orig
1525 1525 ? sub2/large8
1526 1526 $ cat normal3
1527 1527 normal3-modified
1528 1528 $ cat sub2/large6
1529 1529 large6-modified
1530 1530 $ rm sub/*.orig sub2/large8
1531 1531
1532 1532 revert some files to an older revision
1533 1533 $ hg revert --no-backup -r 8 sub2
1534 1534 reverting .hglf/sub2/large6
1535 1535 $ cat sub2/large6
1536 1536 large6
1537 1537 $ hg revert --no-backup -C -r '.^' sub2
1538 1538 $ hg revert --no-backup sub2
1539 1539 reverting .hglf/sub2/large6
1540 1540 $ hg status
1541 1541
1542 1542 "verify --large" actually verifies largefiles
1543 1543
1544 1544 - Where Do We Come From? What Are We? Where Are We Going?
1545 1545 $ pwd
1546 1546 $TESTTMP/e
1547 1547 $ hg paths
1548 1548 default = $TESTTMP/d
1549 1549
1550 1550 $ hg verify --large
1551 1551 checking changesets
1552 1552 checking manifests
1553 1553 crosschecking files in changesets and manifests
1554 1554 checking files
1555 1555 checked 10 changesets with 28 changes to 10 files
1556 1556 searching 1 changesets for largefiles
1557 1557 verified existence of 3 revisions of 3 largefiles
1558 1558
1559 1559 - introduce missing blob in local store repo and remote store
1560 1560 and make sure that this is caught:
1561 1561
1562 1562 $ mv $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 .
1563 1563 $ rm .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
1564 1564 $ hg verify --large
1565 1565 checking changesets
1566 1566 checking manifests
1567 1567 crosschecking files in changesets and manifests
1568 1568 checking files
1569 1569 checked 10 changesets with 28 changes to 10 files
1570 1570 searching 1 changesets for largefiles
1571 1571 changeset 9:598410d3eb9a: sub/large4 references missing $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
1572 1572 verified existence of 3 revisions of 3 largefiles
1573 1573 [1]
1574 1574
1575 1575 - introduce corruption and make sure that it is caught when checking content:
1576 1576 $ echo '5 cents' > $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
1577 1577 $ hg verify -q --large --lfc
1578 1578 changeset 9:598410d3eb9a: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
1579 1579 [1]
1580 1580
1581 1581 - cleanup
1582 1582 $ cp e166e74c7303192238d60af5a9c4ce9bef0b7928 $TESTTMP/d/.hg/largefiles/
1583 1583 $ mv e166e74c7303192238d60af5a9c4ce9bef0b7928 .hg/largefiles/
1584 1584
1585 1585 - verifying all revisions will fail because we didn't clone all largefiles to d:
1586 1586 $ echo 'T-shirt' > $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1587 1587 $ hg verify -q --lfa --lfc
1588 1588 changeset 0:30d30fe6a5be: large1 references missing $TESTTMP/d/.hg/largefiles/4669e532d5b2c093a78eca010077e708a071bb64
1589 1589 changeset 0:30d30fe6a5be: sub/large2 references missing $TESTTMP/d/.hg/largefiles/1deebade43c8c498a3c8daddac0244dc55d1331d
1590 1590 changeset 1:ce8896473775: large1 references missing $TESTTMP/d/.hg/largefiles/5f78770c0e77ba4287ad6ef3071c9bf9c379742f
1591 1591 changeset 1:ce8896473775: sub/large2 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1592 1592 changeset 3:9e8fbc4bce62: large1 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1593 1593 changeset 4:74c02385b94c: large3 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1594 1594 changeset 4:74c02385b94c: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1595 1595 changeset 5:9d5af5072dbd: large3 references missing $TESTTMP/d/.hg/largefiles/baaf12afde9d8d67f25dab6dced0d2bf77dba47c
1596 1596 changeset 5:9d5af5072dbd: sub/large4 references missing $TESTTMP/d/.hg/largefiles/aeb2210d19f02886dde00dac279729a48471e2f9
1597 1597 changeset 6:4355d653f84f: large3 references missing $TESTTMP/d/.hg/largefiles/7838695e10da2bb75ac1156565f40a2595fa2fa0
1598 1598 [1]
1599 1599
1600 1600 - cleanup
1601 1601 $ rm $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1602 1602 $ rm -f .hglf/sub/*.orig
1603 1603
1604 1604 Update to revision with missing largefile - and make sure it really is missing
1605 1605
1606 1606 $ rm ${USERCACHE}/7838695e10da2bb75ac1156565f40a2595fa2fa0
1607 1607 $ hg up -r 6
1608 1608 getting changed largefiles
1609 1609 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob)
1610 1610 1 largefiles updated, 2 removed
1611 1611 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
1612 1612 $ rm normal3
1613 1613 $ echo >> sub/normal4
1614 1614 $ hg ci -m 'commit with missing files'
1615 1615 Invoking status precommit hook
1616 1616 M sub/normal4
1617 1617 ! large3
1618 1618 ! normal3
1619 1619 created new head
1620 1620 $ hg st
1621 1621 ! large3
1622 1622 ! normal3
1623 1623 $ hg up -r.
1624 1624 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1625 1625 $ hg st
1626 1626 ! large3
1627 1627 ! normal3
1628 1628 $ hg up -Cr.
1629 1629 getting changed largefiles
1630 1630 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob)
1631 1631 0 largefiles updated, 0 removed
1632 1632 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1633 1633 $ hg st
1634 1634 ! large3
1635 1635 $ hg rollback
1636 1636 repository tip rolled back to revision 9 (undo commit)
1637 1637 working directory now based on revision 6
1638 1638
1639 1639 Merge with revision with missing largefile - and make sure it tries to fetch it.
1640 1640
1641 1641 $ hg up -Cqr null
1642 1642 $ echo f > f
1643 1643 $ hg ci -Am branch
1644 1644 adding f
1645 1645 Invoking status precommit hook
1646 1646 A f
1647 1647 created new head
1648 1648 $ hg merge -r 6
1649 1649 getting changed largefiles
1650 1650 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob)
1651 1651 1 largefiles updated, 0 removed
1652 1652 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1653 1653 (branch merge, don't forget to commit)
1654 1654
1655 1655 $ hg rollback -q
1656 1656 $ hg up -Cq
1657 1657
1658 1658 Pulling 0 revisions with --all-largefiles should not fetch for all revisions
1659 1659
1660 1660 $ hg pull --all-largefiles
1661 1661 pulling from $TESTTMP/d
1662 1662 searching for changes
1663 1663 no changes found
1664 1664
1665 1665 Merging does not revert to old versions of largefiles and also check
1666 1666 that merging after having pulled from a non-default remote works
1667 1667 correctly.
1668 1668
1669 1669 $ cd ..
1670 1670 $ hg clone -r 7 e temp
1671 1671 adding changesets
1672 1672 adding manifests
1673 1673 adding file changes
1674 1674 added 8 changesets with 24 changes to 10 files
1675 1675 new changesets 30d30fe6a5be:daea875e9014 (8 drafts)
1676 1676 updating to branch default
1677 1677 getting changed largefiles
1678 1678 3 largefiles updated, 0 removed
1679 1679 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1680 1680 $ hg clone temp f
1681 1681 updating to branch default
1682 1682 getting changed largefiles
1683 1683 3 largefiles updated, 0 removed
1684 1684 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1685 1685 # Delete the largefiles in the largefiles system cache so that we have an
1686 1686 # opportunity to test that caching after a pull works.
1687 1687 $ rm "${USERCACHE}"/*
1688 1688 $ cd f
1689 1689 $ echo "large4-merge-test" > sub/large4
1690 1690 $ hg commit -m "Modify large4 to test merge"
1691 1691 Invoking status precommit hook
1692 1692 M sub/large4
1693 1693 # Test --cache-largefiles flag
1694 1694 $ hg pull --lfrev 'heads(pulled())' ../e
1695 1695 pulling from ../e
1696 1696 searching for changes
1697 1697 adding changesets
1698 1698 adding manifests
1699 1699 adding file changes
1700 1700 added 2 changesets with 4 changes to 4 files (+1 heads)
1701 1701 new changesets a381d2c8c80e:598410d3eb9a (2 drafts)
1702 1702 (run 'hg heads' to see heads, 'hg merge' to merge)
1703 1703 2 largefiles cached
1704 1704 $ hg merge
1705 1705 largefile sub/large4 has a merge conflict
1706 1706 ancestor was 971fb41e78fea4f8e0ba5244784239371cb00591
1707 1707 you can keep (l)ocal d846f26643bfa8ec210be40cc93cc6b7ff1128ea or take (o)ther e166e74c7303192238d60af5a9c4ce9bef0b7928.
1708 1708 what do you want to do? l
1709 1709 getting changed largefiles
1710 1710 1 largefiles updated, 0 removed
1711 1711 3 files updated, 1 files merged, 0 files removed, 0 files unresolved
1712 1712 (branch merge, don't forget to commit)
1713 1713 $ hg commit -m "Merge repos e and f"
1714 1714 Invoking status precommit hook
1715 1715 M normal3
1716 1716 M sub/normal4
1717 1717 M sub2/large6
1718 1718 $ cat normal3
1719 1719 normal3-modified
1720 1720 $ cat sub/normal4
1721 1721 normal4-modified
1722 1722 $ cat sub/large4
1723 1723 large4-merge-test
1724 1724 $ cat sub2/large6
1725 1725 large6-modified
1726 1726 $ cat sub2/large7
1727 1727 large7
1728 1728
1729 1729 Test status after merging with a branch that introduces a new largefile:
1730 1730
1731 1731 $ echo large > large
1732 1732 $ hg add --large large
1733 1733 $ hg commit -m 'add largefile'
1734 1734 Invoking status precommit hook
1735 1735 A large
1736 1736 $ hg update -q ".^"
1737 1737 $ echo change >> normal3
1738 1738 $ hg commit -m 'some change'
1739 1739 Invoking status precommit hook
1740 1740 M normal3
1741 1741 created new head
1742 1742 $ hg merge
1743 1743 getting changed largefiles
1744 1744 1 largefiles updated, 0 removed
1745 1745 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1746 1746 (branch merge, don't forget to commit)
1747 1747 $ hg status
1748 1748 M large
1749 1749
1750 1750 - make sure update of merge with removed largefiles fails as expected
1751 1751 $ hg rm sub2/large6
1752 1752 $ hg up -r.
1753 1753 abort: outstanding uncommitted merge
1754 1754 [20]
1755 1755
1756 1756 - revert should be able to revert files introduced in a pending merge
1757 1757 $ hg revert --all -r .
1758 1758 removing .hglf/large
1759 1759 undeleting .hglf/sub2/large6
1760 1760
1761 1761 Test that a normal file and a largefile with the same name and path cannot
1762 1762 coexist.
1763 1763
1764 1764 $ rm sub2/large7
1765 1765 $ echo "largeasnormal" > sub2/large7
1766 1766 $ hg add sub2/large7
1767 1767 sub2/large7 already a largefile
1768 1768
1769 1769 Test that transplanting a largefile change works correctly.
1770 1770
1771 1771 $ cd ..
1772 1772 $ hg clone -r 8 d g
1773 1773 adding changesets
1774 1774 adding manifests
1775 1775 adding file changes
1776 1776 added 9 changesets with 26 changes to 10 files
1777 1777 new changesets 30d30fe6a5be:a381d2c8c80e (9 drafts)
1778 1778 updating to branch default
1779 1779 getting changed largefiles
1780 1780 3 largefiles updated, 0 removed
1781 1781 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1782 1782 $ cd g
1783 1783 $ hg transplant -s ../d 598410d3eb9a
1784 1784 searching for changes
1785 1785 searching for changes
1786 1786 adding changesets
1787 1787 adding manifests
1788 1788 adding file changes
1789 1789 added 1 changesets with 2 changes to 2 files
1790 1790 new changesets 598410d3eb9a (1 drafts)
1791 1791 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1792 1792 9:598410d3eb9a modify normal file largefile in repo d
1793 1793 8:a381d2c8c80e modify normal file and largefile in repo b
1794 1794 7:daea875e9014 add/edit more largefiles
1795 1795 6:4355d653f84f edit files yet again
1796 1796 5:9d5af5072dbd edit files again
1797 1797 4:74c02385b94c move files
1798 1798 3:9e8fbc4bce62 copy files
1799 1799 2:51a0ae4d5864 remove files
1800 1800 1:ce8896473775 edit files
1801 1801 0:30d30fe6a5be add files
1802 1802 $ cat normal3
1803 1803 normal3-modified
1804 1804 $ cat sub/normal4
1805 1805 normal4-modified
1806 1806 $ cat sub/large4
1807 1807 large4-modified
1808 1808 $ cat sub2/large6
1809 1809 large6-modified
1810 1810 $ cat sub2/large7
1811 1811 large7
1812 1812
1813 1813 Cat a largefile
1814 1814 $ hg cat normal3
1815 1815 normal3-modified
1816 1816 $ hg cat sub/large4
1817 1817 large4-modified
1818 1818 $ rm "${USERCACHE}"/*
1819 1819 $ hg cat -r a381d2c8c80e -o cat.out sub/large4
1820 1820 $ cat cat.out
1821 1821 large4-modified
1822 1822 $ rm cat.out
1823 1823 $ hg cat -r a381d2c8c80e normal3
1824 1824 normal3-modified
1825 1825 $ hg cat -r '.^' normal3
1826 1826 normal3-modified
1827 1827 $ hg cat -r '.^' sub/large4 doesntexist
1828 1828 large4-modified
1829 1829 doesntexist: no such file in rev a381d2c8c80e
1830 1830 $ hg --cwd sub cat -r '.^' large4
1831 1831 large4-modified
1832 1832 $ hg --cwd sub cat -r '.^' ../normal3
1833 1833 normal3-modified
1834 1834 Cat a standin
1835 1835 $ hg cat .hglf/sub/large4
1836 1836 e166e74c7303192238d60af5a9c4ce9bef0b7928
1837 1837 $ hg cat .hglf/normal3
1838 1838 .hglf/normal3: no such file in rev 598410d3eb9a
1839 1839 [1]
1840 1840
1841 1841 Test that renaming a largefile results in correct output for status
1842 1842
1843 1843 $ hg rename sub/large4 large4-renamed
1844 1844 $ hg commit -m "test rename output"
1845 1845 Invoking status precommit hook
1846 1846 A large4-renamed
1847 1847 R sub/large4
1848 1848 $ cat large4-renamed
1849 1849 large4-modified
1850 1850 $ cd sub2
1851 1851 $ hg rename large6 large6-renamed
1852 1852 $ hg st
1853 1853 A sub2/large6-renamed
1854 1854 R sub2/large6
1855 1855 $ cd ..
1856 1856
1857 1857 Test --normal flag
1858 1858
1859 1859 $ dd if=/dev/zero bs=2k count=11k > new-largefile 2> /dev/null
1860 1860 $ hg add --normal --large new-largefile
1861 1861 abort: --normal cannot be used with --large
1862 1862 [255]
1863 1863 $ hg add --normal new-largefile
1864 1864 new-largefile: up to 69 MB of RAM may be required to manage this file
1865 1865 (use 'hg revert new-largefile' to cancel the pending addition)
1866 1866 $ hg revert new-largefile
1867 1867 $ hg --config ui.large-file-limit=22M add --normal new-largefile
1868 1868
1869 1869 Test explicit commit of switch between normal and largefile - make sure both
1870 1870 the add and the remove is committed.
1871 1871
1872 1872 $ hg up -qC
1873 1873 $ hg forget normal3 large4-renamed
1874 1874 $ hg add --large normal3
1875 1875 $ hg add large4-renamed
1876 1876 $ hg commit -m 'swap' normal3 large4-renamed
1877 1877 Invoking status precommit hook
1878 1878 A large4-renamed
1879 1879 A normal3
1880 1880 ? new-largefile
1881 1881 ? sub2/large6-renamed
1882 1882 $ hg mani
1883 1883 .hglf/normal3
1884 1884 .hglf/sub2/large6
1885 1885 .hglf/sub2/large7
1886 1886 large4-renamed
1887 1887 sub/normal4
1888 1888
1889 1889 $ cd ..
1890 1890
1891 1891
1892 1892
@@ -1,500 +1,500 b''
1 1 $ cat >> $HGRCPATH <<EOF
2 2 > [extensions]
3 3 > rebase=
4 4 > drawdag=$TESTDIR/drawdag.py
5 5 >
6 6 > [phases]
7 7 > publish=False
8 8 >
9 9 > [alias]
10 10 > tglog = log -G --template "{rev}:{phase} '{desc}' {branches} {bookmarks}\n"
11 11 > EOF
12 12
13 13 $ hg init a
14 14 $ cd a
15 15 $ echo c1 >common
16 16 $ hg add common
17 17 $ hg ci -m C1
18 18
19 19 $ echo c2 >>common
20 20 $ hg ci -m C2
21 21
22 22 $ echo c3 >>common
23 23 $ hg ci -m C3
24 24
25 25 $ hg up -q -C 1
26 26
27 27 $ echo l1 >>extra
28 28 $ hg add extra
29 29 $ hg ci -m L1
30 30 created new head
31 31
32 32 $ sed -e 's/c2/l2/' common > common.new
33 33 $ mv common.new common
34 34 $ hg ci -m L2
35 35
36 36 $ echo l3 >> extra2
37 37 $ hg add extra2
38 38 $ hg ci -m L3
39 39 $ hg bookmark mybook
40 40
41 41 $ hg phase --force --secret 4
42 42
43 43 $ hg tglog
44 44 @ 5:secret 'L3' mybook
45 45 |
46 46 o 4:secret 'L2'
47 47 |
48 48 o 3:draft 'L1'
49 49 |
50 50 | o 2:draft 'C3'
51 51 |/
52 52 o 1:draft 'C2'
53 53 |
54 54 o 0:draft 'C1'
55 55
56 56 Try to call --continue:
57 57
58 58 $ hg rebase --continue
59 59 abort: no rebase in progress
60 60 [20]
61 61
62 62 Conflicting rebase:
63 63
64 64 $ hg rebase -s 3 -d 2
65 65 rebasing 3:3163e20567cc "L1"
66 66 rebasing 4:46f0b057b5c0 "L2"
67 67 merging common
68 68 warning: conflicts while merging common! (edit, then use 'hg resolve --mark')
69 69 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
70 70 [240]
71 71
72 72 $ hg status --config commands.status.verbose=1
73 73 M common
74 74 ? common.orig
75 75 # The repository is in an unfinished *rebase* state.
76 76
77 77 # Unresolved merge conflicts:
78 78 #
79 79 # common
80 80 #
81 81 # To mark files as resolved: hg resolve --mark FILE
82 82
83 83 # To continue: hg rebase --continue
84 84 # To abort: hg rebase --abort
85 85 # To stop: hg rebase --stop
86 86
87 87
88 88 Try to continue without solving the conflict:
89 89
90 90 $ hg rebase --continue
91 91 abort: unresolved merge conflicts (see 'hg help resolve')
92 92 [20]
93 93
94 94 Conclude rebase:
95 95
96 96 $ echo 'resolved merge' >common
97 97 $ hg resolve -m common
98 98 (no more unresolved files)
99 99 continue: hg rebase --continue
100 100 $ hg rebase --continue
101 101 already rebased 3:3163e20567cc "L1" as 3e046f2ecedb
102 102 rebasing 4:46f0b057b5c0 "L2"
103 103 rebasing 5:8029388f38dc mybook "L3"
104 104 saved backup bundle to $TESTTMP/a/.hg/strip-backup/3163e20567cc-5ca4656e-rebase.hg
105 105
106 106 $ hg tglog
107 107 @ 5:secret 'L3' mybook
108 108 |
109 109 o 4:secret 'L2'
110 110 |
111 111 o 3:draft 'L1'
112 112 |
113 113 o 2:draft 'C3'
114 114 |
115 115 o 1:draft 'C2'
116 116 |
117 117 o 0:draft 'C1'
118 118
119 119 Check correctness:
120 120
121 121 $ hg cat -r 0 common
122 122 c1
123 123
124 124 $ hg cat -r 1 common
125 125 c1
126 126 c2
127 127
128 128 $ hg cat -r 2 common
129 129 c1
130 130 c2
131 131 c3
132 132
133 133 $ hg cat -r 3 common
134 134 c1
135 135 c2
136 136 c3
137 137
138 138 $ hg cat -r 4 common
139 139 resolved merge
140 140
141 141 $ hg cat -r 5 common
142 142 resolved merge
143 143
144 144 Bookmark stays active after --continue
145 145 $ hg bookmarks
146 146 * mybook 5:d67b21408fc0
147 147
148 148 $ cd ..
149 149
150 150 Check that the right ancestors is used while rebasing a merge (issue4041)
151 151
152 152 $ hg init issue4041
153 153 $ cd issue4041
154 154 $ hg unbundle "$TESTDIR/bundles/issue4041.hg"
155 155 adding changesets
156 156 adding manifests
157 157 adding file changes
158 158 added 11 changesets with 8 changes to 3 files (+1 heads)
159 159 new changesets 24797d4f68de:2f2496ddf49d (11 drafts)
160 160 (run 'hg heads' to see heads)
161 161 $ hg up default
162 162 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
163 163 $ hg log -G
164 164 o changeset: 10:2f2496ddf49d
165 165 |\ branch: f1
166 166 | | tag: tip
167 167 | | parent: 7:4c9fbe56a16f
168 168 | | parent: 9:e31216eec445
169 169 | | user: szhang
170 170 | | date: Thu Sep 05 12:59:39 2013 -0400
171 171 | | summary: merge
172 172 | |
173 173 | o changeset: 9:e31216eec445
174 174 | | branch: f1
175 175 | | user: szhang
176 176 | | date: Thu Sep 05 12:59:10 2013 -0400
177 177 | | summary: more changes to f1
178 178 | |
179 179 | o changeset: 8:8e4e2c1a07ae
180 180 | |\ branch: f1
181 181 | | | parent: 2:4bc80088dc6b
182 182 | | | parent: 6:400110238667
183 183 | | | user: szhang
184 184 | | | date: Thu Sep 05 12:57:59 2013 -0400
185 185 | | | summary: bad merge
186 186 | | |
187 187 o | | changeset: 7:4c9fbe56a16f
188 188 |/ / branch: f1
189 189 | | parent: 2:4bc80088dc6b
190 190 | | user: szhang
191 191 | | date: Thu Sep 05 12:54:00 2013 -0400
192 192 | | summary: changed f1
193 193 | |
194 194 | o changeset: 6:400110238667
195 195 | | branch: f2
196 196 | | parent: 4:12e8ec6bb010
197 197 | | user: szhang
198 198 | | date: Tue Sep 03 13:58:02 2013 -0400
199 199 | | summary: changed f2 on f2
200 200 | |
201 201 | | @ changeset: 5:d79e2059b5c0
202 202 | | | parent: 3:8a951942e016
203 203 | | | user: szhang
204 204 | | | date: Tue Sep 03 13:57:39 2013 -0400
205 205 | | | summary: changed f2 on default
206 206 | | |
207 207 | o | changeset: 4:12e8ec6bb010
208 208 | |/ branch: f2
209 209 | | user: szhang
210 210 | | date: Tue Sep 03 13:57:18 2013 -0400
211 211 | | summary: created f2 branch
212 212 | |
213 213 | o changeset: 3:8a951942e016
214 214 | | parent: 0:24797d4f68de
215 215 | | user: szhang
216 216 | | date: Tue Sep 03 13:57:11 2013 -0400
217 217 | | summary: added f2.txt
218 218 | |
219 219 o | changeset: 2:4bc80088dc6b
220 220 | | branch: f1
221 221 | | user: szhang
222 222 | | date: Tue Sep 03 13:56:20 2013 -0400
223 223 | | summary: added f1.txt
224 224 | |
225 225 o | changeset: 1:ef53c9e6b608
226 226 |/ branch: f1
227 227 | user: szhang
228 228 | date: Tue Sep 03 13:55:26 2013 -0400
229 229 | summary: created f1 branch
230 230 |
231 231 o changeset: 0:24797d4f68de
232 232 user: szhang
233 233 date: Tue Sep 03 13:55:08 2013 -0400
234 234 summary: added default.txt
235 235
236 236 $ hg rebase -s9 -d2 --debug # use debug to really check merge base used
237 237 rebase onto 4bc80088dc6b starting from e31216eec445
238 238 rebasing on disk
239 239 rebase status stored
240 240 rebasing 9:e31216eec445 "more changes to f1"
241 241 future parents are 2 and -1
242 242 update to 2:4bc80088dc6b
243 243 resolving manifests
244 244 branchmerge: False, force: True, partial: False
245 245 ancestor: d79e2059b5c0+, local: d79e2059b5c0+, remote: 4bc80088dc6b
246 246 f2.txt: other deleted -> r
247 247 removing f2.txt
248 248 f1.txt: remote created -> g
249 249 getting f1.txt
250 250 merge against 9:e31216eec445
251 251 detach base 8:8e4e2c1a07ae
252 252 resolving manifests
253 253 branchmerge: True, force: True, partial: False
254 254 ancestor: 8e4e2c1a07ae, local: 4bc80088dc6b+, remote: e31216eec445
255 255 f1.txt: remote is newer -> g
256 256 getting f1.txt
257 257 committing files:
258 258 f1.txt
259 259 committing manifest
260 260 committing changelog
261 261 updating the branch cache
262 262 rebased as 19c888675e13
263 263 rebase status stored
264 264 rebasing 10:2f2496ddf49d tip "merge"
265 265 future parents are 11 and 7
266 266 already in destination
267 267 merge against 10:2f2496ddf49d
268 268 detach base 9:e31216eec445
269 269 resolving manifests
270 270 branchmerge: True, force: True, partial: False
271 271 ancestor: e31216eec445, local: 19c888675e13+, remote: 2f2496ddf49d
272 272 f1.txt: remote is newer -> g
273 273 getting f1.txt
274 274 committing files:
275 275 f1.txt
276 276 committing manifest
277 277 committing changelog
278 278 updating the branch cache
279 279 rebased as c1ffa3b5274e
280 280 rebase status stored
281 281 rebase merging completed
282 282 update back to initial working directory parent
283 283 resolving manifests
284 284 branchmerge: False, force: False, partial: False
285 285 ancestor: c1ffa3b5274e, local: c1ffa3b5274e+, remote: d79e2059b5c0
286 286 f1.txt: other deleted -> r
287 287 removing f1.txt
288 288 f2.txt: remote created -> g
289 289 getting f2.txt
290 290 2 changesets found
291 291 list of changesets:
292 292 e31216eec445e44352c5f01588856059466a24c9
293 293 2f2496ddf49d69b5ef23ad8cf9fb2e0e4faf0ac2
294 294 bundle2-output-bundle: "HG20", (1 params) 3 parts total
295 295 bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
296 296 bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
297 297 bundle2-output-part: "phase-heads" 24 bytes payload
298 298 saved backup bundle to $TESTTMP/issue4041/.hg/strip-backup/e31216eec445-15f7a814-rebase.hg
299 299 3 changesets found
300 300 list of changesets:
301 301 4c9fbe56a16f30c0d5dcc40ec1a97bbe3325209c
302 302 19c888675e133ab5dff84516926a65672eaf04d9
303 303 c1ffa3b5274e92a9388fe782854e295d2e8d0443
304 304 bundle2-output-bundle: "HG20", 3 parts total
305 305 bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
306 306 bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
307 307 bundle2-output-part: "phase-heads" 24 bytes payload
308 308 adding branch
309 309 bundle2-input-bundle: with-transaction
310 310 bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported
311 311 adding changesets
312 312 add changeset 4c9fbe56a16f
313 313 add changeset 19c888675e13
314 314 add changeset c1ffa3b5274e
315 315 adding manifests
316 316 adding file changes
317 317 adding f1.txt revisions
318 bundle2-input-part: total payload size 1686
318 bundle2-input-part: total payload size 1739
319 319 bundle2-input-part: "cache:rev-branch-cache" (advisory) supported
320 320 bundle2-input-part: total payload size 74
321 321 bundle2-input-part: "phase-heads" supported
322 322 bundle2-input-part: total payload size 24
323 323 bundle2-input-bundle: 3 parts total
324 324 truncating cache/rbc-revs-v1 to 72
325 325 added 2 changesets with 2 changes to 1 files
326 326 updating the branch cache
327 327 invalid branch cache (served): tip differs
328 328 invalid branch cache (served.hidden): tip differs
329 329 rebase completed
330 330
331 331 Test minimization of merge conflicts
332 332 $ hg up -q null
333 333 $ echo a > a
334 334 $ hg add a
335 335 $ hg commit -q -m 'a'
336 336 $ echo b >> a
337 337 $ hg commit -q -m 'ab'
338 338 $ hg bookmark ab
339 339 $ hg up -q '.^'
340 340 $ echo b >> a
341 341 $ echo c >> a
342 342 $ hg commit -q -m 'abc'
343 343 $ hg rebase -s 7bc217434fc1 -d ab --keep
344 344 rebasing 13:7bc217434fc1 tip "abc"
345 345 merging a
346 346 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
347 347 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
348 348 [240]
349 349 $ hg diff
350 350 diff -r 328e4ab1f7cc a
351 351 --- a/a Thu Jan 01 00:00:00 1970 +0000
352 352 +++ b/a * (glob)
353 353 @@ -1,2 +1,6 @@
354 354 a
355 355 b
356 356 +<<<<<<< dest: 328e4ab1f7cc ab - test: ab
357 357 +=======
358 358 +c
359 359 +>>>>>>> source: 7bc217434fc1 - test: abc
360 360 $ hg rebase --abort
361 361 rebase aborted
362 362 $ hg up -q -C 7bc217434fc1
363 363 $ hg rebase -s . -d ab --keep -t internal:merge3
364 364 rebasing 13:7bc217434fc1 tip "abc"
365 365 merging a
366 366 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
367 367 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
368 368 [240]
369 369 $ hg diff
370 370 diff -r 328e4ab1f7cc a
371 371 --- a/a Thu Jan 01 00:00:00 1970 +0000
372 372 +++ b/a * (glob)
373 373 @@ -1,2 +1,8 @@
374 374 a
375 375 +<<<<<<< dest: 328e4ab1f7cc ab - test: ab
376 376 b
377 377 +||||||| parent of source: cb9a9f314b8b - test: a
378 378 +=======
379 379 +b
380 380 +c
381 381 +>>>>>>> source: 7bc217434fc1 - test: abc
382 382
383 383 Test rebase with obsstore turned on and off (issue5606)
384 384
385 385 $ cd $TESTTMP
386 386 $ hg init b
387 387 $ cd b
388 388 $ hg debugdrawdag <<'EOS'
389 389 > D
390 390 > |
391 391 > C
392 392 > |
393 393 > B E
394 394 > |/
395 395 > A
396 396 > EOS
397 397
398 398 $ hg update E -q
399 399 $ echo 3 > B
400 400 $ hg commit --amend -m E -A B -q
401 401 $ hg rebase -r B+D -d . --config experimental.evolution=true
402 402 rebasing 1:112478962961 B "B"
403 403 merging B
404 404 warning: conflicts while merging B! (edit, then use 'hg resolve --mark')
405 405 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
406 406 [240]
407 407
408 408 $ echo 4 > B
409 409 $ hg resolve -m
410 410 (no more unresolved files)
411 411 continue: hg rebase --continue
412 412 $ hg rebase --continue --config experimental.evolution=none
413 413 rebasing 1:112478962961 B "B"
414 414 rebasing 3:f585351a92f8 D "D"
415 415 warning: orphaned descendants detected, not stripping 112478962961
416 416 saved backup bundle to $TESTTMP/b/.hg/strip-backup/f585351a92f8-e536a9e4-rebase.hg
417 417
418 418 $ rm .hg/localtags
419 419 $ hg tglog
420 420 o 5:draft 'D'
421 421 |
422 422 o 4:draft 'B'
423 423 |
424 424 @ 3:draft 'E'
425 425 |
426 426 | o 2:draft 'C'
427 427 | |
428 428 | o 1:draft 'B'
429 429 |/
430 430 o 0:draft 'A'
431 431
432 432
433 433 Test where the conflict happens when rebasing a merge commit
434 434
435 435 $ cd $TESTTMP
436 436 $ hg init conflict-in-merge
437 437 $ cd conflict-in-merge
438 438 $ hg debugdrawdag <<'EOS'
439 439 > F # F/conflict = foo\n
440 440 > |\
441 441 > D E
442 442 > |/
443 443 > C B # B/conflict = bar\n
444 444 > |/
445 445 > A
446 446 > EOS
447 447
448 448 $ hg co F
449 449 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
450 450 $ hg rebase -d B
451 451 rebasing 2:dc0947a82db8 C "C"
452 452 rebasing 3:e7b3f00ed42e D "D"
453 453 rebasing 4:03ca77807e91 E "E"
454 454 rebasing 5:9a6b91dc2044 F tip "F"
455 455 merging conflict
456 456 warning: conflicts while merging conflict! (edit, then use 'hg resolve --mark')
457 457 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
458 458 [240]
459 459 $ hg tglog
460 460 @ 8:draft 'E'
461 461 |
462 462 | @ 7:draft 'D'
463 463 |/
464 464 o 6:draft 'C'
465 465 |
466 466 | % 5:draft 'F'
467 467 | |\
468 468 | | o 4:draft 'E'
469 469 | | |
470 470 | o | 3:draft 'D'
471 471 | |/
472 472 | o 2:draft 'C'
473 473 | |
474 474 o | 1:draft 'B'
475 475 |/
476 476 o 0:draft 'A'
477 477
478 478 $ echo baz > conflict
479 479 $ hg resolve -m
480 480 (no more unresolved files)
481 481 continue: hg rebase --continue
482 482 $ hg rebase -c
483 483 already rebased 2:dc0947a82db8 C "C" as 0199610c343e
484 484 already rebased 3:e7b3f00ed42e D "D" as f0dd538aaa63
485 485 already rebased 4:03ca77807e91 E "E" as cbf25af8347d
486 486 rebasing 5:9a6b91dc2044 F "F"
487 487 saved backup bundle to $TESTTMP/conflict-in-merge/.hg/strip-backup/dc0947a82db8-ca7e7d5b-rebase.hg
488 488 $ hg tglog
489 489 @ 5:draft 'F'
490 490 |\
491 491 | o 4:draft 'E'
492 492 | |
493 493 o | 3:draft 'D'
494 494 |/
495 495 o 2:draft 'C'
496 496 |
497 497 o 1:draft 'B'
498 498 |
499 499 o 0:draft 'A'
500 500
@@ -1,316 +1,333 b''
1 1 ==========================================================
2 2 Test various things around delta computation within revlog
3 3 ==========================================================
4 4
5 5
6 6 basic setup
7 7 -----------
8 8
9 9 $ cat << EOF >> $HGRCPATH
10 10 > [debug]
11 11 > revlog.debug-delta=yes
12 12 > EOF
13 13 $ cat << EOF >> sha256line.py
14 14 > # a way to quickly produce file of significant size and poorly compressable content.
15 15 > import hashlib
16 16 > import sys
17 17 > for line in sys.stdin:
18 18 > print(hashlib.sha256(line.encode('utf8')).hexdigest())
19 19 > EOF
20 20
21 21 $ hg init base-repo
22 22 $ cd base-repo
23 23
24 24 create a "large" file
25 25
26 26 $ $TESTDIR/seq.py 1000 | $PYTHON $TESTTMP/sha256line.py > my-file.txt
27 27 $ hg add my-file.txt
28 28 $ hg commit -m initial-commit
29 29 DBG-DELTAS: FILELOG:my-file.txt: rev=0: delta-base=0 * (glob)
30 30 DBG-DELTAS: MANIFESTLOG: * (glob)
31 31 DBG-DELTAS: CHANGELOG: * (glob)
32 32
33 33 Add more change at the end of the file
34 34
35 35 $ $TESTDIR/seq.py 1001 1200 | $PYTHON $TESTTMP/sha256line.py >> my-file.txt
36 36 $ hg commit -m "large-change"
37 37 DBG-DELTAS: FILELOG:my-file.txt: rev=1: delta-base=0 * (glob)
38 38 DBG-DELTAS: MANIFESTLOG: * (glob)
39 39 DBG-DELTAS: CHANGELOG: * (glob)
40 40
41 41 Add small change at the start
42 42
43 43 $ hg up 'desc("initial-commit")' --quiet
44 44 $ mv my-file.txt foo
45 45 $ echo "small change at the start" > my-file.txt
46 46 $ cat foo >> my-file.txt
47 47 $ rm foo
48 48 $ hg commit -m "small-change"
49 49 DBG-DELTAS: FILELOG:my-file.txt: rev=2: delta-base=0 * (glob)
50 50 DBG-DELTAS: MANIFESTLOG: * (glob)
51 51 DBG-DELTAS: CHANGELOG: * (glob)
52 52 created new head
53 53
54 54
55 55 $ hg log -r 'head()' -T '{node}\n' >> ../base-heads.nodes
56 56 $ hg log -r 'desc("initial-commit")' -T '{node}\n' >> ../initial.node
57 57 $ hg log -r 'desc("small-change")' -T '{node}\n' >> ../small.node
58 58 $ hg log -r 'desc("large-change")' -T '{node}\n' >> ../large.node
59 59 $ cd ..
60 60
61 61 Check delta find policy and result for merge on commit
62 62 ======================================================
63 63
64 64 Check that delta of merge pick best of the two parents
65 65 ------------------------------------------------------
66 66
67 67 As we check against both parents, the one with the largest change should
68 68 produce the smallest delta and be picked.
69 69
70 70 $ hg clone base-repo test-parents --quiet
71 71 $ hg -R test-parents update 'nodefromfile("small.node")' --quiet
72 72 $ hg -R test-parents merge 'nodefromfile("large.node")' --quiet
73 73
74 74 The delta base is the "large" revision as it produce a smaller delta.
75 75
76 76 $ hg -R test-parents commit -m "merge from small change"
77 77 DBG-DELTAS: FILELOG:my-file.txt: rev=3: delta-base=1 * (glob)
78 78 DBG-DELTAS: MANIFESTLOG: * (glob)
79 79 DBG-DELTAS: CHANGELOG: * (glob)
80 80
81 81 Check that the behavior tested above can we disabled
82 82 ----------------------------------------------------
83 83
84 84 We disable the checking of both parent at the same time. The `small` change,
85 85 that produce a less optimal delta, should be picked first as it is "closer" to
86 86 the new commit.
87 87
88 88 $ hg clone base-repo test-no-parents --quiet
89 89 $ hg -R test-no-parents update 'nodefromfile("small.node")' --quiet
90 90 $ hg -R test-no-parents merge 'nodefromfile("large.node")' --quiet
91 91
92 92 The delta base is the "large" revision as it produce a smaller delta.
93 93
94 94 $ hg -R test-no-parents commit -m "merge from small change" \
95 95 > --config storage.revlog.optimize-delta-parent-choice=no
96 96 DBG-DELTAS: FILELOG:my-file.txt: rev=3: delta-base=2 * (glob)
97 97 DBG-DELTAS: MANIFESTLOG: * (glob)
98 98 DBG-DELTAS: CHANGELOG: * (glob)
99 99
100 100
101 101 Check delta-find policy and result when unbundling
102 102 ==================================================
103 103
104 104 Build a bundle with all delta built against p1
105 105
106 106 $ hg bundle -R test-parents --all --config devel.bundle.delta=p1 all-p1.hg
107 107 4 changesets found
108 108
109 109 Default policy of trusting delta from the bundle
110 110 ------------------------------------------------
111 111
112 112 Keeping the `p1` delta used in the bundle is sub-optimal for storage, but
113 113 strusting in-bundle delta is faster to apply.
114 114
115 115 $ hg init bundle-default
116 116 $ hg -R bundle-default unbundle all-p1.hg --quiet
117 117 DBG-DELTAS: CHANGELOG: * (glob)
118 118 DBG-DELTAS: CHANGELOG: * (glob)
119 119 DBG-DELTAS: CHANGELOG: * (glob)
120 120 DBG-DELTAS: CHANGELOG: * (glob)
121 121 DBG-DELTAS: MANIFESTLOG: * (glob)
122 122 DBG-DELTAS: MANIFESTLOG: * (glob)
123 123 DBG-DELTAS: MANIFESTLOG: * (glob)
124 124 DBG-DELTAS: MANIFESTLOG: * (glob)
125 125 DBG-DELTAS: FILELOG:my-file.txt: rev=0: delta-base=0 * (glob)
126 126 DBG-DELTAS: FILELOG:my-file.txt: rev=1: delta-base=0 * (glob)
127 127 DBG-DELTAS: FILELOG:my-file.txt: rev=2: delta-base=0 * (glob)
128 128 DBG-DELTAS: FILELOG:my-file.txt: rev=3: delta-base=2 * (glob)
129 129
130 130 (confirm the file revision are in the same order, 2 should be smaller than 1)
131 131
132 132 $ hg -R bundle-default debugdata my-file.txt 2 | wc -l
133 133 \s*1001 (re)
134 134 $ hg -R bundle-default debugdata my-file.txt 1 | wc -l
135 135 \s*1200 (re)
136 136
137 137 explicitly enabled
138 138 ------------------
139 139
140 140 Keeping the `p1` delta used in the bundle is sub-optimal for storage, but
141 141 strusting in-bundle delta is faster to apply.
142 142
143 143 $ hg init bundle-reuse-enabled
144 144 $ hg -R bundle-reuse-enabled unbundle all-p1.hg --quiet \
145 145 > --config storage.revlog.reuse-external-delta-parent=yes
146 146 DBG-DELTAS: CHANGELOG: * (glob)
147 147 DBG-DELTAS: CHANGELOG: * (glob)
148 148 DBG-DELTAS: CHANGELOG: * (glob)
149 149 DBG-DELTAS: CHANGELOG: * (glob)
150 150 DBG-DELTAS: MANIFESTLOG: * (glob)
151 151 DBG-DELTAS: MANIFESTLOG: * (glob)
152 152 DBG-DELTAS: MANIFESTLOG: * (glob)
153 153 DBG-DELTAS: MANIFESTLOG: * (glob)
154 154 DBG-DELTAS: FILELOG:my-file.txt: rev=0: delta-base=0 * (glob)
155 155 DBG-DELTAS: FILELOG:my-file.txt: rev=1: delta-base=0 * (glob)
156 156 DBG-DELTAS: FILELOG:my-file.txt: rev=2: delta-base=0 * (glob)
157 157 DBG-DELTAS: FILELOG:my-file.txt: rev=3: delta-base=2 * (glob)
158 158
159 159 (confirm the file revision are in the same order, 2 should be smaller than 1)
160 160
161 161 $ hg -R bundle-reuse-enabled debugdata my-file.txt 2 | wc -l
162 162 \s*1001 (re)
163 163 $ hg -R bundle-reuse-enabled debugdata my-file.txt 1 | wc -l
164 164 \s*1200 (re)
165 165
166 166 explicitly disabled
167 167 -------------------
168 168
169 169 Not reusing the delta-base from the parent means we the delta will be made
170 170 against the "best" parent. (so not the same as the previous two)
171 171
172 172 $ hg init bundle-reuse-disabled
173 173 $ hg -R bundle-reuse-disabled unbundle all-p1.hg --quiet \
174 174 > --config storage.revlog.reuse-external-delta-parent=no
175 175 DBG-DELTAS: CHANGELOG: * (glob)
176 176 DBG-DELTAS: CHANGELOG: * (glob)
177 177 DBG-DELTAS: CHANGELOG: * (glob)
178 178 DBG-DELTAS: CHANGELOG: * (glob)
179 179 DBG-DELTAS: MANIFESTLOG: * (glob)
180 180 DBG-DELTAS: MANIFESTLOG: * (glob)
181 181 DBG-DELTAS: MANIFESTLOG: * (glob)
182 182 DBG-DELTAS: MANIFESTLOG: * (glob)
183 183 DBG-DELTAS: FILELOG:my-file.txt: rev=0: delta-base=0 * (glob)
184 184 DBG-DELTAS: FILELOG:my-file.txt: rev=1: delta-base=0 * (glob)
185 185 DBG-DELTAS: FILELOG:my-file.txt: rev=2: delta-base=0 * (glob)
186 186 DBG-DELTAS: FILELOG:my-file.txt: rev=3: delta-base=1 * (glob)
187 187
188 188 (confirm the file revision are in the same order, 2 should be smaller than 1)
189 189
190 190 $ hg -R bundle-reuse-disabled debugdata my-file.txt 2 | wc -l
191 191 \s*1001 (re)
192 192 $ hg -R bundle-reuse-disabled debugdata my-file.txt 1 | wc -l
193 193 \s*1200 (re)
194 194
195 195
196 196 Check the path.*:delta-reuse-policy option
197 197 ==========================================
198 198
199 199 Get a repository with the bad parent picked and a clone ready to pull the merge
200 200
201 201 $ cp -ar bundle-reuse-enabled peer-bad-delta
202 202 $ hg clone peer-bad-delta local-pre-pull --rev `cat large.node` --rev `cat small.node` --quiet
203 203 DBG-DELTAS: CHANGELOG: * (glob)
204 204 DBG-DELTAS: CHANGELOG: * (glob)
205 205 DBG-DELTAS: CHANGELOG: * (glob)
206 206 DBG-DELTAS: MANIFESTLOG: * (glob)
207 207 DBG-DELTAS: MANIFESTLOG: * (glob)
208 208 DBG-DELTAS: MANIFESTLOG: * (glob)
209 209 DBG-DELTAS: FILELOG:my-file.txt: rev=0: delta-base=0 * (glob)
210 210 DBG-DELTAS: FILELOG:my-file.txt: rev=1: delta-base=0 * (glob)
211 211 DBG-DELTAS: FILELOG:my-file.txt: rev=2: delta-base=0 * (glob)
212 212
213 213 Check the parent order for the file
214 214
215 215 $ hg -R local-pre-pull debugdata my-file.txt 2 | wc -l
216 216 \s*1001 (re)
217 217 $ hg -R local-pre-pull debugdata my-file.txt 1 | wc -l
218 218 \s*1200 (re)
219 219
220 220 Pull with no value (so the default)
221 221 -----------------------------------
222 222
223 223 default is to reuse the (bad) delta
224 224
225 225 $ cp -ar local-pre-pull local-no-value
226 226 $ hg -R local-no-value pull --quiet
227 227 DBG-DELTAS: CHANGELOG: * (glob)
228 228 DBG-DELTAS: MANIFESTLOG: * (glob)
229 229 DBG-DELTAS: FILELOG:my-file.txt: rev=3: delta-base=2 * (glob)
230 230
231 231 Pull with explicitly the default
232 232 --------------------------------
233 233
234 234 default is to reuse the (bad) delta
235 235
236 236 $ cp -ar local-pre-pull local-default
237 237 $ hg -R local-default pull --quiet --config 'paths.default:delta-reuse-policy=default'
238 238 DBG-DELTAS: CHANGELOG: * (glob)
239 239 DBG-DELTAS: MANIFESTLOG: * (glob)
240 240 DBG-DELTAS: FILELOG:my-file.txt: rev=3: delta-base=2 * (glob)
241 241
242 242 Pull with no-reuse
243 243 ------------------
244 244
245 245 We don't reuse the base, so we get a better delta
246 246
247 247 $ cp -ar local-pre-pull local-no-reuse
248 248 $ hg -R local-no-reuse pull --quiet --config 'paths.default:delta-reuse-policy=no-reuse'
249 249 DBG-DELTAS: CHANGELOG: * (glob)
250 250 DBG-DELTAS: MANIFESTLOG: * (glob)
251 251 DBG-DELTAS: FILELOG:my-file.txt: rev=3: delta-base=1 * (glob)
252 252
253 253 Pull with try-base
254 254 ------------------
255 255
256 256 We requested to use the (bad) delta
257 257
258 258 $ cp -ar local-pre-pull local-try-base
259 259 $ hg -R local-try-base pull --quiet --config 'paths.default:delta-reuse-policy=try-base'
260 260 DBG-DELTAS: CHANGELOG: * (glob)
261 261 DBG-DELTAS: MANIFESTLOG: * (glob)
262 262 DBG-DELTAS: FILELOG:my-file.txt: rev=3: delta-base=2 * (glob)
263 263
264 264 Case where we force a "bad" delta to be applied
265 265 ===============================================
266 266
267 267 We build a very different file content to force a full snapshot
268 268
269 269 $ cp -ar peer-bad-delta peer-bad-delta-with-full
270 270 $ cp -ar local-pre-pull local-pre-pull-full
271 271 $ echo '[paths]' >> local-pre-pull-full/.hg/hgrc
272 272 $ echo 'default=../peer-bad-delta-with-full' >> local-pre-pull-full/.hg/hgrc
273 273
274 274 $ hg -R peer-bad-delta-with-full update 'desc("merge")' --quiet
275 275 $ ($TESTDIR/seq.py 2000 2100; $TESTDIR/seq.py 500 510; $TESTDIR/seq.py 3000 3050) \
276 276 > | $PYTHON $TESTTMP/sha256line.py > peer-bad-delta-with-full/my-file.txt
277 277 $ hg -R peer-bad-delta-with-full commit -m 'trigger-full'
278 278 DBG-DELTAS: FILELOG:my-file.txt: rev=4: delta-base=4 * (glob)
279 279 DBG-DELTAS: MANIFESTLOG: * (glob)
280 280 DBG-DELTAS: CHANGELOG: * (glob)
281 281
282 282 Check that "try-base" behavior challenge the delta
283 283 --------------------------------------------------
284 284
285 285 The bundling process creates a delta against the previous revision, however this
286 286 is an invalid chain for the client, so it is not considered and we do a full
287 287 snapshot again.
288 288
289 289 $ cp -ar local-pre-pull-full local-try-base-full
290 290 $ hg -R local-try-base-full pull --quiet \
291 291 > --config 'paths.default:delta-reuse-policy=try-base'
292 292 DBG-DELTAS: CHANGELOG: * (glob)
293 293 DBG-DELTAS: CHANGELOG: * (glob)
294 294 DBG-DELTAS: MANIFESTLOG: * (glob)
295 295 DBG-DELTAS: MANIFESTLOG: * (glob)
296 296 DBG-DELTAS: FILELOG:my-file.txt: rev=3: delta-base=2 * (glob)
297 297 DBG-DELTAS: FILELOG:my-file.txt: rev=4: delta-base=4 * (glob)
298 298
299 Check that "forced" behavior do not challenge the delta, even if it is full.
300 ---------------------------------------------------------------------------
301
302 A full bundle should be accepted as full bundle without recomputation
303
304 $ cp -ar local-pre-pull-full local-forced-full
305 $ hg -R local-forced-full pull --quiet \
306 > --config 'paths.default:delta-reuse-policy=forced'
307 DBG-DELTAS: CHANGELOG: * (glob)
308 DBG-DELTAS: CHANGELOG: * (glob)
309 DBG-DELTAS: MANIFESTLOG: * (glob)
310 DBG-DELTAS: MANIFESTLOG: * (glob)
311 DBG-DELTAS: FILELOG:my-file.txt: rev=3: delta-base=2 * (glob)
312 DBG-DELTAS: FILELOG:my-file.txt: rev=4: delta-base=4 is-cached=1 - search-rounds=0 try-count=0 - delta-type=full snap-depth=0 - * (glob)
313
299 314 Check that "forced" behavior do not challenge the delta, even if it is bad.
300 315 ---------------------------------------------------------------------------
301 316
302 317 The client does not challenge anything and applies the bizarre delta directly.
303 318
304 319 Note: If the bundling process becomes smarter, this test might no longer work
305 320 (as the server won't be sending "bad" deltas anymore) and might need something
306 321 more subtle to test this behavior.
307 322
308 $ cp -ar local-pre-pull-full local-forced-full
309 $ hg -R local-forced-full pull --quiet \
310 > --config 'paths.default:delta-reuse-policy=forced'
323 $ hg bundle -R peer-bad-delta-with-full --all --config devel.bundle.delta=p1 all-p1.hg
324 5 changesets found
325 $ cp -ar local-pre-pull-full local-forced-full-p1
326 $ hg -R local-forced-full-p1 pull --quiet \
327 > --config 'paths.*:delta-reuse-policy=forced' all-p1.hg
311 328 DBG-DELTAS: CHANGELOG: * (glob)
312 329 DBG-DELTAS: CHANGELOG: * (glob)
313 330 DBG-DELTAS: MANIFESTLOG: * (glob)
314 331 DBG-DELTAS: MANIFESTLOG: * (glob)
315 332 DBG-DELTAS: FILELOG:my-file.txt: rev=3: delta-base=2 * (glob)
316 333 DBG-DELTAS: FILELOG:my-file.txt: rev=4: delta-base=3 * (glob)
General Comments 0
You need to be logged in to leave comments. Login now