[PATCH] bookmark: add an --active flag to display the active bookmark

Yuya Nishihara yuya at tcha.org
Mon Aug 27 08:29:15 EDT 2018


On Mon, 27 Aug 2018 11:20:39 +0200, Boris FELD wrote:
> 
> On 25/08/2018 11:12, Yuya Nishihara wrote:
> > On Fri, 17 Aug 2018 18:25:23 +0200, Boris Feld wrote:
> >> # HG changeset patch
> >> # User Boris Feld <boris.feld at octobus.net>
> >> # Date 1534432767 -7200
> >> #      Thu Aug 16 17:19:27 2018 +0200
> >> # Node ID 743d3dfd61a275c393a19121de3cc24e70555c5c
> >> # Parent  46da52f4b820f2668b120fcf93f09fb730065da6
> >> # EXP-Topic active-bookmark
> >> # Available At https://bitbucket.org/octobus/mercurial-devel/
> >> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 743d3dfd61a2
> >> bookmark: add an --active flag to display the active bookmark
> > Queued, thanks.
> >
> >> We add a `--active` flag to the `hg bookmarks` command. When set, the command
> >> display the current bookmark name if any or return 1.
> >> For now, this flag is read-only. However sensible combinations exist with
> >> `--delete`, `--rename` and `--rev` and can be implemented later.
> > Do you mean --active == --no-inactive?
> 
> I mean:
> 
>   `hg bookmarks --active --delete`: delete the active bookmark

Why not use "--delete ." ?

>   `hg bookmarks --active --rev 42`: move active bookmark to revision 42

I think it can be read as "bookmark revision 42 as <something> and activate
it."

>   `hg bookmarks --active --rename foo`: rename the active bookmark

This seems weird since the syntax is --rename=OLD. IIRC, that's one reason
why we've added "--rename . foo".

> >> +    elif active:
> >> +        book = repo._activebookmark
> >> +        if book is None:
> >> +            return 1
> >> +        ui.write("%s\n" % book, label=bookmarks.activebookmarklabel)
> > Can you update this to support -T ?
> I'm not sure of how to do that. Can you point me toward an example?

See bookmarks._printbookmark().


More information about the Mercurial-devel mailing list