# HG changeset patch # User Dan Villiom Podlaski Christiansen # Date 1603709132 -3600 # Node ID 49535e56fab8eacc3d9c0d339f9cec4f8ba3bde8 # Parent 6991f3014311a74101664ca069a36956c3a5dc4d push: add --all-bookmarks option Differential Revision: https://phab.mercurial-scm.org/D9261 diff -r 6991f3014311 -r 49535e56fab8 mercurial/commands.py --- 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']: diff -r 6991f3014311 -r 49535e56fab8 tests/test-bookmarks-pushpull.t --- 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] diff -r 6991f3014311 -r 49535e56fab8 tests/test-completion.t --- 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