1563 Applying bundles preserves all changeset contents including |
1563 Applying bundles preserves all changeset contents including |
1564 permissions, copy/rename information, and revision history. |
1564 permissions, copy/rename information, and revision history. |
1565 |
1565 |
1566 Returns 0 on success, 1 if no changes found. |
1566 Returns 0 on success, 1 if no changes found. |
1567 """ |
1567 """ |
1568 opts = pycompat.byteskwargs(opts) |
|
1569 |
1568 |
1570 revs = None |
1569 revs = None |
1571 if b'rev' in opts: |
1570 if 'rev' in opts: |
1572 revstrings = opts[b'rev'] |
1571 revstrings = opts['rev'] |
1573 revs = logcmdutil.revrange(repo, revstrings) |
1572 revs = logcmdutil.revrange(repo, revstrings) |
1574 if revstrings and not revs: |
1573 if revstrings and not revs: |
1575 raise error.InputError(_(b'no commits to bundle')) |
1574 raise error.InputError(_(b'no commits to bundle')) |
1576 |
1575 |
1577 bundletype = opts.get(b'type', b'bzip2').lower() |
1576 bundletype = opts.get('type', b'bzip2').lower() |
1578 try: |
1577 try: |
1579 bundlespec = bundlecaches.parsebundlespec( |
1578 bundlespec = bundlecaches.parsebundlespec( |
1580 repo, bundletype, strict=False |
1579 repo, bundletype, strict=False |
1581 ) |
1580 ) |
1582 except error.UnsupportedBundleSpecification as e: |
1581 except error.UnsupportedBundleSpecification as e: |
1591 raise error.InputError( |
1590 raise error.InputError( |
1592 _(b'packed bundles cannot be produced by "hg bundle"'), |
1591 _(b'packed bundles cannot be produced by "hg bundle"'), |
1593 hint=_(b"use 'hg debugcreatestreamclonebundle'"), |
1592 hint=_(b"use 'hg debugcreatestreamclonebundle'"), |
1594 ) |
1593 ) |
1595 |
1594 |
1596 if opts.get(b'all'): |
1595 if opts.get('all'): |
1597 if dests: |
1596 if dests: |
1598 raise error.InputError( |
1597 raise error.InputError( |
1599 _(b"--all is incompatible with specifying destinations") |
1598 _(b"--all is incompatible with specifying destinations") |
1600 ) |
1599 ) |
1601 if opts.get(b'base'): |
1600 if opts.get('base'): |
1602 ui.warn(_(b"ignoring --base because --all was specified\n")) |
1601 ui.warn(_(b"ignoring --base because --all was specified\n")) |
1603 if opts.get(b'exact'): |
1602 if opts.get('exact'): |
1604 ui.warn(_(b"ignoring --exact because --all was specified\n")) |
1603 ui.warn(_(b"ignoring --exact because --all was specified\n")) |
1605 base = [nullrev] |
1604 base = [nullrev] |
1606 elif opts.get(b'exact'): |
1605 elif opts.get('exact'): |
1607 if dests: |
1606 if dests: |
1608 raise error.InputError( |
1607 raise error.InputError( |
1609 _(b"--exact is incompatible with specifying destinations") |
1608 _(b"--exact is incompatible with specifying destinations") |
1610 ) |
1609 ) |
1611 if opts.get(b'base'): |
1610 if opts.get('base'): |
1612 ui.warn(_(b"ignoring --base because --exact was specified\n")) |
1611 ui.warn(_(b"ignoring --base because --exact was specified\n")) |
1613 base = repo.revs(b'parents(%ld) - %ld', revs, revs) |
1612 base = repo.revs(b'parents(%ld) - %ld', revs, revs) |
1614 if not base: |
1613 if not base: |
1615 base = [nullrev] |
1614 base = [nullrev] |
1616 else: |
1615 else: |
1617 base = logcmdutil.revrange(repo, opts.get(b'base')) |
1616 base = logcmdutil.revrange(repo, opts.get('base')) |
1618 if cgversion not in changegroup.supportedoutgoingversions(repo): |
1617 if cgversion not in changegroup.supportedoutgoingversions(repo): |
1619 raise error.Abort( |
1618 raise error.Abort( |
1620 _(b"repository does not support bundle version %s") % cgversion |
1619 _(b"repository does not support bundle version %s") % cgversion |
1621 ) |
1620 ) |
1622 |
1621 |
1633 excluded = outgoing.excluded |
1632 excluded = outgoing.excluded |
1634 else: |
1633 else: |
1635 missing = set() |
1634 missing = set() |
1636 excluded = set() |
1635 excluded = set() |
1637 for path in urlutil.get_push_paths(repo, ui, dests): |
1636 for path in urlutil.get_push_paths(repo, ui, dests): |
1638 other = hg.peer(repo, opts, path) |
1637 other = hg.peer(repo, pycompat.byteskwargs(opts), path) |
1639 if revs is not None: |
1638 if revs is not None: |
1640 hex_revs = [repo[r].hex() for r in revs] |
1639 hex_revs = [repo[r].hex() for r in revs] |
1641 else: |
1640 else: |
1642 hex_revs = None |
1641 hex_revs = None |
1643 branches = (path.branch, []) |
1642 branches = (path.branch, []) |