Commit 8a8a82ad authored by Dan Villiom Podlaski Christiansen's avatar Dan Villiom Podlaski Christiansen
Browse files

push: add --all-bookmarks option

Differential Revision: https://phab.mercurial-scm.org/D9261
parent 6991f3014311
......@@ -5391,6 +5391,7 @@ def pull(ui, repo, source=b"default", **opts):
_(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 @@ def push(ui, repo, dest=None, **opts):
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 @@ def push(ui, repo, dest=None, **opts):
"""
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']:
......
......@@ -1364,3 +1364,33 @@ Pushing the bookmark "foo" now fails as it contains a secret changeset
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]
......@@ -352,7 +352,7 @@ Show all commands + options
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment