[PATCH] export: add -B option to select a bookmark
Yuya Nishihara
yuya at tcha.org
Mon May 14 12:16:26 UTC 2018
On Mon, 14 May 2018 13:01:26 +0200, David Demelier wrote:
> # HG changeset patch
> # User David Demelier <markand at malikania.fr>
> # Date 1526295193 -7200
> # Mon May 14 12:53:13 2018 +0200
> # Node ID 870851c118b003e60a574670fc603b4780609c3b
> # Parent 8ba0344f9fb145f5b9b909f1211defc9e0793f68
> export: add -B option to select a bookmark
Nice.
> + [('B', 'bookmark', '', _('send changes only reachable by given bookmark')),
Nit: s/send/export/
> opts = pycompat.byteskwargs(opts)
> - changesets += tuple(opts.get('rev', []))
> + rev = opts.get('rev')
> + bookmark = opts.get('bookmark')
> +
> + if bookmark and rev:
> + raise error.Abort(_("-r and -B are mutually exclusive"))
> + if rev:
> + changesets += tuple(opts.get('rev', []))
> + elif bookmark:
> + if bookmark not in repo._bookmarks:
> + raise error.Abort(_("bookmark '%s' not found") % bookmark)
> + changesets += tuple(repair.stripbmrevset(repo, bookmark))
> +
> if not changesets:
> changesets = ['.']
> repo = scmutil.unhidehashlikerevs(repo, changesets, 'nowarn')
Here changesets is a list of revset expressions, but stripbmrevset() returns
a list of integer revisions. So this should be something like:
if bookmark:
revs = repair.stripbmrevset(repo, bookmark)
else:
if not changesets:
...
revs = scmutil.revrange(...)
FWIW, stripbmrevset() will have to be moved somewhere. Maybe scmutil?
More information about the Mercurial-devel
mailing list