##// END OF EJS Templates
bundle: support multiple destinations...
marmoute -
r47710:946db896 default
parent child Browse files
Show More
@@ -382,7 +382,10 b' def _getbundle(repo, dest, **opts):'
382 382 if btype:
383 383 opts['type'] = btype
384 384 try:
385 commands.bundle(ui, repo, tmpfn, dest, **opts)
385 dests = []
386 if dest:
387 dests = [dest]
388 commands.bundle(ui, repo, tmpfn, *dests, **opts)
386 389 return util.readfile(tmpfn)
387 390 finally:
388 391 try:
@@ -1531,10 +1531,10 b' def branches(ui, repo, active=False, clo'
1531 1531 ),
1532 1532 ]
1533 1533 + remoteopts,
1534 _(b'[-f] [-t BUNDLESPEC] [-a] [-r REV]... [--base REV]... FILE [DEST]'),
1534 _(b'[-f] [-t BUNDLESPEC] [-a] [-r REV]... [--base REV]... FILE [DEST]...'),
1535 1535 helpcategory=command.CATEGORY_IMPORT_EXPORT,
1536 1536 )
1537 def bundle(ui, repo, fname, dest=None, **opts):
1537 def bundle(ui, repo, fname, *dests, **opts):
1538 1538 """create a bundle file
1539 1539
1540 1540 Generate a bundle file containing data to be transferred to another
@@ -1545,7 +1545,7 b' def bundle(ui, repo, fname, dest=None, *'
1545 1545 all the nodes you specify with --base parameters. Otherwise, hg
1546 1546 will assume the repository has all the nodes in destination, or
1547 1547 default-push/default if no destination is specified, where destination
1548 is the repository you provide through DEST option.
1548 is the repositories you provide through DEST option.
1549 1549
1550 1550 You can change bundle format with the -t/--type option. See
1551 1551 :hg:`help bundlespec` for documentation on this format. By default,
@@ -1590,9 +1590,9 b' def bundle(ui, repo, fname, dest=None, *'
1590 1590 )
1591 1591
1592 1592 if opts.get(b'all'):
1593 if dest:
1593 if dests:
1594 1594 raise error.InputError(
1595 _(b"--all is incompatible with specifying a destination")
1595 _(b"--all is incompatible with specifying destinations")
1596 1596 )
1597 1597 if opts.get(b'base'):
1598 1598 ui.warn(_(b"ignoring --base because --all was specified\n"))
@@ -1605,31 +1605,54 b' def bundle(ui, repo, fname, dest=None, *'
1605 1605 )
1606 1606
1607 1607 if base:
1608 if dest:
1608 if dests:
1609 1609 raise error.InputError(
1610 _(b"--base is incompatible with specifying a destination")
1610 _(b"--base is incompatible with specifying destinations")
1611 1611 )
1612 1612 common = [repo[rev].node() for rev in base]
1613 1613 heads = [repo[r].node() for r in revs] if revs else None
1614 1614 outgoing = discovery.outgoing(repo, common, heads)
1615 missing = outgoing.missing
1616 excluded = outgoing.excluded
1615 1617 else:
1616 dest = ui.expandpath(dest or b'default-push', dest or b'default')
1617 dest, branches = urlutil.parseurl(dest, opts.get(b'branch'))
1618 other = hg.peer(repo, opts, dest)
1619 revs = [repo[r].hex() for r in revs]
1620 revs, checkout = hg.addbranchrevs(repo, repo, branches, revs)
1621 heads = revs and pycompat.maplist(repo.lookup, revs) or revs
1622 outgoing = discovery.findcommonoutgoing(
1623 repo,
1624 other,
1625 onlyheads=heads,
1626 force=opts.get(b'force'),
1627 portable=True,
1618 missing = set()
1619 excluded = set()
1620 for path in urlutil.get_push_paths(repo, ui, dests):
1621 other = hg.peer(repo, opts, path.rawloc)
1622 if revs is not None:
1623 hex_revs = [repo[r].hex() for r in revs]
1624 else:
1625 hex_revs = None
1626 branches = (path.branch, [])
1627 head_revs, checkout = hg.addbranchrevs(
1628 repo, repo, branches, hex_revs
1629 )
1630 heads = (
1631 head_revs
1632 and pycompat.maplist(repo.lookup, head_revs)
1633 or head_revs
1634 )
1635 outgoing = discovery.findcommonoutgoing(
1636 repo,
1637 other,
1638 onlyheads=heads,
1639 force=opts.get(b'force'),
1640 portable=True,
1641 )
1642 missing.update(outgoing.missing)
1643 excluded.update(outgoing.excluded)
1644
1645 if not missing:
1646 scmutil.nochangesfound(ui, repo, not base and excluded)
1647 return 1
1648
1649 if heads:
1650 outgoing = discovery.outgoing(
1651 repo, missingroots=missing, ancestorsof=heads
1628 1652 )
1629
1630 if not outgoing.missing:
1631 scmutil.nochangesfound(ui, repo, not base and outgoing.excluded)
1632 return 1
1653 else:
1654 outgoing = discovery.outgoing(repo, missingroots=missing)
1655 outgoing.excluded = sorted(excluded)
1633 1656
1634 1657 if cgversion == b'01': # bundle1
1635 1658 bversion = b'HG10' + bundlespec.wirecompression
@@ -171,14 +171,15 b''
171 171 should fail
172 172
173 173 $ hg -R test bundle --base 2 -r tip test-bundle-branch1.hg test-3
174 abort: --base is incompatible with specifying a destination
174 abort: --base is incompatible with specifying destinations
175 175 [10]
176 176 $ hg -R test bundle -a -r tip test-bundle-branch1.hg test-3
177 abort: --all is incompatible with specifying a destination
177 abort: --all is incompatible with specifying destinations
178 178 [10]
179 179 $ hg -R test bundle -r tip test-bundle-branch1.hg
180 abort: repository default-push not found
181 [255]
180 config error: default repository not configured!
181 (see 'hg help config.paths')
182 [30]
182 183
183 184 $ hg -R test bundle --base 2 -r tip test-bundle-branch1.hg
184 185 2 changesets found
@@ -170,6 +170,11 b' push'
170 170 date: Thu Jan 01 00:00:00 1970 +0000
171 171 summary: C
172 172
173 $ hg bundle -R test-repo-bare bundle.hg ./branch-E-push ./branch-G-push ./branch-H-push
174 searching for changes
175 searching for changes
176 searching for changes
177 6 changesets found
173 178 $ hg push --force -R test-repo-bare ./branch-E-push ./branch-G-push ./branch-H-push
174 179 pushing to ./branch-E-push
175 180 searching for changes
@@ -351,6 +356,11 b' We only push a specific branch with --re'
351 356 date: Thu Jan 01 00:00:00 1970 +0000
352 357 summary: C
353 358
359 $ hg bundle -R test-repo-bare bundle.hg ./branch-E-push ./branch-G-push ./branch-H-push --rev default
360 searching for changes
361 searching for changes
362 searching for changes
363 2 changesets found
354 364 $ hg push --force -R test-repo-bare ./branch-E-push ./branch-G-push ./branch-H-push --rev default
355 365 pushing to ./branch-E-push
356 366 searching for changes
@@ -429,6 +439,11 b' Same push, but the first one is a no-op'
429 439 date: Thu Jan 01 00:00:00 1970 +0000
430 440 summary: C
431 441
442 $ hg bundle -R test-repo-bare bundle.hg ./branch-G-push ./branch-H-push ./branch-E-push --rev default
443 searching for changes
444 searching for changes
445 searching for changes
446 2 changesets found
432 447 $ hg push --force -R test-repo-bare ./branch-G-push ./branch-H-push ./branch-E-push --rev default
433 448 pushing to ./branch-G-push
434 449 searching for changes
General Comments 0
You need to be logged in to leave comments. Login now