##// END OF EJS Templates
simplestore: back up index when adding a revision...
Gregory Szorc -
r37442:06674aab default
parent child Browse files
Show More
@@ -1,673 +1,675 b''
1 1 # simplestorerepo.py - Extension that swaps in alternate repository storage.
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 # To use this with the test suite:
9 9 #
10 10 # $ HGREPOFEATURES="simplestore" ./run-tests.py \
11 11 # --extra-config-opt extensions.simplestore=`pwd`/simplestorerepo.py
12 12
13 13 from __future__ import absolute_import
14 14
15 15 import stat
16 16
17 17 from mercurial.i18n import _
18 18 from mercurial.node import (
19 19 bin,
20 20 hex,
21 21 nullid,
22 22 nullrev,
23 23 )
24 24 from mercurial.thirdparty import (
25 25 cbor,
26 26 )
27 27 from mercurial import (
28 28 ancestor,
29 29 bundlerepo,
30 30 error,
31 31 extensions,
32 32 filelog,
33 33 localrepo,
34 34 mdiff,
35 35 pycompat,
36 36 revlog,
37 37 store,
38 38 verify,
39 39 )
40 40
41 41 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
42 42 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
43 43 # be specifying the version(s) of Mercurial they are tested with, or
44 44 # leave the attribute unspecified.
45 45 testedwith = 'ships-with-hg-core'
46 46
47 47 REQUIREMENT = 'testonly-simplestore'
48 48
49 49 def validatenode(node):
50 50 if isinstance(node, int):
51 51 raise ValueError('expected node; got int')
52 52
53 53 if len(node) != 20:
54 54 raise ValueError('expected 20 byte node')
55 55
56 56 def validaterev(rev):
57 57 if not isinstance(rev, int):
58 58 raise ValueError('expected int')
59 59
60 60 class filestorage(object):
61 61 """Implements storage for a tracked path.
62 62
63 63 Data is stored in the VFS in a directory corresponding to the tracked
64 64 path.
65 65
66 66 Index data is stored in an ``index`` file using CBOR.
67 67
68 68 Fulltext data is stored in files having names of the node.
69 69 """
70 70
71 71 def __init__(self, svfs, path):
72 72 self._svfs = svfs
73 73 self._path = path
74 74
75 75 self._storepath = b'/'.join([b'data', path])
76 76 self._indexpath = b'/'.join([self._storepath, b'index'])
77 77
78 78 indexdata = self._svfs.tryread(self._indexpath)
79 79 if indexdata:
80 80 indexdata = cbor.loads(indexdata)
81 81
82 82 self._indexdata = indexdata or []
83 83 self._indexbynode = {}
84 84 self._indexbyrev = {}
85 85 self.index = []
86 86 self._refreshindex()
87 87
88 88 # This is used by changegroup code :/
89 89 self._generaldelta = True
90 90 self.storedeltachains = False
91 91
92 92 self.version = 1
93 93
94 94 def _refreshindex(self):
95 95 self._indexbynode.clear()
96 96 self._indexbyrev.clear()
97 97 self.index = []
98 98
99 99 for i, entry in enumerate(self._indexdata):
100 100 self._indexbynode[entry[b'node']] = entry
101 101 self._indexbyrev[i] = entry
102 102
103 103 self._indexbynode[nullid] = {
104 104 b'node': nullid,
105 105 b'p1': nullid,
106 106 b'p2': nullid,
107 107 b'linkrev': nullrev,
108 108 b'flags': 0,
109 109 }
110 110
111 111 self._indexbyrev[nullrev] = {
112 112 b'node': nullid,
113 113 b'p1': nullid,
114 114 b'p2': nullid,
115 115 b'linkrev': nullrev,
116 116 b'flags': 0,
117 117 }
118 118
119 119 for i, entry in enumerate(self._indexdata):
120 120 p1rev, p2rev = self.parentrevs(self.rev(entry[b'node']))
121 121
122 122 # start, length, rawsize, chainbase, linkrev, p1, p2, node
123 123 self.index.append((0, 0, 0, -1, entry[b'linkrev'], p1rev, p2rev,
124 124 entry[b'node']))
125 125
126 126 self.index.append((0, 0, 0, -1, -1, -1, -1, nullid))
127 127
128 128 def __len__(self):
129 129 return len(self._indexdata)
130 130
131 131 def __iter__(self):
132 132 return iter(range(len(self)))
133 133
134 134 def revs(self, start=0, stop=None):
135 135 step = 1
136 136 if stop is not None:
137 137 if start > stop:
138 138 step = -1
139 139
140 140 stop += step
141 141 else:
142 142 stop = len(self)
143 143
144 144 return range(start, stop, step)
145 145
146 146 def parents(self, node):
147 147 validatenode(node)
148 148
149 149 if node not in self._indexbynode:
150 150 raise KeyError('unknown node')
151 151
152 152 entry = self._indexbynode[node]
153 153
154 154 return entry[b'p1'], entry[b'p2']
155 155
156 156 def parentrevs(self, rev):
157 157 p1, p2 = self.parents(self._indexbyrev[rev][b'node'])
158 158 return self.rev(p1), self.rev(p2)
159 159
160 160 def rev(self, node):
161 161 validatenode(node)
162 162
163 163 try:
164 164 self._indexbynode[node]
165 165 except KeyError:
166 166 raise error.LookupError(node, self._indexpath, _('no node'))
167 167
168 168 for rev, entry in self._indexbyrev.items():
169 169 if entry[b'node'] == node:
170 170 return rev
171 171
172 172 raise error.ProgrammingError('this should not occur')
173 173
174 174 def node(self, rev):
175 175 validaterev(rev)
176 176
177 177 return self._indexbyrev[rev][b'node']
178 178
179 179 def lookup(self, node):
180 180 if isinstance(node, int):
181 181 return self.node(node)
182 182
183 183 if len(node) == 20:
184 184 self.rev(node)
185 185 return node
186 186
187 187 try:
188 188 rev = int(node)
189 189 if '%d' % rev != node:
190 190 raise ValueError
191 191
192 192 if rev < 0:
193 193 rev = len(self) + rev
194 194 if rev < 0 or rev >= len(self):
195 195 raise ValueError
196 196
197 197 return self.node(rev)
198 198 except (ValueError, OverflowError):
199 199 pass
200 200
201 201 if len(node) == 40:
202 202 try:
203 203 rawnode = bin(node)
204 204 self.rev(rawnode)
205 205 return rawnode
206 206 except TypeError:
207 207 pass
208 208
209 209 raise error.LookupError(node, self._path, _('invalid lookup input'))
210 210
211 211 def linkrev(self, rev):
212 212 validaterev(rev)
213 213
214 214 return self._indexbyrev[rev][b'linkrev']
215 215
216 216 def flags(self, rev):
217 217 validaterev(rev)
218 218
219 219 return self._indexbyrev[rev][b'flags']
220 220
221 221 def deltaparent(self, rev):
222 222 validaterev(rev)
223 223
224 224 p1node = self.parents(self.node(rev))[0]
225 225 return self.rev(p1node)
226 226
227 227 def candelta(self, baserev, rev):
228 228 validaterev(baserev)
229 229 validaterev(rev)
230 230
231 231 if ((self.flags(baserev) & revlog.REVIDX_RAWTEXT_CHANGING_FLAGS)
232 232 or (self.flags(rev) & revlog.REVIDX_RAWTEXT_CHANGING_FLAGS)):
233 233 return False
234 234
235 235 return True
236 236
237 237 def rawsize(self, rev):
238 238 validaterev(rev)
239 239 node = self.node(rev)
240 240 return len(self.revision(node, raw=True))
241 241
242 242 def _processflags(self, text, flags, operation, raw=False):
243 243 if flags == 0:
244 244 return text, True
245 245
246 246 validatehash = True
247 247 # Depending on the operation (read or write), the order might be
248 248 # reversed due to non-commutative transforms.
249 249 orderedflags = revlog.REVIDX_FLAGS_ORDER
250 250 if operation == 'write':
251 251 orderedflags = reversed(orderedflags)
252 252
253 253 for flag in orderedflags:
254 254 # If a flagprocessor has been registered for a known flag, apply the
255 255 # related operation transform and update result tuple.
256 256 if flag & flags:
257 257 vhash = True
258 258
259 259 if flag not in revlog._flagprocessors:
260 260 message = _("missing processor for flag '%#x'") % (flag)
261 261 raise revlog.RevlogError(message)
262 262
263 263 processor = revlog._flagprocessors[flag]
264 264 if processor is not None:
265 265 readtransform, writetransform, rawtransform = processor
266 266
267 267 if raw:
268 268 vhash = rawtransform(self, text)
269 269 elif operation == 'read':
270 270 text, vhash = readtransform(self, text)
271 271 else: # write operation
272 272 text, vhash = writetransform(self, text)
273 273 validatehash = validatehash and vhash
274 274
275 275 return text, validatehash
276 276
277 277 def checkhash(self, text, node, p1=None, p2=None, rev=None):
278 278 if p1 is None and p2 is None:
279 279 p1, p2 = self.parents(node)
280 280 if node != revlog.hash(text, p1, p2):
281 281 raise error.RevlogError(_("integrity check failed on %s") %
282 282 self._path)
283 283
284 284 def revision(self, node, raw=False):
285 285 validatenode(node)
286 286
287 287 if node == nullid:
288 288 return b''
289 289
290 290 rev = self.rev(node)
291 291 flags = self.flags(rev)
292 292
293 293 path = b'/'.join([self._storepath, hex(node)])
294 294 rawtext = self._svfs.read(path)
295 295
296 296 text, validatehash = self._processflags(rawtext, flags, 'read', raw=raw)
297 297 if validatehash:
298 298 self.checkhash(text, node, rev=rev)
299 299
300 300 return text
301 301
302 302 def read(self, node):
303 303 validatenode(node)
304 304
305 305 revision = self.revision(node)
306 306
307 307 if not revision.startswith(b'\1\n'):
308 308 return revision
309 309
310 310 start = revision.index(b'\1\n', 2)
311 311 return revision[start + 2:]
312 312
313 313 def renamed(self, node):
314 314 validatenode(node)
315 315
316 316 if self.parents(node)[0] != nullid:
317 317 return False
318 318
319 319 fulltext = self.revision(node)
320 320 m = filelog.parsemeta(fulltext)[0]
321 321
322 322 if m and 'copy' in m:
323 323 return m['copy'], bin(m['copyrev'])
324 324
325 325 return False
326 326
327 327 def cmp(self, node, text):
328 328 validatenode(node)
329 329
330 330 t = text
331 331
332 332 if text.startswith(b'\1\n'):
333 333 t = b'\1\n\1\n' + text
334 334
335 335 p1, p2 = self.parents(node)
336 336
337 337 if revlog.hash(t, p1, p2) == node:
338 338 return False
339 339
340 340 if self.iscensored(self.rev(node)):
341 341 return text != b''
342 342
343 343 if self.renamed(node):
344 344 t2 = self.read(node)
345 345 return t2 != text
346 346
347 347 return True
348 348
349 349 def size(self, rev):
350 350 validaterev(rev)
351 351
352 352 node = self._indexbyrev[rev][b'node']
353 353
354 354 if self.renamed(node):
355 355 return len(self.read(node))
356 356
357 357 if self.iscensored(rev):
358 358 return 0
359 359
360 360 return len(self.revision(node))
361 361
362 362 def iscensored(self, rev):
363 363 validaterev(rev)
364 364
365 365 return self.flags(rev) & revlog.REVIDX_ISCENSORED
366 366
367 367 def commonancestorsheads(self, a, b):
368 368 validatenode(a)
369 369 validatenode(b)
370 370
371 371 a = self.rev(a)
372 372 b = self.rev(b)
373 373
374 374 ancestors = ancestor.commonancestorsheads(self.parentrevs, a, b)
375 375 return pycompat.maplist(self.node, ancestors)
376 376
377 377 def descendants(self, revs):
378 378 # This is a copy of revlog.descendants()
379 379 first = min(revs)
380 380 if first == nullrev:
381 381 for i in self:
382 382 yield i
383 383 return
384 384
385 385 seen = set(revs)
386 386 for i in self.revs(start=first + 1):
387 387 for x in self.parentrevs(i):
388 388 if x != nullrev and x in seen:
389 389 seen.add(i)
390 390 yield i
391 391 break
392 392
393 393 # Required by verify.
394 394 def files(self):
395 395 entries = self._svfs.listdir(self._storepath)
396 396
397 397 # Strip out undo.backup.* files created as part of transaction
398 398 # recording.
399 399 entries = [f for f in entries if not f.startswith('undo.backup.')]
400 400
401 401 return [b'/'.join((self._storepath, f)) for f in entries]
402 402
403 403 # Required by verify.
404 404 def checksize(self):
405 405 return 0, 0
406 406
407 407 def add(self, text, meta, transaction, linkrev, p1, p2):
408 transaction.addbackup(self._indexpath)
409
408 410 if meta or text.startswith(b'\1\n'):
409 411 text = filelog.packmeta(meta, text)
410 412
411 413 return self.addrevision(text, transaction, linkrev, p1, p2)
412 414
413 415 def addrevision(self, text, transaction, linkrev, p1, p2, node=None,
414 416 flags=0):
415 417 validatenode(p1)
416 418 validatenode(p2)
417 419
418 420 if flags:
419 421 node = node or revlog.hash(text, p1, p2)
420 422
421 423 rawtext, validatehash = self._processflags(text, flags, 'write')
422 424
423 425 node = node or revlog.hash(text, p1, p2)
424 426
425 427 if node in self._indexbynode:
426 428 return node
427 429
428 430 if validatehash:
429 431 self.checkhash(rawtext, node, p1=p1, p2=p2)
430 432
431 433 path = b'/'.join([self._storepath, hex(node)])
432 434
433 435 self._svfs.write(path, text)
434 436
435 437 self._indexdata.append({
436 438 b'node': node,
437 439 b'p1': p1,
438 440 b'p2': p2,
439 441 b'linkrev': linkrev,
440 442 b'flags': flags,
441 443 })
442 444
443 445 self._reflectindexupdate()
444 446
445 447 return node
446 448
447 449 def _reflectindexupdate(self):
448 450 self._refreshindex()
449 451 self._svfs.write(self._indexpath, cbor.dumps(self._indexdata))
450 452
451 453 def addgroup(self, deltas, linkmapper, transaction, addrevisioncb=None):
452 454 nodes = []
453 455
454 456 transaction.addbackup(self._indexpath)
455 457
456 458 for node, p1, p2, linknode, deltabase, delta, flags in deltas:
457 459 linkrev = linkmapper(linknode)
458 460
459 461 nodes.append(node)
460 462
461 463 if node in self._indexbynode:
462 464 continue
463 465
464 466 # Need to resolve the fulltext from the delta base.
465 467 if deltabase == nullid:
466 468 text = mdiff.patch(b'', delta)
467 469 else:
468 470 text = mdiff.patch(self.revision(deltabase), delta)
469 471
470 472 self.addrevision(text, transaction, linkrev, p1, p2, flags)
471 473
472 474 if addrevisioncb:
473 475 addrevisioncb(self, node)
474 476
475 477 return nodes
476 478
477 479 def revdiff(self, rev1, rev2):
478 480 validaterev(rev1)
479 481 validaterev(rev2)
480 482
481 483 node1 = self.node(rev1)
482 484 node2 = self.node(rev2)
483 485
484 486 return mdiff.textdiff(self.revision(node1, raw=True),
485 487 self.revision(node2, raw=True))
486 488
487 489 def headrevs(self):
488 490 # Assume all revisions are heads by default.
489 491 revishead = {rev: True for rev in self._indexbyrev}
490 492
491 493 for rev, entry in self._indexbyrev.items():
492 494 # Unset head flag for all seen parents.
493 495 revishead[self.rev(entry[b'p1'])] = False
494 496 revishead[self.rev(entry[b'p2'])] = False
495 497
496 498 return [rev for rev, ishead in sorted(revishead.items())
497 499 if ishead]
498 500
499 501 def heads(self, start=None, stop=None):
500 502 # This is copied from revlog.py.
501 503 if start is None and stop is None:
502 504 if not len(self):
503 505 return [nullid]
504 506 return [self.node(r) for r in self.headrevs()]
505 507
506 508 if start is None:
507 509 start = nullid
508 510 if stop is None:
509 511 stop = []
510 512 stoprevs = set([self.rev(n) for n in stop])
511 513 startrev = self.rev(start)
512 514 reachable = {startrev}
513 515 heads = {startrev}
514 516
515 517 parentrevs = self.parentrevs
516 518 for r in self.revs(start=startrev + 1):
517 519 for p in parentrevs(r):
518 520 if p in reachable:
519 521 if r not in stoprevs:
520 522 reachable.add(r)
521 523 heads.add(r)
522 524 if p in heads and p not in stoprevs:
523 525 heads.remove(p)
524 526
525 527 return [self.node(r) for r in heads]
526 528
527 529 def children(self, node):
528 530 validatenode(node)
529 531
530 532 # This is a copy of revlog.children().
531 533 c = []
532 534 p = self.rev(node)
533 535 for r in self.revs(start=p + 1):
534 536 prevs = [pr for pr in self.parentrevs(r) if pr != nullrev]
535 537 if prevs:
536 538 for pr in prevs:
537 539 if pr == p:
538 540 c.append(self.node(r))
539 541 elif p == nullrev:
540 542 c.append(self.node(r))
541 543 return c
542 544
543 545 def getstrippoint(self, minlink):
544 546
545 547 # This is largely a copy of revlog.getstrippoint().
546 548 brokenrevs = set()
547 549 strippoint = len(self)
548 550
549 551 heads = {}
550 552 futurelargelinkrevs = set()
551 553 for head in self.headrevs():
552 554 headlinkrev = self.linkrev(head)
553 555 heads[head] = headlinkrev
554 556 if headlinkrev >= minlink:
555 557 futurelargelinkrevs.add(headlinkrev)
556 558
557 559 # This algorithm involves walking down the rev graph, starting at the
558 560 # heads. Since the revs are topologically sorted according to linkrev,
559 561 # once all head linkrevs are below the minlink, we know there are
560 562 # no more revs that could have a linkrev greater than minlink.
561 563 # So we can stop walking.
562 564 while futurelargelinkrevs:
563 565 strippoint -= 1
564 566 linkrev = heads.pop(strippoint)
565 567
566 568 if linkrev < minlink:
567 569 brokenrevs.add(strippoint)
568 570 else:
569 571 futurelargelinkrevs.remove(linkrev)
570 572
571 573 for p in self.parentrevs(strippoint):
572 574 if p != nullrev:
573 575 plinkrev = self.linkrev(p)
574 576 heads[p] = plinkrev
575 577 if plinkrev >= minlink:
576 578 futurelargelinkrevs.add(plinkrev)
577 579
578 580 return strippoint, brokenrevs
579 581
580 582 def strip(self, minlink, transaction):
581 583 if not len(self):
582 584 return
583 585
584 586 rev, _ignored = self.getstrippoint(minlink)
585 587 if rev == len(self):
586 588 return
587 589
588 590 # Purge index data starting at the requested revision.
589 591 self._indexdata[rev:] = []
590 592 self._reflectindexupdate()
591 593
592 594 def issimplestorefile(f, kind, st):
593 595 if kind != stat.S_IFREG:
594 596 return False
595 597
596 598 if store.isrevlog(f, kind, st):
597 599 return False
598 600
599 601 # Ignore transaction undo files.
600 602 if f.startswith('undo.'):
601 603 return False
602 604
603 605 # Otherwise assume it belongs to the simple store.
604 606 return True
605 607
606 608 class simplestore(store.encodedstore):
607 609 def datafiles(self):
608 610 for x in super(simplestore, self).datafiles():
609 611 yield x
610 612
611 613 # Supplement with non-revlog files.
612 614 extrafiles = self._walk('data', True, filefilter=issimplestorefile)
613 615
614 616 for unencoded, encoded, size in extrafiles:
615 617 try:
616 618 unencoded = store.decodefilename(unencoded)
617 619 except KeyError:
618 620 unencoded = None
619 621
620 622 yield unencoded, encoded, size
621 623
622 624 def reposetup(ui, repo):
623 625 if not repo.local():
624 626 return
625 627
626 628 if isinstance(repo, bundlerepo.bundlerepository):
627 629 raise error.Abort(_('cannot use simple store with bundlerepo'))
628 630
629 631 class simplestorerepo(repo.__class__):
630 632 def file(self, f):
631 633 return filestorage(self.svfs, f)
632 634
633 635 repo.__class__ = simplestorerepo
634 636
635 637 def featuresetup(ui, supported):
636 638 supported.add(REQUIREMENT)
637 639
638 640 def newreporequirements(orig, repo):
639 641 """Modifies default requirements for new repos to use the simple store."""
640 642 requirements = orig(repo)
641 643
642 644 # These requirements are only used to affect creation of the store
643 645 # object. We have our own store. So we can remove them.
644 646 # TODO do this once we feel like taking the test hit.
645 647 #if 'fncache' in requirements:
646 648 # requirements.remove('fncache')
647 649 #if 'dotencode' in requirements:
648 650 # requirements.remove('dotencode')
649 651
650 652 requirements.add(REQUIREMENT)
651 653
652 654 return requirements
653 655
654 656 def makestore(orig, requirements, path, vfstype):
655 657 if REQUIREMENT not in requirements:
656 658 return orig(requirements, path, vfstype)
657 659
658 660 return simplestore(path, vfstype)
659 661
660 662 def verifierinit(orig, self, *args, **kwargs):
661 663 orig(self, *args, **kwargs)
662 664
663 665 # We don't care that files in the store don't align with what is
664 666 # advertised. So suppress these warnings.
665 667 self.warnorphanstorefiles = False
666 668
667 669 def extsetup(ui):
668 670 localrepo.featuresetupfuncs.add(featuresetup)
669 671
670 672 extensions.wrapfunction(localrepo, 'newreporequirements',
671 673 newreporequirements)
672 674 extensions.wrapfunction(store, 'store', makestore)
673 675 extensions.wrapfunction(verify.verifier, '__init__', verifierinit)
@@ -1,1293 +1,1295 b''
1 1 #testcases sshv1 sshv2
2 2
3 3 #if sshv2
4 4 $ cat >> $HGRCPATH << EOF
5 5 > [experimental]
6 6 > sshpeer.advertise-v2 = true
7 7 > sshserver.support-v2 = true
8 8 > EOF
9 9 #endif
10 10
11 11 Prepare repo a:
12 12
13 13 $ hg init a
14 14 $ cd a
15 15 $ echo a > a
16 16 $ hg add a
17 17 $ hg commit -m test
18 18 $ echo first line > b
19 19 $ hg add b
20 20
21 21 Create a non-inlined filelog:
22 22
23 23 $ $PYTHON -c 'open("data1", "wb").write(b"".join(b"%d\n" % x for x in range(10000)))'
24 24 $ for j in 0 1 2 3 4 5 6 7 8 9; do
25 25 > cat data1 >> b
26 26 > hg commit -m test
27 27 > done
28 28
29 29 List files in store/data (should show a 'b.d'):
30 30
31 31 #if reporevlogstore
32 32 $ for i in .hg/store/data/*; do
33 33 > echo $i
34 34 > done
35 35 .hg/store/data/a.i
36 36 .hg/store/data/b.d
37 37 .hg/store/data/b.i
38 38 #endif
39 39
40 40 Trigger branchcache creation:
41 41
42 42 $ hg branches
43 43 default 10:a7949464abda
44 44 $ ls .hg/cache
45 45 branch2-served
46 46 checkisexec (execbit !)
47 47 checklink (symlink !)
48 48 checklink-target (symlink !)
49 49 checknoexec (execbit !)
50 50 rbc-names-v1
51 51 rbc-revs-v1
52 52
53 53 Default operation:
54 54
55 55 $ hg clone . ../b
56 56 updating to branch default
57 57 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
58 58 $ cd ../b
59 59
60 60 Ensure branchcache got copied over:
61 61
62 62 $ ls .hg/cache
63 63 branch2-served
64 64 checkisexec (execbit !)
65 65 checklink (symlink !)
66 66 checklink-target (symlink !)
67 67 rbc-names-v1
68 68 rbc-revs-v1
69 69
70 70 $ cat a
71 71 a
72 72 $ hg verify
73 73 checking changesets
74 74 checking manifests
75 75 crosschecking files in changesets and manifests
76 76 checking files
77 77 2 files, 11 changesets, 11 total revisions
78 78
79 79 Invalid dest '' must abort:
80 80
81 81 $ hg clone . ''
82 82 abort: empty destination path is not valid
83 83 [255]
84 84
85 85 No update, with debug option:
86 86
87 87 #if hardlink
88 88 $ hg --debug clone -U . ../c --config progress.debug=true
89 89 linking: 1
90 90 linking: 2
91 91 linking: 3
92 92 linking: 4
93 93 linking: 5
94 94 linking: 6
95 95 linking: 7
96 96 linking: 8
97 97 linked 8 files (reporevlogstore !)
98 98 linking: 9 (reposimplestore !)
99 99 linking: 10 (reposimplestore !)
100 100 linking: 11 (reposimplestore !)
101 101 linking: 12 (reposimplestore !)
102 102 linking: 13 (reposimplestore !)
103 103 linking: 14 (reposimplestore !)
104 104 linking: 15 (reposimplestore !)
105 105 linking: 16 (reposimplestore !)
106 106 linking: 17 (reposimplestore !)
107 linked 17 files (reposimplestore !)
107 linking: 18 (reposimplestore !)
108 linked 18 files (reposimplestore !)
108 109 #else
109 110 $ hg --debug clone -U . ../c --config progress.debug=true
110 111 linking: 1
111 112 copying: 2
112 113 copying: 3
113 114 copying: 4
114 115 copying: 5
115 116 copying: 6
116 117 copying: 7
117 118 copying: 8
118 119 copied 8 files (reporevlogstore !)
119 120 copying: 9 (reposimplestore !)
120 121 copying: 10 (reposimplestore !)
121 122 copying: 11 (reposimplestore !)
122 123 copying: 12 (reposimplestore !)
123 124 copying: 13 (reposimplestore !)
124 125 copying: 14 (reposimplestore !)
125 126 copying: 15 (reposimplestore !)
126 127 copying: 16 (reposimplestore !)
127 128 copying: 17 (reposimplestore !)
128 copied 17 files (reposimplestore !)
129 copying: 18 (reposimplestore !)
130 copied 18 files (reposimplestore !)
129 131 #endif
130 132 $ cd ../c
131 133
132 134 Ensure branchcache got copied over:
133 135
134 136 $ ls .hg/cache
135 137 branch2-served
136 138 rbc-names-v1
137 139 rbc-revs-v1
138 140
139 141 $ cat a 2>/dev/null || echo "a not present"
140 142 a not present
141 143 $ hg verify
142 144 checking changesets
143 145 checking manifests
144 146 crosschecking files in changesets and manifests
145 147 checking files
146 148 2 files, 11 changesets, 11 total revisions
147 149
148 150 Default destination:
149 151
150 152 $ mkdir ../d
151 153 $ cd ../d
152 154 $ hg clone ../a
153 155 destination directory: a
154 156 updating to branch default
155 157 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
156 158 $ cd a
157 159 $ hg cat a
158 160 a
159 161 $ cd ../..
160 162
161 163 Check that we drop the 'file:' from the path before writing the .hgrc:
162 164
163 165 $ hg clone file:a e
164 166 updating to branch default
165 167 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
166 168 $ grep 'file:' e/.hg/hgrc
167 169 [1]
168 170
169 171 Check that path aliases are expanded:
170 172
171 173 $ hg clone -q -U --config 'paths.foobar=a#0' foobar f
172 174 $ hg -R f showconfig paths.default
173 175 $TESTTMP/a#0
174 176
175 177 Use --pull:
176 178
177 179 $ hg clone --pull a g
178 180 requesting all changes
179 181 adding changesets
180 182 adding manifests
181 183 adding file changes
182 184 added 11 changesets with 11 changes to 2 files
183 185 new changesets acb14030fe0a:a7949464abda
184 186 updating to branch default
185 187 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
186 188 $ hg -R g verify
187 189 checking changesets
188 190 checking manifests
189 191 crosschecking files in changesets and manifests
190 192 checking files
191 193 2 files, 11 changesets, 11 total revisions
192 194
193 195 Invalid dest '' with --pull must abort (issue2528):
194 196
195 197 $ hg clone --pull a ''
196 198 abort: empty destination path is not valid
197 199 [255]
198 200
199 201 Clone to '.':
200 202
201 203 $ mkdir h
202 204 $ cd h
203 205 $ hg clone ../a .
204 206 updating to branch default
205 207 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
206 208 $ cd ..
207 209
208 210
209 211 *** Tests for option -u ***
210 212
211 213 Adding some more history to repo a:
212 214
213 215 $ cd a
214 216 $ hg tag ref1
215 217 $ echo the quick brown fox >a
216 218 $ hg ci -m "hacked default"
217 219 $ hg up ref1
218 220 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
219 221 $ hg branch stable
220 222 marked working directory as branch stable
221 223 (branches are permanent and global, did you want a bookmark?)
222 224 $ echo some text >a
223 225 $ hg ci -m "starting branch stable"
224 226 $ hg tag ref2
225 227 $ echo some more text >a
226 228 $ hg ci -m "another change for branch stable"
227 229 $ hg up ref2
228 230 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
229 231 $ hg parents
230 232 changeset: 13:e8ece76546a6
231 233 branch: stable
232 234 tag: ref2
233 235 parent: 10:a7949464abda
234 236 user: test
235 237 date: Thu Jan 01 00:00:00 1970 +0000
236 238 summary: starting branch stable
237 239
238 240
239 241 Repo a has two heads:
240 242
241 243 $ hg heads
242 244 changeset: 15:0aae7cf88f0d
243 245 branch: stable
244 246 tag: tip
245 247 user: test
246 248 date: Thu Jan 01 00:00:00 1970 +0000
247 249 summary: another change for branch stable
248 250
249 251 changeset: 12:f21241060d6a
250 252 user: test
251 253 date: Thu Jan 01 00:00:00 1970 +0000
252 254 summary: hacked default
253 255
254 256
255 257 $ cd ..
256 258
257 259
258 260 Testing --noupdate with --updaterev (must abort):
259 261
260 262 $ hg clone --noupdate --updaterev 1 a ua
261 263 abort: cannot specify both --noupdate and --updaterev
262 264 [255]
263 265
264 266
265 267 Testing clone -u:
266 268
267 269 $ hg clone -u . a ua
268 270 updating to branch stable
269 271 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
270 272
271 273 Repo ua has both heads:
272 274
273 275 $ hg -R ua heads
274 276 changeset: 15:0aae7cf88f0d
275 277 branch: stable
276 278 tag: tip
277 279 user: test
278 280 date: Thu Jan 01 00:00:00 1970 +0000
279 281 summary: another change for branch stable
280 282
281 283 changeset: 12:f21241060d6a
282 284 user: test
283 285 date: Thu Jan 01 00:00:00 1970 +0000
284 286 summary: hacked default
285 287
286 288
287 289 Same revision checked out in repo a and ua:
288 290
289 291 $ hg -R a parents --template "{node|short}\n"
290 292 e8ece76546a6
291 293 $ hg -R ua parents --template "{node|short}\n"
292 294 e8ece76546a6
293 295
294 296 $ rm -r ua
295 297
296 298
297 299 Testing clone --pull -u:
298 300
299 301 $ hg clone --pull -u . a ua
300 302 requesting all changes
301 303 adding changesets
302 304 adding manifests
303 305 adding file changes
304 306 added 16 changesets with 16 changes to 3 files (+1 heads)
305 307 new changesets acb14030fe0a:0aae7cf88f0d
306 308 updating to branch stable
307 309 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
308 310
309 311 Repo ua has both heads:
310 312
311 313 $ hg -R ua heads
312 314 changeset: 15:0aae7cf88f0d
313 315 branch: stable
314 316 tag: tip
315 317 user: test
316 318 date: Thu Jan 01 00:00:00 1970 +0000
317 319 summary: another change for branch stable
318 320
319 321 changeset: 12:f21241060d6a
320 322 user: test
321 323 date: Thu Jan 01 00:00:00 1970 +0000
322 324 summary: hacked default
323 325
324 326
325 327 Same revision checked out in repo a and ua:
326 328
327 329 $ hg -R a parents --template "{node|short}\n"
328 330 e8ece76546a6
329 331 $ hg -R ua parents --template "{node|short}\n"
330 332 e8ece76546a6
331 333
332 334 $ rm -r ua
333 335
334 336
335 337 Testing clone -u <branch>:
336 338
337 339 $ hg clone -u stable a ua
338 340 updating to branch stable
339 341 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
340 342
341 343 Repo ua has both heads:
342 344
343 345 $ hg -R ua heads
344 346 changeset: 15:0aae7cf88f0d
345 347 branch: stable
346 348 tag: tip
347 349 user: test
348 350 date: Thu Jan 01 00:00:00 1970 +0000
349 351 summary: another change for branch stable
350 352
351 353 changeset: 12:f21241060d6a
352 354 user: test
353 355 date: Thu Jan 01 00:00:00 1970 +0000
354 356 summary: hacked default
355 357
356 358
357 359 Branch 'stable' is checked out:
358 360
359 361 $ hg -R ua parents
360 362 changeset: 15:0aae7cf88f0d
361 363 branch: stable
362 364 tag: tip
363 365 user: test
364 366 date: Thu Jan 01 00:00:00 1970 +0000
365 367 summary: another change for branch stable
366 368
367 369
368 370 $ rm -r ua
369 371
370 372
371 373 Testing default checkout:
372 374
373 375 $ hg clone a ua
374 376 updating to branch default
375 377 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
376 378
377 379 Repo ua has both heads:
378 380
379 381 $ hg -R ua heads
380 382 changeset: 15:0aae7cf88f0d
381 383 branch: stable
382 384 tag: tip
383 385 user: test
384 386 date: Thu Jan 01 00:00:00 1970 +0000
385 387 summary: another change for branch stable
386 388
387 389 changeset: 12:f21241060d6a
388 390 user: test
389 391 date: Thu Jan 01 00:00:00 1970 +0000
390 392 summary: hacked default
391 393
392 394
393 395 Branch 'default' is checked out:
394 396
395 397 $ hg -R ua parents
396 398 changeset: 12:f21241060d6a
397 399 user: test
398 400 date: Thu Jan 01 00:00:00 1970 +0000
399 401 summary: hacked default
400 402
401 403 Test clone with a branch named "@" (issue3677)
402 404
403 405 $ hg -R ua branch @
404 406 marked working directory as branch @
405 407 $ hg -R ua commit -m 'created branch @'
406 408 $ hg clone ua atbranch
407 409 updating to branch default
408 410 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
409 411 $ hg -R atbranch heads
410 412 changeset: 16:798b6d97153e
411 413 branch: @
412 414 tag: tip
413 415 parent: 12:f21241060d6a
414 416 user: test
415 417 date: Thu Jan 01 00:00:00 1970 +0000
416 418 summary: created branch @
417 419
418 420 changeset: 15:0aae7cf88f0d
419 421 branch: stable
420 422 user: test
421 423 date: Thu Jan 01 00:00:00 1970 +0000
422 424 summary: another change for branch stable
423 425
424 426 changeset: 12:f21241060d6a
425 427 user: test
426 428 date: Thu Jan 01 00:00:00 1970 +0000
427 429 summary: hacked default
428 430
429 431 $ hg -R atbranch parents
430 432 changeset: 12:f21241060d6a
431 433 user: test
432 434 date: Thu Jan 01 00:00:00 1970 +0000
433 435 summary: hacked default
434 436
435 437
436 438 $ rm -r ua atbranch
437 439
438 440
439 441 Testing #<branch>:
440 442
441 443 $ hg clone -u . a#stable ua
442 444 adding changesets
443 445 adding manifests
444 446 adding file changes
445 447 added 14 changesets with 14 changes to 3 files
446 448 new changesets acb14030fe0a:0aae7cf88f0d
447 449 updating to branch stable
448 450 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
449 451
450 452 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
451 453
452 454 $ hg -R ua heads
453 455 changeset: 13:0aae7cf88f0d
454 456 branch: stable
455 457 tag: tip
456 458 user: test
457 459 date: Thu Jan 01 00:00:00 1970 +0000
458 460 summary: another change for branch stable
459 461
460 462 changeset: 10:a7949464abda
461 463 user: test
462 464 date: Thu Jan 01 00:00:00 1970 +0000
463 465 summary: test
464 466
465 467
466 468 Same revision checked out in repo a and ua:
467 469
468 470 $ hg -R a parents --template "{node|short}\n"
469 471 e8ece76546a6
470 472 $ hg -R ua parents --template "{node|short}\n"
471 473 e8ece76546a6
472 474
473 475 $ rm -r ua
474 476
475 477
476 478 Testing -u -r <branch>:
477 479
478 480 $ hg clone -u . -r stable a ua
479 481 adding changesets
480 482 adding manifests
481 483 adding file changes
482 484 added 14 changesets with 14 changes to 3 files
483 485 new changesets acb14030fe0a:0aae7cf88f0d
484 486 updating to branch stable
485 487 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
486 488
487 489 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
488 490
489 491 $ hg -R ua heads
490 492 changeset: 13:0aae7cf88f0d
491 493 branch: stable
492 494 tag: tip
493 495 user: test
494 496 date: Thu Jan 01 00:00:00 1970 +0000
495 497 summary: another change for branch stable
496 498
497 499 changeset: 10:a7949464abda
498 500 user: test
499 501 date: Thu Jan 01 00:00:00 1970 +0000
500 502 summary: test
501 503
502 504
503 505 Same revision checked out in repo a and ua:
504 506
505 507 $ hg -R a parents --template "{node|short}\n"
506 508 e8ece76546a6
507 509 $ hg -R ua parents --template "{node|short}\n"
508 510 e8ece76546a6
509 511
510 512 $ rm -r ua
511 513
512 514
513 515 Testing -r <branch>:
514 516
515 517 $ hg clone -r stable a ua
516 518 adding changesets
517 519 adding manifests
518 520 adding file changes
519 521 added 14 changesets with 14 changes to 3 files
520 522 new changesets acb14030fe0a:0aae7cf88f0d
521 523 updating to branch stable
522 524 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
523 525
524 526 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
525 527
526 528 $ hg -R ua heads
527 529 changeset: 13:0aae7cf88f0d
528 530 branch: stable
529 531 tag: tip
530 532 user: test
531 533 date: Thu Jan 01 00:00:00 1970 +0000
532 534 summary: another change for branch stable
533 535
534 536 changeset: 10:a7949464abda
535 537 user: test
536 538 date: Thu Jan 01 00:00:00 1970 +0000
537 539 summary: test
538 540
539 541
540 542 Branch 'stable' is checked out:
541 543
542 544 $ hg -R ua parents
543 545 changeset: 13:0aae7cf88f0d
544 546 branch: stable
545 547 tag: tip
546 548 user: test
547 549 date: Thu Jan 01 00:00:00 1970 +0000
548 550 summary: another change for branch stable
549 551
550 552
551 553 $ rm -r ua
552 554
553 555
554 556 Issue2267: Error in 1.6 hg.py: TypeError: 'NoneType' object is not
555 557 iterable in addbranchrevs()
556 558
557 559 $ cat <<EOF > simpleclone.py
558 560 > from mercurial import ui, hg
559 561 > myui = ui.ui.load()
560 562 > repo = hg.repository(myui, 'a')
561 563 > hg.clone(myui, {}, repo, dest="ua")
562 564 > EOF
563 565
564 566 $ $PYTHON simpleclone.py
565 567 updating to branch default
566 568 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
567 569
568 570 $ rm -r ua
569 571
570 572 $ cat <<EOF > branchclone.py
571 573 > from mercurial import ui, hg, extensions
572 574 > myui = ui.ui.load()
573 575 > extensions.loadall(myui)
574 576 > repo = hg.repository(myui, 'a')
575 577 > hg.clone(myui, {}, repo, dest="ua", branch=["stable",])
576 578 > EOF
577 579
578 580 $ $PYTHON branchclone.py
579 581 adding changesets
580 582 adding manifests
581 583 adding file changes
582 584 added 14 changesets with 14 changes to 3 files
583 585 new changesets acb14030fe0a:0aae7cf88f0d
584 586 updating to branch stable
585 587 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
586 588 $ rm -r ua
587 589
588 590
589 591 Test clone with special '@' bookmark:
590 592 $ cd a
591 593 $ hg bookmark -r a7949464abda @ # branch point of stable from default
592 594 $ hg clone . ../i
593 595 updating to bookmark @
594 596 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
595 597 $ hg id -i ../i
596 598 a7949464abda
597 599 $ rm -r ../i
598 600
599 601 $ hg bookmark -f -r stable @
600 602 $ hg bookmarks
601 603 @ 15:0aae7cf88f0d
602 604 $ hg clone . ../i
603 605 updating to bookmark @ on branch stable
604 606 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
605 607 $ hg id -i ../i
606 608 0aae7cf88f0d
607 609 $ cd "$TESTTMP"
608 610
609 611
610 612 Testing failures:
611 613
612 614 $ mkdir fail
613 615 $ cd fail
614 616
615 617 No local source
616 618
617 619 $ hg clone a b
618 620 abort: repository a not found!
619 621 [255]
620 622
621 623 No remote source
622 624
623 625 #if windows
624 626 $ hg clone http://$LOCALIP:3121/a b
625 627 abort: error: * (glob)
626 628 [255]
627 629 #else
628 630 $ hg clone http://$LOCALIP:3121/a b
629 631 abort: error: *refused* (glob)
630 632 [255]
631 633 #endif
632 634 $ rm -rf b # work around bug with http clone
633 635
634 636
635 637 #if unix-permissions no-root
636 638
637 639 Inaccessible source
638 640
639 641 $ mkdir a
640 642 $ chmod 000 a
641 643 $ hg clone a b
642 644 abort: repository a not found!
643 645 [255]
644 646
645 647 Inaccessible destination
646 648
647 649 $ hg init b
648 650 $ cd b
649 651 $ hg clone . ../a
650 652 abort: Permission denied: '../a'
651 653 [255]
652 654 $ cd ..
653 655 $ chmod 700 a
654 656 $ rm -r a b
655 657
656 658 #endif
657 659
658 660
659 661 #if fifo
660 662
661 663 Source of wrong type
662 664
663 665 $ mkfifo a
664 666 $ hg clone a b
665 667 abort: repository a not found!
666 668 [255]
667 669 $ rm a
668 670
669 671 #endif
670 672
671 673 Default destination, same directory
672 674
673 675 $ hg init q
674 676 $ hg clone q
675 677 destination directory: q
676 678 abort: destination 'q' is not empty
677 679 [255]
678 680
679 681 destination directory not empty
680 682
681 683 $ mkdir a
682 684 $ echo stuff > a/a
683 685 $ hg clone q a
684 686 abort: destination 'a' is not empty
685 687 [255]
686 688
687 689
688 690 #if unix-permissions no-root
689 691
690 692 leave existing directory in place after clone failure
691 693
692 694 $ hg init c
693 695 $ cd c
694 696 $ echo c > c
695 697 $ hg commit -A -m test
696 698 adding c
697 699 $ chmod -rx .hg/store/data
698 700 $ cd ..
699 701 $ mkdir d
700 702 $ hg clone c d 2> err
701 703 [255]
702 704 $ test -d d
703 705 $ test -d d/.hg
704 706 [1]
705 707
706 708 re-enable perm to allow deletion
707 709
708 710 $ chmod +rx c/.hg/store/data
709 711
710 712 #endif
711 713
712 714 $ cd ..
713 715
714 716 Test clone from the repository in (emulated) revlog format 0 (issue4203):
715 717
716 718 $ mkdir issue4203
717 719 $ mkdir -p src/.hg
718 720 $ echo foo > src/foo
719 721 $ hg -R src add src/foo
720 722 $ hg -R src commit -m '#0'
721 723 $ hg -R src log -q
722 724 0:e1bab28bca43
723 725 $ hg clone -U -q src dst
724 726 $ hg -R dst log -q
725 727 0:e1bab28bca43
726 728
727 729 Create repositories to test auto sharing functionality
728 730
729 731 $ cat >> $HGRCPATH << EOF
730 732 > [extensions]
731 733 > share=
732 734 > EOF
733 735
734 736 $ hg init empty
735 737 $ hg init source1a
736 738 $ cd source1a
737 739 $ echo initial1 > foo
738 740 $ hg -q commit -A -m initial
739 741 $ echo second > foo
740 742 $ hg commit -m second
741 743 $ cd ..
742 744
743 745 $ hg init filteredrev0
744 746 $ cd filteredrev0
745 747 $ cat >> .hg/hgrc << EOF
746 748 > [experimental]
747 749 > evolution.createmarkers=True
748 750 > EOF
749 751 $ echo initial1 > foo
750 752 $ hg -q commit -A -m initial0
751 753 $ hg -q up -r null
752 754 $ echo initial2 > foo
753 755 $ hg -q commit -A -m initial1
754 756 $ hg debugobsolete c05d5c47a5cf81401869999f3d05f7d699d2b29a e082c1832e09a7d1e78b7fd49a592d372de854c8
755 757 obsoleted 1 changesets
756 758 $ cd ..
757 759
758 760 $ hg -q clone --pull source1a source1b
759 761 $ cd source1a
760 762 $ hg bookmark bookA
761 763 $ echo 1a > foo
762 764 $ hg commit -m 1a
763 765 $ cd ../source1b
764 766 $ hg -q up -r 0
765 767 $ echo head1 > foo
766 768 $ hg commit -m head1
767 769 created new head
768 770 $ hg bookmark head1
769 771 $ hg -q up -r 0
770 772 $ echo head2 > foo
771 773 $ hg commit -m head2
772 774 created new head
773 775 $ hg bookmark head2
774 776 $ hg -q up -r 0
775 777 $ hg branch branch1
776 778 marked working directory as branch branch1
777 779 (branches are permanent and global, did you want a bookmark?)
778 780 $ echo branch1 > foo
779 781 $ hg commit -m branch1
780 782 $ hg -q up -r 0
781 783 $ hg branch branch2
782 784 marked working directory as branch branch2
783 785 $ echo branch2 > foo
784 786 $ hg commit -m branch2
785 787 $ cd ..
786 788 $ hg init source2
787 789 $ cd source2
788 790 $ echo initial2 > foo
789 791 $ hg -q commit -A -m initial2
790 792 $ echo second > foo
791 793 $ hg commit -m second
792 794 $ cd ..
793 795
794 796 Clone with auto share from an empty repo should not result in share
795 797
796 798 $ mkdir share
797 799 $ hg --config share.pool=share clone empty share-empty
798 800 (not using pooled storage: remote appears to be empty)
799 801 updating to branch default
800 802 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
801 803 $ ls share
802 804 $ test -d share-empty/.hg/store
803 805 $ test -f share-empty/.hg/sharedpath
804 806 [1]
805 807
806 808 Clone with auto share from a repo with filtered revision 0 should not result in share
807 809
808 810 $ hg --config share.pool=share clone filteredrev0 share-filtered
809 811 (not using pooled storage: unable to resolve identity of remote)
810 812 requesting all changes
811 813 adding changesets
812 814 adding manifests
813 815 adding file changes
814 816 added 1 changesets with 1 changes to 1 files
815 817 new changesets e082c1832e09
816 818 updating to branch default
817 819 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
818 820
819 821 Clone from repo with content should result in shared store being created
820 822
821 823 $ hg --config share.pool=share clone source1a share-dest1a
822 824 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
823 825 requesting all changes
824 826 adding changesets
825 827 adding manifests
826 828 adding file changes
827 829 added 3 changesets with 3 changes to 1 files
828 830 new changesets b5f04eac9d8f:e5bfe23c0b47
829 831 searching for changes
830 832 no changes found
831 833 adding remote bookmark bookA
832 834 updating working directory
833 835 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
834 836
835 837 The shared repo should have been created
836 838
837 839 $ ls share
838 840 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
839 841
840 842 The destination should point to it
841 843
842 844 $ cat share-dest1a/.hg/sharedpath; echo
843 845 $TESTTMP/share/b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1/.hg
844 846
845 847 The destination should have bookmarks
846 848
847 849 $ hg -R share-dest1a bookmarks
848 850 bookA 2:e5bfe23c0b47
849 851
850 852 The default path should be the remote, not the share
851 853
852 854 $ hg -R share-dest1a config paths.default
853 855 $TESTTMP/source1a
854 856
855 857 Clone with existing share dir should result in pull + share
856 858
857 859 $ hg --config share.pool=share clone source1b share-dest1b
858 860 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
859 861 searching for changes
860 862 adding changesets
861 863 adding manifests
862 864 adding file changes
863 865 added 4 changesets with 4 changes to 1 files (+4 heads)
864 866 adding remote bookmark head1
865 867 adding remote bookmark head2
866 868 new changesets 4a8dc1ab4c13:6bacf4683960
867 869 updating working directory
868 870 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
869 871
870 872 $ ls share
871 873 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
872 874
873 875 $ cat share-dest1b/.hg/sharedpath; echo
874 876 $TESTTMP/share/b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1/.hg
875 877
876 878 We only get bookmarks from the remote, not everything in the share
877 879
878 880 $ hg -R share-dest1b bookmarks
879 881 head1 3:4a8dc1ab4c13
880 882 head2 4:99f71071f117
881 883
882 884 Default path should be source, not share.
883 885
884 886 $ hg -R share-dest1b config paths.default
885 887 $TESTTMP/source1b
886 888
887 889 Checked out revision should be head of default branch
888 890
889 891 $ hg -R share-dest1b log -r .
890 892 changeset: 4:99f71071f117
891 893 bookmark: head2
892 894 parent: 0:b5f04eac9d8f
893 895 user: test
894 896 date: Thu Jan 01 00:00:00 1970 +0000
895 897 summary: head2
896 898
897 899
898 900 Clone from unrelated repo should result in new share
899 901
900 902 $ hg --config share.pool=share clone source2 share-dest2
901 903 (sharing from new pooled repository 22aeff664783fd44c6d9b435618173c118c3448e)
902 904 requesting all changes
903 905 adding changesets
904 906 adding manifests
905 907 adding file changes
906 908 added 2 changesets with 2 changes to 1 files
907 909 new changesets 22aeff664783:63cf6c3dba4a
908 910 searching for changes
909 911 no changes found
910 912 updating working directory
911 913 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
912 914
913 915 $ ls share
914 916 22aeff664783fd44c6d9b435618173c118c3448e
915 917 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
916 918
917 919 remote naming mode works as advertised
918 920
919 921 $ hg --config share.pool=shareremote --config share.poolnaming=remote clone source1a share-remote1a
920 922 (sharing from new pooled repository 195bb1fcdb595c14a6c13e0269129ed78f6debde)
921 923 requesting all changes
922 924 adding changesets
923 925 adding manifests
924 926 adding file changes
925 927 added 3 changesets with 3 changes to 1 files
926 928 new changesets b5f04eac9d8f:e5bfe23c0b47
927 929 searching for changes
928 930 no changes found
929 931 adding remote bookmark bookA
930 932 updating working directory
931 933 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
932 934
933 935 $ ls shareremote
934 936 195bb1fcdb595c14a6c13e0269129ed78f6debde
935 937
936 938 $ hg --config share.pool=shareremote --config share.poolnaming=remote clone source1b share-remote1b
937 939 (sharing from new pooled repository c0d4f83847ca2a873741feb7048a45085fd47c46)
938 940 requesting all changes
939 941 adding changesets
940 942 adding manifests
941 943 adding file changes
942 944 added 6 changesets with 6 changes to 1 files (+4 heads)
943 945 new changesets b5f04eac9d8f:6bacf4683960
944 946 searching for changes
945 947 no changes found
946 948 adding remote bookmark head1
947 949 adding remote bookmark head2
948 950 updating working directory
949 951 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
950 952
951 953 $ ls shareremote
952 954 195bb1fcdb595c14a6c13e0269129ed78f6debde
953 955 c0d4f83847ca2a873741feb7048a45085fd47c46
954 956
955 957 request to clone a single revision is respected in sharing mode
956 958
957 959 $ hg --config share.pool=sharerevs clone -r 4a8dc1ab4c13 source1b share-1arev
958 960 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
959 961 adding changesets
960 962 adding manifests
961 963 adding file changes
962 964 added 2 changesets with 2 changes to 1 files
963 965 new changesets b5f04eac9d8f:4a8dc1ab4c13
964 966 no changes found
965 967 adding remote bookmark head1
966 968 updating working directory
967 969 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
968 970
969 971 $ hg -R share-1arev log -G
970 972 @ changeset: 1:4a8dc1ab4c13
971 973 | bookmark: head1
972 974 | tag: tip
973 975 | user: test
974 976 | date: Thu Jan 01 00:00:00 1970 +0000
975 977 | summary: head1
976 978 |
977 979 o changeset: 0:b5f04eac9d8f
978 980 user: test
979 981 date: Thu Jan 01 00:00:00 1970 +0000
980 982 summary: initial
981 983
982 984
983 985 making another clone should only pull down requested rev
984 986
985 987 $ hg --config share.pool=sharerevs clone -r 99f71071f117 source1b share-1brev
986 988 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
987 989 searching for changes
988 990 adding changesets
989 991 adding manifests
990 992 adding file changes
991 993 added 1 changesets with 1 changes to 1 files (+1 heads)
992 994 adding remote bookmark head1
993 995 adding remote bookmark head2
994 996 new changesets 99f71071f117
995 997 updating working directory
996 998 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
997 999
998 1000 $ hg -R share-1brev log -G
999 1001 @ changeset: 2:99f71071f117
1000 1002 | bookmark: head2
1001 1003 | tag: tip
1002 1004 | parent: 0:b5f04eac9d8f
1003 1005 | user: test
1004 1006 | date: Thu Jan 01 00:00:00 1970 +0000
1005 1007 | summary: head2
1006 1008 |
1007 1009 | o changeset: 1:4a8dc1ab4c13
1008 1010 |/ bookmark: head1
1009 1011 | user: test
1010 1012 | date: Thu Jan 01 00:00:00 1970 +0000
1011 1013 | summary: head1
1012 1014 |
1013 1015 o changeset: 0:b5f04eac9d8f
1014 1016 user: test
1015 1017 date: Thu Jan 01 00:00:00 1970 +0000
1016 1018 summary: initial
1017 1019
1018 1020
1019 1021 Request to clone a single branch is respected in sharing mode
1020 1022
1021 1023 $ hg --config share.pool=sharebranch clone -b branch1 source1b share-1bbranch1
1022 1024 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1023 1025 adding changesets
1024 1026 adding manifests
1025 1027 adding file changes
1026 1028 added 2 changesets with 2 changes to 1 files
1027 1029 new changesets b5f04eac9d8f:5f92a6c1a1b1
1028 1030 no changes found
1029 1031 updating working directory
1030 1032 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1031 1033
1032 1034 $ hg -R share-1bbranch1 log -G
1033 1035 o changeset: 1:5f92a6c1a1b1
1034 1036 | branch: branch1
1035 1037 | tag: tip
1036 1038 | user: test
1037 1039 | date: Thu Jan 01 00:00:00 1970 +0000
1038 1040 | summary: branch1
1039 1041 |
1040 1042 @ changeset: 0:b5f04eac9d8f
1041 1043 user: test
1042 1044 date: Thu Jan 01 00:00:00 1970 +0000
1043 1045 summary: initial
1044 1046
1045 1047
1046 1048 $ hg --config share.pool=sharebranch clone -b branch2 source1b share-1bbranch2
1047 1049 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1048 1050 searching for changes
1049 1051 adding changesets
1050 1052 adding manifests
1051 1053 adding file changes
1052 1054 added 1 changesets with 1 changes to 1 files (+1 heads)
1053 1055 new changesets 6bacf4683960
1054 1056 updating working directory
1055 1057 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1056 1058
1057 1059 $ hg -R share-1bbranch2 log -G
1058 1060 o changeset: 2:6bacf4683960
1059 1061 | branch: branch2
1060 1062 | tag: tip
1061 1063 | parent: 0:b5f04eac9d8f
1062 1064 | user: test
1063 1065 | date: Thu Jan 01 00:00:00 1970 +0000
1064 1066 | summary: branch2
1065 1067 |
1066 1068 | o changeset: 1:5f92a6c1a1b1
1067 1069 |/ branch: branch1
1068 1070 | user: test
1069 1071 | date: Thu Jan 01 00:00:00 1970 +0000
1070 1072 | summary: branch1
1071 1073 |
1072 1074 @ changeset: 0:b5f04eac9d8f
1073 1075 user: test
1074 1076 date: Thu Jan 01 00:00:00 1970 +0000
1075 1077 summary: initial
1076 1078
1077 1079
1078 1080 -U is respected in share clone mode
1079 1081
1080 1082 $ hg --config share.pool=share clone -U source1a share-1anowc
1081 1083 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1082 1084 searching for changes
1083 1085 no changes found
1084 1086 adding remote bookmark bookA
1085 1087
1086 1088 $ ls share-1anowc
1087 1089
1088 1090 Test that auto sharing doesn't cause failure of "hg clone local remote"
1089 1091
1090 1092 $ cd $TESTTMP
1091 1093 $ hg -R a id -r 0
1092 1094 acb14030fe0a
1093 1095 $ hg id -R remote -r 0
1094 1096 abort: repository remote not found!
1095 1097 [255]
1096 1098 $ hg --config share.pool=share -q clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" a ssh://user@dummy/remote
1097 1099 $ hg -R remote id -r 0
1098 1100 acb14030fe0a
1099 1101
1100 1102 Cloning into pooled storage doesn't race (issue5104)
1101 1103
1102 1104 $ HGPOSTLOCKDELAY=2.0 hg --config share.pool=racepool --config extensions.lockdelay=$TESTDIR/lockdelay.py clone source1a share-destrace1 > race1.log 2>&1 &
1103 1105 $ HGPRELOCKDELAY=1.0 hg --config share.pool=racepool --config extensions.lockdelay=$TESTDIR/lockdelay.py clone source1a share-destrace2 > race2.log 2>&1
1104 1106 $ wait
1105 1107
1106 1108 $ hg -R share-destrace1 log -r tip
1107 1109 changeset: 2:e5bfe23c0b47
1108 1110 bookmark: bookA
1109 1111 tag: tip
1110 1112 user: test
1111 1113 date: Thu Jan 01 00:00:00 1970 +0000
1112 1114 summary: 1a
1113 1115
1114 1116
1115 1117 $ hg -R share-destrace2 log -r tip
1116 1118 changeset: 2:e5bfe23c0b47
1117 1119 bookmark: bookA
1118 1120 tag: tip
1119 1121 user: test
1120 1122 date: Thu Jan 01 00:00:00 1970 +0000
1121 1123 summary: 1a
1122 1124
1123 1125 One repo should be new, the other should be shared from the pool. We
1124 1126 don't care which is which, so we just make sure we always print the
1125 1127 one containing "new pooled" first, then one one containing "existing
1126 1128 pooled".
1127 1129
1128 1130 $ (grep 'new pooled' race1.log > /dev/null && cat race1.log || cat race2.log) | grep -v lock
1129 1131 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1130 1132 requesting all changes
1131 1133 adding changesets
1132 1134 adding manifests
1133 1135 adding file changes
1134 1136 added 3 changesets with 3 changes to 1 files
1135 1137 new changesets b5f04eac9d8f:e5bfe23c0b47
1136 1138 searching for changes
1137 1139 no changes found
1138 1140 adding remote bookmark bookA
1139 1141 updating working directory
1140 1142 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1141 1143
1142 1144 $ (grep 'existing pooled' race1.log > /dev/null && cat race1.log || cat race2.log) | grep -v lock
1143 1145 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1144 1146 searching for changes
1145 1147 no changes found
1146 1148 adding remote bookmark bookA
1147 1149 updating working directory
1148 1150 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1149 1151
1150 1152 SEC: check for unsafe ssh url
1151 1153
1152 1154 $ cat >> $HGRCPATH << EOF
1153 1155 > [ui]
1154 1156 > ssh = sh -c "read l; read l; read l"
1155 1157 > EOF
1156 1158
1157 1159 $ hg clone 'ssh://-oProxyCommand=touch${IFS}owned/path'
1158 1160 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
1159 1161 [255]
1160 1162 $ hg clone 'ssh://%2DoProxyCommand=touch${IFS}owned/path'
1161 1163 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
1162 1164 [255]
1163 1165 $ hg clone 'ssh://fakehost|touch%20owned/path'
1164 1166 abort: no suitable response from remote hg!
1165 1167 [255]
1166 1168 $ hg clone 'ssh://fakehost%7Ctouch%20owned/path'
1167 1169 abort: no suitable response from remote hg!
1168 1170 [255]
1169 1171
1170 1172 $ hg clone 'ssh://-oProxyCommand=touch owned%20foo@example.com/nonexistent/path'
1171 1173 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch owned foo@example.com/nonexistent/path'
1172 1174 [255]
1173 1175
1174 1176 #if windows
1175 1177 $ hg clone "ssh://%26touch%20owned%20/" --debug
1176 1178 running sh -c "read l; read l; read l" "&touch owned " "hg -R . serve --stdio"
1177 1179 sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !)
1178 1180 sending hello command
1179 1181 sending between command
1180 1182 abort: no suitable response from remote hg!
1181 1183 [255]
1182 1184 $ hg clone "ssh://example.com:%26touch%20owned%20/" --debug
1183 1185 running sh -c "read l; read l; read l" -p "&touch owned " example.com "hg -R . serve --stdio"
1184 1186 sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !)
1185 1187 sending hello command
1186 1188 sending between command
1187 1189 abort: no suitable response from remote hg!
1188 1190 [255]
1189 1191 #else
1190 1192 $ hg clone "ssh://%3btouch%20owned%20/" --debug
1191 1193 running sh -c "read l; read l; read l" ';touch owned ' 'hg -R . serve --stdio'
1192 1194 sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !)
1193 1195 sending hello command
1194 1196 sending between command
1195 1197 abort: no suitable response from remote hg!
1196 1198 [255]
1197 1199 $ hg clone "ssh://example.com:%3btouch%20owned%20/" --debug
1198 1200 running sh -c "read l; read l; read l" -p ';touch owned ' example.com 'hg -R . serve --stdio'
1199 1201 sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !)
1200 1202 sending hello command
1201 1203 sending between command
1202 1204 abort: no suitable response from remote hg!
1203 1205 [255]
1204 1206 #endif
1205 1207
1206 1208 $ hg clone "ssh://v-alid.example.com/" --debug
1207 1209 running sh -c "read l; read l; read l" v-alid\.example\.com ['"]hg -R \. serve --stdio['"] (re)
1208 1210 sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !)
1209 1211 sending hello command
1210 1212 sending between command
1211 1213 abort: no suitable response from remote hg!
1212 1214 [255]
1213 1215
1214 1216 We should not have created a file named owned - if it exists, the
1215 1217 attack succeeded.
1216 1218 $ if test -f owned; then echo 'you got owned'; fi
1217 1219
1218 1220 Cloning without fsmonitor enabled does not print a warning for small repos
1219 1221
1220 1222 $ hg clone a fsmonitor-default
1221 1223 updating to bookmark @ on branch stable
1222 1224 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1223 1225
1224 1226 Lower the warning threshold to simulate a large repo
1225 1227
1226 1228 $ cat >> $HGRCPATH << EOF
1227 1229 > [fsmonitor]
1228 1230 > warn_update_file_count = 2
1229 1231 > EOF
1230 1232
1231 1233 We should see a warning about no fsmonitor on supported platforms
1232 1234
1233 1235 #if linuxormacos no-fsmonitor
1234 1236 $ hg clone a nofsmonitor
1235 1237 updating to bookmark @ on branch stable
1236 1238 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor")
1237 1239 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1238 1240 #else
1239 1241 $ hg clone a nofsmonitor
1240 1242 updating to bookmark @ on branch stable
1241 1243 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1242 1244 #endif
1243 1245
1244 1246 We should not see warning about fsmonitor when it is enabled
1245 1247
1246 1248 #if fsmonitor
1247 1249 $ hg clone a fsmonitor-enabled
1248 1250 updating to bookmark @ on branch stable
1249 1251 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1250 1252 #endif
1251 1253
1252 1254 We can disable the fsmonitor warning
1253 1255
1254 1256 $ hg --config fsmonitor.warn_when_unused=false clone a fsmonitor-disable-warning
1255 1257 updating to bookmark @ on branch stable
1256 1258 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1257 1259
1258 1260 Loaded fsmonitor but disabled in config should still print warning
1259 1261
1260 1262 #if linuxormacos fsmonitor
1261 1263 $ hg --config fsmonitor.mode=off clone a fsmonitor-mode-off
1262 1264 updating to bookmark @ on branch stable
1263 1265 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor") (fsmonitor !)
1264 1266 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1265 1267 #endif
1266 1268
1267 1269 Warning not printed if working directory isn't empty
1268 1270
1269 1271 $ hg -q clone a fsmonitor-update
1270 1272 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor") (?)
1271 1273 $ cd fsmonitor-update
1272 1274 $ hg up acb14030fe0a
1273 1275 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1274 1276 (leaving bookmark @)
1275 1277 $ hg up cf0fe1914066
1276 1278 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1277 1279
1278 1280 `hg update` from null revision also prints
1279 1281
1280 1282 $ hg up null
1281 1283 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1282 1284
1283 1285 #if linuxormacos no-fsmonitor
1284 1286 $ hg up cf0fe1914066
1285 1287 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor")
1286 1288 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1287 1289 #else
1288 1290 $ hg up cf0fe1914066
1289 1291 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1290 1292 #endif
1291 1293
1292 1294 $ cd ..
1293 1295
@@ -1,708 +1,712 b''
1 1 Create test repository:
2 2
3 3 $ hg init repo
4 4 $ cd repo
5 5 $ echo x1 > x.txt
6 6
7 7 $ hg init foo
8 8 $ cd foo
9 9 $ echo y1 > y.txt
10 10
11 11 $ hg init bar
12 12 $ cd bar
13 13 $ echo z1 > z.txt
14 14
15 15 $ cd ..
16 16 $ echo 'bar = bar' > .hgsub
17 17
18 18 $ cd ..
19 19 $ echo 'foo = foo' > .hgsub
20 20
21 21 Add files --- .hgsub files must go first to trigger subrepos:
22 22
23 23 $ hg add -S .hgsub
24 24 $ hg add -S foo/.hgsub
25 25 $ hg add -S foo/bar
26 26 adding foo/bar/z.txt
27 27 $ hg add -S
28 28 adding x.txt
29 29 adding foo/y.txt
30 30
31 31 Test recursive status without committing anything:
32 32
33 33 $ hg status -S
34 34 A .hgsub
35 35 A foo/.hgsub
36 36 A foo/bar/z.txt
37 37 A foo/y.txt
38 38 A x.txt
39 39
40 40 Test recursive diff without committing anything:
41 41
42 42 $ hg diff --nodates -S foo
43 43 diff -r 000000000000 foo/.hgsub
44 44 --- /dev/null
45 45 +++ b/foo/.hgsub
46 46 @@ -0,0 +1,1 @@
47 47 +bar = bar
48 48 diff -r 000000000000 foo/y.txt
49 49 --- /dev/null
50 50 +++ b/foo/y.txt
51 51 @@ -0,0 +1,1 @@
52 52 +y1
53 53 diff -r 000000000000 foo/bar/z.txt
54 54 --- /dev/null
55 55 +++ b/foo/bar/z.txt
56 56 @@ -0,0 +1,1 @@
57 57 +z1
58 58
59 59 Commits:
60 60
61 61 $ hg commit -m fails
62 62 abort: uncommitted changes in subrepository "foo"
63 63 (use --subrepos for recursive commit)
64 64 [255]
65 65
66 66 The --subrepos flag overwrite the config setting:
67 67
68 68 $ hg commit -m 0-0-0 --config ui.commitsubrepos=No --subrepos
69 69 committing subrepository foo
70 70 committing subrepository foo/bar
71 71
72 72 $ cd foo
73 73 $ echo y2 >> y.txt
74 74 $ hg commit -m 0-1-0
75 75
76 76 $ cd bar
77 77 $ echo z2 >> z.txt
78 78 $ hg commit -m 0-1-1
79 79
80 80 $ cd ..
81 81 $ hg commit -m 0-2-1
82 82
83 83 $ cd ..
84 84 $ hg commit -m 1-2-1
85 85
86 86 Change working directory:
87 87
88 88 $ echo y3 >> foo/y.txt
89 89 $ echo z3 >> foo/bar/z.txt
90 90 $ hg status -S
91 91 M foo/bar/z.txt
92 92 M foo/y.txt
93 93 $ hg diff --nodates -S
94 94 diff -r d254738c5f5e foo/y.txt
95 95 --- a/foo/y.txt
96 96 +++ b/foo/y.txt
97 97 @@ -1,2 +1,3 @@
98 98 y1
99 99 y2
100 100 +y3
101 101 diff -r 9647f22de499 foo/bar/z.txt
102 102 --- a/foo/bar/z.txt
103 103 +++ b/foo/bar/z.txt
104 104 @@ -1,2 +1,3 @@
105 105 z1
106 106 z2
107 107 +z3
108 108
109 109 Status call crossing repository boundaries:
110 110
111 111 $ hg status -S foo/bar/z.txt
112 112 M foo/bar/z.txt
113 113 $ hg status -S -I 'foo/?.txt'
114 114 M foo/y.txt
115 115 $ hg status -S -I '**/?.txt'
116 116 M foo/bar/z.txt
117 117 M foo/y.txt
118 118 $ hg diff --nodates -S -I '**/?.txt'
119 119 diff -r d254738c5f5e foo/y.txt
120 120 --- a/foo/y.txt
121 121 +++ b/foo/y.txt
122 122 @@ -1,2 +1,3 @@
123 123 y1
124 124 y2
125 125 +y3
126 126 diff -r 9647f22de499 foo/bar/z.txt
127 127 --- a/foo/bar/z.txt
128 128 +++ b/foo/bar/z.txt
129 129 @@ -1,2 +1,3 @@
130 130 z1
131 131 z2
132 132 +z3
133 133
134 134 Status from within a subdirectory:
135 135
136 136 $ mkdir dir
137 137 $ cd dir
138 138 $ echo a1 > a.txt
139 139 $ hg status -S
140 140 M foo/bar/z.txt
141 141 M foo/y.txt
142 142 ? dir/a.txt
143 143 $ hg diff --nodates -S
144 144 diff -r d254738c5f5e foo/y.txt
145 145 --- a/foo/y.txt
146 146 +++ b/foo/y.txt
147 147 @@ -1,2 +1,3 @@
148 148 y1
149 149 y2
150 150 +y3
151 151 diff -r 9647f22de499 foo/bar/z.txt
152 152 --- a/foo/bar/z.txt
153 153 +++ b/foo/bar/z.txt
154 154 @@ -1,2 +1,3 @@
155 155 z1
156 156 z2
157 157 +z3
158 158
159 159 Status with relative path:
160 160
161 161 $ hg status -S ..
162 162 M ../foo/bar/z.txt
163 163 M ../foo/y.txt
164 164 ? a.txt
165 165
166 166 XXX: filtering lfilesrepo.status() in 3.3-rc causes these files to be listed as
167 167 added instead of modified.
168 168 $ hg status -S .. --config extensions.largefiles=
169 169 M ../foo/bar/z.txt
170 170 M ../foo/y.txt
171 171 ? a.txt
172 172
173 173 $ hg diff --nodates -S ..
174 174 diff -r d254738c5f5e foo/y.txt
175 175 --- a/foo/y.txt
176 176 +++ b/foo/y.txt
177 177 @@ -1,2 +1,3 @@
178 178 y1
179 179 y2
180 180 +y3
181 181 diff -r 9647f22de499 foo/bar/z.txt
182 182 --- a/foo/bar/z.txt
183 183 +++ b/foo/bar/z.txt
184 184 @@ -1,2 +1,3 @@
185 185 z1
186 186 z2
187 187 +z3
188 188 $ cd ..
189 189
190 190 Cleanup and final commit:
191 191
192 192 $ rm -r dir
193 193 $ hg commit --subrepos -m 2-3-2
194 194 committing subrepository foo
195 195 committing subrepository foo/bar
196 196
197 197 Test explicit path commands within subrepos: add/forget
198 198 $ echo z1 > foo/bar/z2.txt
199 199 $ hg status -S
200 200 ? foo/bar/z2.txt
201 201 $ hg add foo/bar/z2.txt
202 202 $ hg status -S
203 203 A foo/bar/z2.txt
204 204 $ hg forget foo/bar/z2.txt
205 205 $ hg status -S
206 206 ? foo/bar/z2.txt
207 207 $ hg forget foo/bar/z2.txt
208 208 not removing foo/bar/z2.txt: file is already untracked
209 209 [1]
210 210 $ hg status -S
211 211 ? foo/bar/z2.txt
212 212 $ rm foo/bar/z2.txt
213 213
214 214 Log with the relationships between repo and its subrepo:
215 215
216 216 $ hg log --template '{rev}:{node|short} {desc}\n'
217 217 2:1326fa26d0c0 2-3-2
218 218 1:4b3c9ff4f66b 1-2-1
219 219 0:23376cbba0d8 0-0-0
220 220
221 221 $ hg -R foo log --template '{rev}:{node|short} {desc}\n'
222 222 3:65903cebad86 2-3-2
223 223 2:d254738c5f5e 0-2-1
224 224 1:8629ce7dcc39 0-1-0
225 225 0:af048e97ade2 0-0-0
226 226
227 227 $ hg -R foo/bar log --template '{rev}:{node|short} {desc}\n'
228 228 2:31ecbdafd357 2-3-2
229 229 1:9647f22de499 0-1-1
230 230 0:4904098473f9 0-0-0
231 231
232 232 Status between revisions:
233 233
234 234 $ hg status -S
235 235 $ hg status -S --rev 0:1
236 236 M .hgsubstate
237 237 M foo/.hgsubstate
238 238 M foo/bar/z.txt
239 239 M foo/y.txt
240 240 $ hg diff --nodates -S -I '**/?.txt' --rev 0:1
241 241 diff -r af048e97ade2 -r d254738c5f5e foo/y.txt
242 242 --- a/foo/y.txt
243 243 +++ b/foo/y.txt
244 244 @@ -1,1 +1,2 @@
245 245 y1
246 246 +y2
247 247 diff -r 4904098473f9 -r 9647f22de499 foo/bar/z.txt
248 248 --- a/foo/bar/z.txt
249 249 +++ b/foo/bar/z.txt
250 250 @@ -1,1 +1,2 @@
251 251 z1
252 252 +z2
253 253
254 254 #if serve
255 255 $ cd ..
256 256 $ hg serve -R repo --debug -S -p $HGPORT -d --pid-file=hg1.pid -E error.log -A access.log
257 257 adding = $TESTTMP/repo
258 258 adding foo = $TESTTMP/repo/foo
259 259 adding foo/bar = $TESTTMP/repo/foo/bar
260 260 listening at http://*:$HGPORT/ (bound to *:$HGPORT) (glob) (?)
261 261 adding = $TESTTMP/repo (?)
262 262 adding foo = $TESTTMP/repo/foo (?)
263 263 adding foo/bar = $TESTTMP/repo/foo/bar (?)
264 264 $ cat hg1.pid >> $DAEMON_PIDS
265 265
266 266 $ hg clone http://localhost:$HGPORT clone --config progress.disable=True
267 267 requesting all changes
268 268 adding changesets
269 269 adding manifests
270 270 adding file changes
271 271 added 3 changesets with 5 changes to 3 files
272 272 new changesets 23376cbba0d8:1326fa26d0c0
273 273 updating to branch default
274 274 cloning subrepo foo from http://localhost:$HGPORT/foo
275 275 requesting all changes
276 276 adding changesets
277 277 adding manifests
278 278 adding file changes
279 279 added 4 changesets with 7 changes to 3 files
280 280 new changesets af048e97ade2:65903cebad86
281 281 cloning subrepo foo/bar from http://localhost:$HGPORT/foo/bar
282 282 requesting all changes
283 283 adding changesets
284 284 adding manifests
285 285 adding file changes
286 286 added 3 changesets with 3 changes to 1 files
287 287 new changesets 4904098473f9:31ecbdafd357
288 288 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
289 289
290 290 $ cat clone/foo/bar/z.txt
291 291 z1
292 292 z2
293 293 z3
294 294
295 295 Clone pooling from a remote URL will share the top level repo and the subrepos,
296 296 even if they are referenced by remote URL.
297 297
298 298 $ hg --config extensions.share= --config share.pool=$TESTTMP/pool \
299 299 > clone http://localhost:$HGPORT shared
300 300 (sharing from new pooled repository 23376cbba0d87c15906bb3652584927c140907bf)
301 301 requesting all changes
302 302 adding changesets
303 303 adding manifests
304 304 adding file changes
305 305 added 3 changesets with 5 changes to 3 files
306 306 new changesets 23376cbba0d8:1326fa26d0c0
307 307 searching for changes
308 308 no changes found
309 309 updating working directory
310 310 cloning subrepo foo from http://localhost:$HGPORT/foo
311 311 (sharing from new pooled repository af048e97ade2e236f754f05d07013e586af0f8bf)
312 312 requesting all changes
313 313 adding changesets
314 314 adding manifests
315 315 adding file changes
316 316 added 4 changesets with 7 changes to 3 files
317 317 new changesets af048e97ade2:65903cebad86
318 318 searching for changes
319 319 no changes found
320 320 cloning subrepo foo/bar from http://localhost:$HGPORT/foo/bar
321 321 (sharing from new pooled repository 4904098473f96c900fec436dad267edd4da59fad)
322 322 requesting all changes
323 323 adding changesets
324 324 adding manifests
325 325 adding file changes
326 326 added 3 changesets with 3 changes to 1 files
327 327 new changesets 4904098473f9:31ecbdafd357
328 328 searching for changes
329 329 no changes found
330 330 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
331 331
332 332 $ cat access.log
333 333 * "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
334 334 * "GET /?cmd=batch HTTP/1.1" 200 - * (glob)
335 335 * "GET /?cmd=getbundle HTTP/1.1" 200 - * (glob)
336 336 * "GET /foo?cmd=capabilities HTTP/1.1" 200 - (glob)
337 337 * "GET /foo?cmd=batch HTTP/1.1" 200 - * (glob)
338 338 * "GET /foo?cmd=getbundle HTTP/1.1" 200 - * (glob)
339 339 * "GET /foo/bar?cmd=capabilities HTTP/1.1" 200 - (glob)
340 340 * "GET /foo/bar?cmd=batch HTTP/1.1" 200 - * (glob)
341 341 * "GET /foo/bar?cmd=getbundle HTTP/1.1" 200 - * (glob)
342 342 $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
343 343 $LOCALIP - - [$LOGDATE$] "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=0 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
344 344 $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
345 345 $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
346 346 $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=1326fa26d0c00d2146c63b56bb6a45149d7325ac&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
347 347 $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D1326fa26d0c00d2146c63b56bb6a45149d7325ac x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
348 348 $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=0&common=1326fa26d0c00d2146c63b56bb6a45149d7325ac&heads=1326fa26d0c00d2146c63b56bb6a45149d7325ac&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
349 349 $LOCALIP - - [$LOGDATE$] "GET /foo?cmd=capabilities HTTP/1.1" 200 - (glob)
350 350 $LOCALIP - - [$LOGDATE$] "GET /foo?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=0 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
351 351 $LOCALIP - - [$LOGDATE$] "GET /foo?cmd=capabilities HTTP/1.1" 200 - (glob)
352 352 $LOCALIP - - [$LOGDATE$] "GET /foo?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
353 353 $LOCALIP - - [$LOGDATE$] "GET /foo?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=65903cebad86f1a84bd4f1134f62fa7dcb7a1c98&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
354 354 $LOCALIP - - [$LOGDATE$] "GET /foo?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D65903cebad86f1a84bd4f1134f62fa7dcb7a1c98 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
355 355 $LOCALIP - - [$LOGDATE$] "GET /foo?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=0&common=65903cebad86f1a84bd4f1134f62fa7dcb7a1c98&heads=65903cebad86f1a84bd4f1134f62fa7dcb7a1c98&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
356 356 $LOCALIP - - [$LOGDATE$] "GET /foo/bar?cmd=capabilities HTTP/1.1" 200 - (glob)
357 357 $LOCALIP - - [$LOGDATE$] "GET /foo/bar?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=0 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
358 358 $LOCALIP - - [$LOGDATE$] "GET /foo/bar?cmd=capabilities HTTP/1.1" 200 - (glob)
359 359 $LOCALIP - - [$LOGDATE$] "GET /foo/bar?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
360 360 $LOCALIP - - [$LOGDATE$] "GET /foo/bar?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=31ecbdafd357f54b281c9bd1d681bb90de219e22&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
361 361 $LOCALIP - - [$LOGDATE$] "GET /foo/bar?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D31ecbdafd357f54b281c9bd1d681bb90de219e22 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
362 362 $LOCALIP - - [$LOGDATE$] "GET /foo/bar?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=0&common=31ecbdafd357f54b281c9bd1d681bb90de219e22&heads=31ecbdafd357f54b281c9bd1d681bb90de219e22&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
363 363
364 364 $ killdaemons.py
365 365 $ rm hg1.pid error.log access.log
366 366 $ cd repo
367 367 #endif
368 368
369 369 Enable progress extension for archive tests:
370 370
371 371 $ cp $HGRCPATH $HGRCPATH.no-progress
372 372 $ cat >> $HGRCPATH <<EOF
373 373 > [progress]
374 374 > disable=False
375 375 > assume-tty = 1
376 376 > delay = 0
377 377 > # set changedelay really large so we don't see nested topics
378 378 > changedelay = 30000
379 379 > format = topic bar number
380 380 > refresh = 0
381 381 > width = 60
382 382 > EOF
383 383
384 384 Test archiving to a directory tree (the doubled lines in the output
385 385 only show up in the test output, not in real usage):
386 386
387 387 $ hg archive --subrepos ../archive
388 388 \r (no-eol) (esc)
389 389 archiving [ ] 0/3\r (no-eol) (esc)
390 390 archiving [=============> ] 1/3\r (no-eol) (esc)
391 391 archiving [===========================> ] 2/3\r (no-eol) (esc)
392 392 archiving [==========================================>] 3/3\r (no-eol) (esc)
393 393 \r (no-eol) (esc)
394 394 \r (no-eol) (esc)
395 395 archiving (foo) [ ] 0/3\r (no-eol) (esc)
396 396 archiving (foo) [===========> ] 1/3\r (no-eol) (esc)
397 397 archiving (foo) [=======================> ] 2/3\r (no-eol) (esc)
398 398 archiving (foo) [====================================>] 3/3\r (no-eol) (esc)
399 399 \r (no-eol) (esc)
400 400 \r (no-eol) (esc)
401 401 archiving (foo/bar) [ ] 0/1\r (no-eol) (esc)
402 402 archiving (foo/bar) [================================>] 1/1\r (no-eol) (esc)
403 403 \r (no-eol) (esc)
404 404 $ find ../archive | sort
405 405 ../archive
406 406 ../archive/.hg_archival.txt
407 407 ../archive/.hgsub
408 408 ../archive/.hgsubstate
409 409 ../archive/foo
410 410 ../archive/foo/.hgsub
411 411 ../archive/foo/.hgsubstate
412 412 ../archive/foo/bar
413 413 ../archive/foo/bar/z.txt
414 414 ../archive/foo/y.txt
415 415 ../archive/x.txt
416 416
417 417 Test archiving to zip file (unzip output is unstable):
418 418
419 419 $ hg archive --subrepos --prefix '.' ../archive.zip
420 420 \r (no-eol) (esc)
421 421 archiving [ ] 0/3\r (no-eol) (esc)
422 422 archiving [=============> ] 1/3\r (no-eol) (esc)
423 423 archiving [===========================> ] 2/3\r (no-eol) (esc)
424 424 archiving [==========================================>] 3/3\r (no-eol) (esc)
425 425 \r (no-eol) (esc)
426 426 \r (no-eol) (esc)
427 427 archiving (foo) [ ] 0/3\r (no-eol) (esc)
428 428 archiving (foo) [===========> ] 1/3\r (no-eol) (esc)
429 429 archiving (foo) [=======================> ] 2/3\r (no-eol) (esc)
430 430 archiving (foo) [====================================>] 3/3\r (no-eol) (esc)
431 431 \r (no-eol) (esc)
432 432 \r (no-eol) (esc)
433 433 archiving (foo/bar) [ ] 0/1\r (no-eol) (esc)
434 434 archiving (foo/bar) [================================>] 1/1\r (no-eol) (esc)
435 435 \r (no-eol) (esc)
436 436
437 437 (unzip date formating is unstable, we do not care about it and glob it out)
438 438
439 439 $ unzip -l ../archive.zip | grep -v -- ----- | egrep -v files$
440 440 Archive: ../archive.zip
441 441 Length [ ]* Date [ ]* Time [ ]* Name (re)
442 442 172 [0-9:\- ]* .hg_archival.txt (re)
443 443 10 [0-9:\- ]* .hgsub (re)
444 444 45 [0-9:\- ]* .hgsubstate (re)
445 445 3 [0-9:\- ]* x.txt (re)
446 446 10 [0-9:\- ]* foo/.hgsub (re)
447 447 45 [0-9:\- ]* foo/.hgsubstate (re)
448 448 9 [0-9:\- ]* foo/y.txt (re)
449 449 9 [0-9:\- ]* foo/bar/z.txt (re)
450 450
451 451 Test archiving a revision that references a subrepo that is not yet
452 452 cloned:
453 453
454 454 #if hardlink
455 455 $ hg clone -U . ../empty
456 456 \r (no-eol) (esc)
457 457 linking [ <=> ] 1\r (no-eol) (esc)
458 458 linking [ <=> ] 2\r (no-eol) (esc)
459 459 linking [ <=> ] 3\r (no-eol) (esc)
460 460 linking [ <=> ] 4\r (no-eol) (esc)
461 461 linking [ <=> ] 5\r (no-eol) (esc)
462 462 linking [ <=> ] 6\r (no-eol) (esc)
463 463 linking [ <=> ] 7\r (no-eol) (esc)
464 464 linking [ <=> ] 8\r (no-eol) (esc)
465 465 linking [ <=> ] 9\r (no-eol) (esc) (reposimplestore !)
466 466 linking [ <=> ] 10\r (no-eol) (esc) (reposimplestore !)
467 467 linking [ <=> ] 11\r (no-eol) (esc) (reposimplestore !)
468 468 linking [ <=> ] 12\r (no-eol) (esc) (reposimplestore !)
469 linking [ <=> ] 13\r (no-eol) (esc) (reposimplestore !)
469 470 \r (no-eol) (esc)
470 471 #else
471 472 $ hg clone -U . ../empty
472 473 \r (no-eol) (esc)
473 474 linking [ <=> ] 1 (no-eol)
474 475 #endif
475 476
476 477 $ cd ../empty
477 478 #if hardlink
478 479 $ hg archive --subrepos -r tip --prefix './' ../archive.tar.gz
479 480 \r (no-eol) (esc)
480 481 archiving [ ] 0/3\r (no-eol) (esc)
481 482 archiving [=============> ] 1/3\r (no-eol) (esc)
482 483 archiving [===========================> ] 2/3\r (no-eol) (esc)
483 484 archiving [==========================================>] 3/3\r (no-eol) (esc)
484 485 \r (no-eol) (esc)
485 486 \r (no-eol) (esc)
486 487 linking [ <=> ] 1\r (no-eol) (esc)
487 488 linking [ <=> ] 2\r (no-eol) (esc)
488 489 linking [ <=> ] 3\r (no-eol) (esc)
489 490 linking [ <=> ] 4\r (no-eol) (esc)
490 491 linking [ <=> ] 5\r (no-eol) (esc)
491 492 linking [ <=> ] 6\r (no-eol) (esc)
492 493 linking [ <=> ] 7\r (no-eol) (esc)
493 494 linking [ <=> ] 8\r (no-eol) (esc)
494 495 linking [ <=> ] 9\r (no-eol) (esc) (reposimplestore !)
495 496 linking [ <=> ] 10\r (no-eol) (esc) (reposimplestore !)
496 497 linking [ <=> ] 11\r (no-eol) (esc) (reposimplestore !)
497 498 linking [ <=> ] 12\r (no-eol) (esc) (reposimplestore !)
498 499 linking [ <=> ] 13\r (no-eol) (esc) (reposimplestore !)
499 500 linking [ <=> ] 14\r (no-eol) (esc) (reposimplestore !)
501 linking [ <=> ] 15\r (no-eol) (esc) (reposimplestore !)
502 linking [ <=> ] 16\r (no-eol) (esc) (reposimplestore !)
500 503 \r (no-eol) (esc)
501 504 \r (no-eol) (esc)
502 505 archiving (foo) [ ] 0/3\r (no-eol) (esc)
503 506 archiving (foo) [===========> ] 1/3\r (no-eol) (esc)
504 507 archiving (foo) [=======================> ] 2/3\r (no-eol) (esc)
505 508 archiving (foo) [====================================>] 3/3\r (no-eol) (esc)
506 509 \r (no-eol) (esc)
507 510 \r (no-eol) (esc)
508 511 linking [ <=> ] 1\r (no-eol) (esc)
509 512 linking [ <=> ] 2\r (no-eol) (esc)
510 513 linking [ <=> ] 3\r (no-eol) (esc)
511 514 linking [ <=> ] 4\r (no-eol) (esc)
512 515 linking [ <=> ] 5\r (no-eol) (esc)
513 516 linking [ <=> ] 6\r (no-eol) (esc)
514 517 linking [ <=> ] 7\r (no-eol) (esc) (reposimplestore !)
515 518 linking [ <=> ] 8\r (no-eol) (esc) (reposimplestore !)
519 linking [ <=> ] 9\r (no-eol) (esc) (reposimplestore !)
516 520 \r (no-eol) (esc)
517 521 \r (no-eol) (esc)
518 522 archiving (foo/bar) [ ] 0/1\r (no-eol) (esc)
519 523 archiving (foo/bar) [================================>] 1/1\r (no-eol) (esc)
520 524 \r (no-eol) (esc)
521 525 cloning subrepo foo from $TESTTMP/repo/foo
522 526 cloning subrepo foo/bar from $TESTTMP/repo/foo/bar
523 527 #else
524 528 Note there's a slight output glitch on non-hardlink systems: the last
525 529 "linking" progress topic never gets closed, leading to slight output corruption on that platform.
526 530 $ hg archive --subrepos -r tip --prefix './' ../archive.tar.gz
527 531 \r (no-eol) (esc)
528 532 archiving [ ] 0/3\r (no-eol) (esc)
529 533 archiving [=============> ] 1/3\r (no-eol) (esc)
530 534 archiving [===========================> ] 2/3\r (no-eol) (esc)
531 535 archiving [==========================================>] 3/3\r (no-eol) (esc)
532 536 \r (no-eol) (esc)
533 537 \r (no-eol) (esc)
534 538 linking [ <=> ] 1\r (no-eol) (esc)
535 539 cloning subrepo foo/bar from $TESTTMP/repo/foo/bar
536 540 #endif
537 541
538 542 Archive + subrepos uses '/' for all component separators
539 543
540 544 $ tar -tzf ../archive.tar.gz | sort
541 545 .hg_archival.txt
542 546 .hgsub
543 547 .hgsubstate
544 548 foo/.hgsub
545 549 foo/.hgsubstate
546 550 foo/bar/z.txt
547 551 foo/y.txt
548 552 x.txt
549 553
550 554 The newly cloned subrepos contain no working copy:
551 555
552 556 $ hg -R foo summary
553 557 parent: -1:000000000000 (no revision checked out)
554 558 branch: default
555 559 commit: (clean)
556 560 update: 4 new changesets (update)
557 561
558 562 Sharing a local repo without the locally referenced subrepo (i.e. it was never
559 563 updated from null), fails the same as a clone operation.
560 564
561 565 $ hg --config progress.disable=True clone -U ../empty ../empty2
562 566
563 567 $ hg --config extensions.share= --config progress.disable=True \
564 568 > share ../empty2 ../empty_share
565 569 updating working directory
566 570 abort: repository $TESTTMP/empty2/foo not found!
567 571 [255]
568 572
569 573 $ hg --config progress.disable=True clone ../empty2 ../empty_clone
570 574 updating to branch default
571 575 abort: repository $TESTTMP/empty2/foo not found!
572 576 [255]
573 577
574 578 Disable progress extension and cleanup:
575 579
576 580 $ mv $HGRCPATH.no-progress $HGRCPATH
577 581
578 582 Test archiving when there is a directory in the way for a subrepo
579 583 created by archive:
580 584
581 585 $ hg clone -U . ../almost-empty
582 586 $ cd ../almost-empty
583 587 $ mkdir foo
584 588 $ echo f > foo/f
585 589 $ hg archive --subrepos -r tip archive
586 590 cloning subrepo foo from $TESTTMP/empty/foo
587 591 abort: destination '$TESTTMP/almost-empty/foo' is not empty (in subrepository "foo")
588 592 [255]
589 593
590 594 Clone and test outgoing:
591 595
592 596 $ cd ..
593 597 $ hg clone repo repo2
594 598 updating to branch default
595 599 cloning subrepo foo from $TESTTMP/repo/foo
596 600 cloning subrepo foo/bar from $TESTTMP/repo/foo/bar
597 601 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
598 602 $ cd repo2
599 603 $ hg outgoing -S
600 604 comparing with $TESTTMP/repo
601 605 searching for changes
602 606 no changes found
603 607 comparing with $TESTTMP/repo/foo
604 608 searching for changes
605 609 no changes found
606 610 comparing with $TESTTMP/repo/foo/bar
607 611 searching for changes
608 612 no changes found
609 613 [1]
610 614
611 615 Make nested change:
612 616
613 617 $ echo y4 >> foo/y.txt
614 618 $ hg diff --nodates -S
615 619 diff -r 65903cebad86 foo/y.txt
616 620 --- a/foo/y.txt
617 621 +++ b/foo/y.txt
618 622 @@ -1,3 +1,4 @@
619 623 y1
620 624 y2
621 625 y3
622 626 +y4
623 627 $ hg commit --subrepos -m 3-4-2
624 628 committing subrepository foo
625 629 $ hg outgoing -S
626 630 comparing with $TESTTMP/repo
627 631 searching for changes
628 632 changeset: 3:2655b8ecc4ee
629 633 tag: tip
630 634 user: test
631 635 date: Thu Jan 01 00:00:00 1970 +0000
632 636 summary: 3-4-2
633 637
634 638 comparing with $TESTTMP/repo/foo
635 639 searching for changes
636 640 changeset: 4:e96193d6cb36
637 641 tag: tip
638 642 user: test
639 643 date: Thu Jan 01 00:00:00 1970 +0000
640 644 summary: 3-4-2
641 645
642 646 comparing with $TESTTMP/repo/foo/bar
643 647 searching for changes
644 648 no changes found
645 649
646 650
647 651 Switch to original repo and setup default path:
648 652
649 653 $ cd ../repo
650 654 $ echo '[paths]' >> .hg/hgrc
651 655 $ echo 'default = ../repo2' >> .hg/hgrc
652 656
653 657 Test incoming:
654 658
655 659 $ hg incoming -S
656 660 comparing with $TESTTMP/repo2
657 661 searching for changes
658 662 changeset: 3:2655b8ecc4ee
659 663 tag: tip
660 664 user: test
661 665 date: Thu Jan 01 00:00:00 1970 +0000
662 666 summary: 3-4-2
663 667
664 668 comparing with $TESTTMP/repo2/foo
665 669 searching for changes
666 670 changeset: 4:e96193d6cb36
667 671 tag: tip
668 672 user: test
669 673 date: Thu Jan 01 00:00:00 1970 +0000
670 674 summary: 3-4-2
671 675
672 676 comparing with $TESTTMP/repo2/foo/bar
673 677 searching for changes
674 678 no changes found
675 679
676 680 $ hg incoming -S --bundle incoming.hg
677 681 abort: cannot combine --bundle and --subrepos
678 682 [255]
679 683
680 684 Test missing subrepo:
681 685
682 686 $ rm -r foo
683 687 $ hg status -S
684 688 warning: error "unknown revision '65903cebad86f1a84bd4f1134f62fa7dcb7a1c98'" in subrepository "foo"
685 689
686 690 Issue2619: IndexError: list index out of range on hg add with subrepos
687 691 The subrepo must sorts after the explicit filename.
688 692
689 693 $ cd ..
690 694 $ hg init test
691 695 $ cd test
692 696 $ hg init x
693 697 $ echo abc > abc.txt
694 698 $ hg ci -Am "abc"
695 699 adding abc.txt
696 700 $ echo "x = x" >> .hgsub
697 701 $ hg add .hgsub
698 702 $ touch a x/a
699 703 $ hg add a x/a
700 704
701 705 $ hg ci -Sm "added x"
702 706 committing subrepository x
703 707 $ echo abc > x/a
704 708 $ hg revert --rev '.^' "set:subrepo('glob:x*')"
705 709 abort: subrepository 'x' does not exist in 25ac2c9b3180!
706 710 [255]
707 711
708 712 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now