Mercurial > hg
changeset 49408:2bbd7bc7d6c4
bundle: introduce a --exact option
I have been wanting this options for a long time.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 12 Jul 2022 01:34:18 +0200 |
parents | 23dd636852b8 |
children | b081a5aab782 |
files | mercurial/commands.py tests/test-bundle.t tests/test-completion.t |
diffstat | 3 files changed, 22 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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):
--- 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
--- 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