# HG changeset patch # User Pierre-Yves David # Date 1657582458 -7200 # Node ID 2bbd7bc7d6c4d54476619a48073a8c10569d80bc # Parent 23dd636852b8d23e4afcfa2aec5dcf923312d711 bundle: introduce a --exact option I have been wanting this options for a long time. diff -r 23dd636852b8 -r 2bbd7bc7d6c4 mercurial/commands.py --- a/mercurial/commands.py Mon Jul 11 23:59:34 2022 +0200 +++ b/mercurial/commands.py Tue Jul 12 01:34:18 2022 +0200 @@ -1484,6 +1484,13 @@ @command( b'bundle', [ + + ( + b'', + b'exact', + None, + _(b'compute the base from the revision specified'), + ), ( b'f', b'force', @@ -1553,6 +1560,7 @@ Returns 0 on success, 1 if no changes found. """ opts = pycompat.byteskwargs(opts) + revs = None if b'rev' in opts: revstrings = opts[b'rev'] @@ -1586,7 +1594,19 @@ ) if opts.get(b'base'): ui.warn(_(b"ignoring --base because --all was specified\n")) + if opts.get(b'exact'): + ui.warn(_(b"ignoring --exact because --all was specified\n")) base = [nullrev] + elif opts.get(b'exact'): + if dests: + raise error.InputError( + _(b"--exact is incompatible with specifying destinations") + ) + if opts.get(b'base'): + ui.warn(_(b"ignoring --base because --exact was specified\n")) + base = repo.revs(b'parents(%ld) - %ld', revs, revs) + if not base: + base = [nullrev] else: base = logcmdutil.revrange(repo, opts.get(b'base')) if cgversion not in changegroup.supportedoutgoingversions(repo): diff -r 23dd636852b8 -r 2bbd7bc7d6c4 tests/test-bundle.t --- a/tests/test-bundle.t Mon Jul 11 23:59:34 2022 +0200 +++ b/tests/test-bundle.t Tue Jul 12 01:34:18 2022 +0200 @@ -718,7 +718,7 @@ $ hg init empty $ hg -R test bundle --base null -r 0 ../0.hg 1 changesets found - $ hg -R test bundle --base 0 -r 1 ../1.hg + $ hg -R test bundle --exact -r 1 ../1.hg 1 changesets found $ hg -R empty unbundle -u ../0.hg ../1.hg adding changesets diff -r 23dd636852b8 -r 2bbd7bc7d6c4 tests/test-completion.t --- a/tests/test-completion.t Mon Jul 11 23:59:34 2022 +0200 +++ b/tests/test-completion.t Tue Jul 12 01:34:18 2022 +0200 @@ -261,7 +261,7 @@ bookmarks: force, rev, delete, rename, inactive, list, template branch: force, clean, rev branches: active, closed, rev, template - bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure + bundle: exact, force, rev, branch, base, all, type, ssh, remotecmd, insecure cat: output, rev, decode, include, exclude, template clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure commit: addremove, close-branch, amend, secret, edit, force-close-branch, interactive, include, exclude, message, logfile, date, user, subrepos