comparison mercurial/commands.py @ 45784:74271829ddc0

clonebundles: move a bundle of clone bundle related code to a new module In the process on general clone bundle automatically, we need to make some function available more widely. This is a good opportunity to extract a significant amount of code from `mercurial.exchange` into a new `mercurial.bundlecaches`. This make `mercurial.exchange` move under the 3K line range (hooray…). The module is called `bundlecaches` because I expect it to be eventually useful for more than just clone bundle (like pull bunbles). Differential Revision: https://phab.mercurial-scm.org/D9208
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 15 Oct 2020 15:57:36 +0200
parents 88a47cbf063c
children 4db5671d57d9
comparison
equal deleted inserted replaced
45783:88a47cbf063c 45784:74271829ddc0
24 from .pycompat import open 24 from .pycompat import open
25 from . import ( 25 from . import (
26 archival, 26 archival,
27 bookmarks, 27 bookmarks,
28 bundle2, 28 bundle2,
29 bundlecaches,
29 changegroup, 30 changegroup,
30 cmdutil, 31 cmdutil,
31 copies, 32 copies,
32 debugcommands as debugcommandsmod, 33 debugcommands as debugcommandsmod,
33 destutil, 34 destutil,
1542 if revstrings and not revs: 1543 if revstrings and not revs:
1543 raise error.Abort(_(b'no commits to bundle')) 1544 raise error.Abort(_(b'no commits to bundle'))
1544 1545
1545 bundletype = opts.get(b'type', b'bzip2').lower() 1546 bundletype = opts.get(b'type', b'bzip2').lower()
1546 try: 1547 try:
1547 bundlespec = exchange.parsebundlespec(repo, bundletype, strict=False) 1548 bundlespec = bundlecaches.parsebundlespec(
1549 repo, bundletype, strict=False
1550 )
1548 except error.UnsupportedBundleSpecification as e: 1551 except error.UnsupportedBundleSpecification as e:
1549 raise error.Abort( 1552 raise error.Abort(
1550 pycompat.bytestr(e), 1553 pycompat.bytestr(e),
1551 hint=_(b"see 'hg help bundlespec' for supported values for --type"), 1554 hint=_(b"see 'hg help bundlespec' for supported values for --type"),
1552 ) 1555 )