##// END OF EJS Templates
bundle: make bundles more portable (isue3441)...
Sune Foldager -
r16736:025b3b76 stable
parent child Browse files
Show More
@@ -1011,7 +1011,8 b' def bundle(ui, repo, fname, dest=None, *'
1011 heads = revs and map(repo.lookup, revs) or revs
1011 heads = revs and map(repo.lookup, revs) or revs
1012 outgoing = discovery.findcommonoutgoing(repo, other,
1012 outgoing = discovery.findcommonoutgoing(repo, other,
1013 onlyheads=heads,
1013 onlyheads=heads,
1014 force=opts.get('force'))
1014 force=opts.get('force'),
1015 portable=True)
1015 cg = repo.getlocalbundle('bundle', outgoing)
1016 cg = repo.getlocalbundle('bundle', outgoing)
1016 if not cg:
1017 if not cg:
1017 scmutil.nochangesfound(ui, outgoing and outgoing.excluded)
1018 scmutil.nochangesfound(ui, outgoing and outgoing.excluded)
@@ -86,7 +86,8 b' class outgoing(object):'
86 self._computecommonmissing()
86 self._computecommonmissing()
87 return self._missing
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 '''Return an outgoing instance to identify the nodes present in repo but
91 '''Return an outgoing instance to identify the nodes present in repo but
91 not in other.
92 not in other.
92
93
@@ -95,7 +96,10 b' def findcommonoutgoing(repo, other, only'
95 onlyheads is faster than letting them be recomputed here.
96 onlyheads is faster than letting them be recomputed here.
96
97
97 If commoninc is given, it must the the result of a prior call to
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 # declare an empty outgoing object to be filled later
103 # declare an empty outgoing object to be filled later
100 og = outgoing(repo.changelog, None, None)
104 og = outgoing(repo.changelog, None, None)
101
105
@@ -129,6 +133,17 b' def findcommonoutgoing(repo, other, only'
129 missingheads = onlyheads
133 missingheads = onlyheads
130 og.missingheads = missingheads
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 return og
147 return og
133
148
134 def checkheads(repo, remote, outgoing, remoteheads, newbranch=False, inc=False):
149 def checkheads(repo, remote, outgoing, remoteheads, newbranch=False, inc=False):
@@ -539,32 +539,36 b' bundle single branch'
539 $ hg init branchy
539 $ hg init branchy
540 $ cd branchy
540 $ cd branchy
541 $ echo a >a
541 $ echo a >a
542 $ echo x >x
542 $ hg ci -Ama
543 $ hg ci -Ama
543 adding a
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 $ echo b >b
555 $ echo b >b
545 $ hg ci -Amb
556 $ hg ci -Amb
546 adding b
557 adding b
558 created new head
547 $ echo b1 >b1
559 $ echo b1 >b1
560 $ echo xx >x
548 $ hg ci -Amb1
561 $ hg ci -Amb1
549 adding b1
562 adding b1
550 $ hg up 0
563 $ hg clone -q -r2 . part
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
560
564
561 == bundling via incoming
565 == bundling via incoming
562
566
563 $ hg in -R part --bundle incoming.hg --template "{node}\n" .
567 $ hg in -R part --bundle incoming.hg --template "{node}\n" .
564 comparing with .
568 comparing with .
565 searching for changes
569 searching for changes
566 d2ae7f538514cd87c17547b0de4cea71fe1af9fb
570 1a38c1b849e8b70c756d2d80b0b9a3ac0b7ea11a
567 5ece8e77363e2b5269e27c66828b72da29e4341a
571 057f4db07f61970e1c11e83be79e9d08adc4dc31
568
572
569 == bundling
573 == bundling
570
574
@@ -574,12 +578,23 b' bundle single branch'
574 all remote heads known locally
578 all remote heads known locally
575 2 changesets found
579 2 changesets found
576 list of changesets:
580 list of changesets:
577 d2ae7f538514cd87c17547b0de4cea71fe1af9fb
581 1a38c1b849e8b70c756d2d80b0b9a3ac0b7ea11a
578 5ece8e77363e2b5269e27c66828b72da29e4341a
582 057f4db07f61970e1c11e83be79e9d08adc4dc31
579 bundling: 1/2 changesets (50.00%)
583 bundling: 1/2 changesets (50.00%)
580 bundling: 2/2 changesets (100.00%)
584 bundling: 2/2 changesets (100.00%)
581 bundling: 1/2 manifests (50.00%)
585 bundling: 1/2 manifests (50.00%)
582 bundling: 2/2 manifests (100.00%)
586 bundling: 2/2 manifests (100.00%)
583 bundling: b 1/2 files (50.00%)
587 bundling: b 1/3 files (33.33%)
584 bundling: b1 2/2 files (100.00%)
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 mercurial/discovery.py:0:
420 mercurial/discovery.py:0:
421 > If onlyheads is given, only nodes ancestral to nodes in onlyheads (inclusive)
421 > If onlyheads is given, only nodes ancestral to nodes in onlyheads (inclusive)
422 warning: line over 80 characters
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 mercurial/dispatch.py:0:
423 mercurial/dispatch.py:0:
427 > " (.hg not found)") % os.getcwd())
424 > " (.hg not found)") % os.getcwd())
428 warning: line over 80 characters
425 warning: line over 80 characters
General Comments 0
You need to be logged in to leave comments. Login now