Mercurial > hg
changeset 45805:49535e56fab8
push: add --all-bookmarks option
Differential Revision: https://phab.mercurial-scm.org/D9261
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Mon, 26 Oct 2020 11:45:32 +0100 |
parents | 6991f3014311 |
children | 7252f5237352 |
files | mercurial/commands.py tests/test-bookmarks-pushpull.t tests/test-completion.t |
diffstat | 3 files changed, 41 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Thu Oct 29 19:25:33 2020 +0100 +++ b/mercurial/commands.py Mon Oct 26 11:45:32 2020 +0100 @@ -5391,6 +5391,7 @@ _(b'REV'), ), (b'B', b'bookmark', [], _(b"bookmark to push"), _(b'BOOKMARK')), + (b'', b'all-bookmarks', None, _(b"push all bookmarks (EXPERIMENTAL)")), ( b'b', b'branch', @@ -5447,7 +5448,8 @@ If -B/--bookmark is used, the specified bookmarked revision, its ancestors, and the bookmark will be pushed to the remote repository. Specifying ``.`` is equivalent to specifying the active - bookmark's name. + bookmark's name. Use the --all-bookmarks option for pushing all + current bookmarks. Please see :hg:`help urls` for important details about ``ssh://`` URLs. If DESTINATION is omitted, a default path will be used. @@ -5475,6 +5477,13 @@ """ opts = pycompat.byteskwargs(opts) + + if opts.get(b'all_bookmarks'): + cmdutil.check_incompatible_arguments( + opts, b'all_bookmarks', [b'bookmark', b'rev'], + ) + opts[b'bookmark'] = list(repo._bookmarks) + if opts.get(b'bookmark'): ui.setconfig(b'bookmarks', b'pushing', opts[b'bookmark'], b'push') for b in opts[b'bookmark']:
--- a/tests/test-bookmarks-pushpull.t Thu Oct 29 19:25:33 2020 +0100 +++ b/tests/test-bookmarks-pushpull.t Mon Oct 26 11:45:32 2020 +0100 @@ -1364,3 +1364,33 @@ no changes found (ignored 1 secret changesets) abort: cannot push bookmark foo as it points to a secret changeset [255] + +Test pushing all bookmarks + + $ hg init $TESTTMP/ab1 + $ cd $TESTTMP/ab1 + $ "$PYTHON" $TESTDIR/seq.py 1 5 | while read i; do + > echo $i > test && hg ci -Am test + > done + adding test + $ hg clone -U . ../ab2 + $ hg book -r 1 A; hg book -r 2 B; hg book -r 3 C + $ hg push ../ab2 + pushing to ../ab2 + searching for changes + no changes found + [1] + $ hg push --all-bookmarks -r 1 ../ab2 + abort: cannot specify both --all-bookmarks and --rev + [255] + $ hg push --all-bookmarks -B A ../ab2 + abort: cannot specify both --all-bookmarks and --bookmark + [255] + $ hg push --all-bookmarks ../ab2 + pushing to ../ab2 + searching for changes + no changes found + exporting bookmark A + exporting bookmark B + exporting bookmark C + [1]
--- a/tests/test-completion.t Thu Oct 29 19:25:33 2020 +0100 +++ b/tests/test-completion.t Mon Oct 26 11:45:32 2020 +0100 @@ -352,7 +352,7 @@ paths: template phase: public, draft, secret, force, rev pull: update, force, confirm, rev, bookmark, branch, ssh, remotecmd, insecure - push: force, rev, bookmark, branch, new-branch, pushvars, publish, ssh, remotecmd, insecure + push: force, rev, bookmark, all-bookmarks, branch, new-branch, pushvars, publish, ssh, remotecmd, insecure recover: verify remove: after, force, subrepos, include, exclude, dry-run rename: after, at-rev, force, include, exclude, dry-run