Show More
@@ -1011,7 +1011,8 b' def bundle(ui, repo, fname, dest=None, *' | |||
|
1011 | 1011 | heads = revs and map(repo.lookup, revs) or revs |
|
1012 | 1012 | outgoing = discovery.findcommonoutgoing(repo, other, |
|
1013 | 1013 | onlyheads=heads, |
|
1014 |
force=opts.get('force') |
|
|
1014 | force=opts.get('force'), | |
|
1015 | portable=True) | |
|
1015 | 1016 | cg = repo.getlocalbundle('bundle', outgoing) |
|
1016 | 1017 | if not cg: |
|
1017 | 1018 | scmutil.nochangesfound(ui, outgoing and outgoing.excluded) |
@@ -86,7 +86,8 b' class outgoing(object):' | |||
|
86 | 86 | self._computecommonmissing() |
|
87 | 87 | return self._missing |
|
88 | 88 | |
|
89 |
def findcommonoutgoing(repo, other, onlyheads=None, force=False, commoninc=None |
|
|
89 | def findcommonoutgoing(repo, other, onlyheads=None, force=False, commoninc=None, | |
|
90 | portable=False): | |
|
90 | 91 | '''Return an outgoing instance to identify the nodes present in repo but |
|
91 | 92 | not in other. |
|
92 | 93 | |
@@ -95,7 +96,10 b' def findcommonoutgoing(repo, other, only' | |||
|
95 | 96 | onlyheads is faster than letting them be recomputed here. |
|
96 | 97 | |
|
97 | 98 | If commoninc is given, it must the the result of a prior call to |
|
98 |
findcommonincoming(repo, other, force) to avoid recomputing it here. |
|
|
99 | findcommonincoming(repo, other, force) to avoid recomputing it here. | |
|
100 | ||
|
101 | If portable is given, compute more conservative common and missingheads, | |
|
102 | to make bundles created from the instance more portable.''' | |
|
99 | 103 | # declare an empty outgoing object to be filled later |
|
100 | 104 | og = outgoing(repo.changelog, None, None) |
|
101 | 105 | |
@@ -129,6 +133,17 b' def findcommonoutgoing(repo, other, only' | |||
|
129 | 133 | missingheads = onlyheads |
|
130 | 134 | og.missingheads = missingheads |
|
131 | 135 | |
|
136 | if portable: | |
|
137 | # recompute common and missingheads as if -r<rev> had been given for | |
|
138 | # each head of missing, and --base <rev> for each head of the proper | |
|
139 | # ancestors of missing | |
|
140 | og._computecommonmissing() | |
|
141 | cl = repo.changelog | |
|
142 | missingrevs = set(cl.rev(n) for n in og._missing) | |
|
143 | og._common = set(cl.ancestors(*missingrevs)) - missingrevs | |
|
144 | commonheads = set(og.commonheads) | |
|
145 | og.missingheads = [h for h in og.missingheads if h not in commonheads] | |
|
146 | ||
|
132 | 147 | return og |
|
133 | 148 | |
|
134 | 149 | def checkheads(repo, remote, outgoing, remoteheads, newbranch=False, inc=False): |
@@ -539,32 +539,36 b' bundle single branch' | |||
|
539 | 539 | $ hg init branchy |
|
540 | 540 | $ cd branchy |
|
541 | 541 | $ echo a >a |
|
542 | $ echo x >x | |
|
542 | 543 | $ hg ci -Ama |
|
543 | 544 | adding a |
|
545 | adding x | |
|
546 | $ echo c >c | |
|
547 | $ echo xx >x | |
|
548 | $ hg ci -Amc | |
|
549 | adding c | |
|
550 | $ echo c1 >c1 | |
|
551 | $ hg ci -Amc1 | |
|
552 | adding c1 | |
|
553 | $ hg up 0 | |
|
554 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
|
544 | 555 | $ echo b >b |
|
545 | 556 | $ hg ci -Amb |
|
546 | 557 | adding b |
|
558 | created new head | |
|
547 | 559 | $ echo b1 >b1 |
|
560 | $ echo xx >x | |
|
548 | 561 | $ hg ci -Amb1 |
|
549 | 562 | adding b1 |
|
550 | $ hg up 0 | |
|
551 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
|
552 | $ echo c >c | |
|
553 | $ hg ci -Amc | |
|
554 | adding c | |
|
555 | created new head | |
|
556 | $ echo c1 >c1 | |
|
557 | $ hg ci -Amc1 | |
|
558 | adding c1 | |
|
559 | $ hg clone -q .#tip part | |
|
563 | $ hg clone -q -r2 . part | |
|
560 | 564 | |
|
561 | 565 | == bundling via incoming |
|
562 | 566 | |
|
563 | 567 | $ hg in -R part --bundle incoming.hg --template "{node}\n" . |
|
564 | 568 | comparing with . |
|
565 | 569 | searching for changes |
|
566 | d2ae7f538514cd87c17547b0de4cea71fe1af9fb | |
|
567 | 5ece8e77363e2b5269e27c66828b72da29e4341a | |
|
570 | 1a38c1b849e8b70c756d2d80b0b9a3ac0b7ea11a | |
|
571 | 057f4db07f61970e1c11e83be79e9d08adc4dc31 | |
|
568 | 572 | |
|
569 | 573 | == bundling |
|
570 | 574 | |
@@ -574,12 +578,23 b' bundle single branch' | |||
|
574 | 578 | all remote heads known locally |
|
575 | 579 | 2 changesets found |
|
576 | 580 | list of changesets: |
|
577 | d2ae7f538514cd87c17547b0de4cea71fe1af9fb | |
|
578 | 5ece8e77363e2b5269e27c66828b72da29e4341a | |
|
581 | 1a38c1b849e8b70c756d2d80b0b9a3ac0b7ea11a | |
|
582 | 057f4db07f61970e1c11e83be79e9d08adc4dc31 | |
|
579 | 583 | bundling: 1/2 changesets (50.00%) |
|
580 | 584 | bundling: 2/2 changesets (100.00%) |
|
581 | 585 | bundling: 1/2 manifests (50.00%) |
|
582 | 586 | bundling: 2/2 manifests (100.00%) |
|
583 |
bundling: b 1/ |
|
|
584 |
bundling: b1 2/ |
|
|
587 | bundling: b 1/3 files (33.33%) | |
|
588 | bundling: b1 2/3 files (66.67%) | |
|
589 | bundling: x 3/3 files (100.00%) | |
|
590 | ||
|
591 | == Test for issue3441 | |
|
585 | 592 | |
|
593 | $ hg clone -q -r0 . part2 | |
|
594 | $ hg -q -R part2 pull bundle.hg | |
|
595 | $ hg -R part2 verify | |
|
596 | checking changesets | |
|
597 | checking manifests | |
|
598 | crosschecking files in changesets and manifests | |
|
599 | checking files | |
|
600 | 4 files, 3 changesets, 5 total revisions |
@@ -420,9 +420,6 b'' | |||
|
420 | 420 | mercurial/discovery.py:0: |
|
421 | 421 | > If onlyheads is given, only nodes ancestral to nodes in onlyheads (inclusive) |
|
422 | 422 | warning: line over 80 characters |
|
423 | mercurial/discovery.py:0: | |
|
424 | > def findcommonoutgoing(repo, other, onlyheads=None, force=False, commoninc=None): | |
|
425 | warning: line over 80 characters | |
|
426 | 423 | mercurial/dispatch.py:0: |
|
427 | 424 | > " (.hg not found)") % os.getcwd()) |
|
428 | 425 | warning: line over 80 characters |
General Comments 0
You need to be logged in to leave comments.
Login now