[PATCH] summary: show bookmarks separate from tags and note active mark (issue2892)

Kevin Bullock kbullock+mercurial at ringworld.org
Thu Jul 21 06:16:47 UTC 2011


On 20 Jul 2011, at 9:38 PM, Augie Fackler wrote:

> # HG changeset patch
> # User Augie Fackler <durin42 at gmail.com>
> # Date 1310993606 18000
> # Node ID 725c35368ed2b20e736eda0b901a3fee1ae8a443
> # Parent  6d1d0b9c4ecce74ed782d87fa7f10acd54c1c640
> summary: show bookmarks separate from tags and note active mark (issue2892)
> 
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -4720,6 +4720,7 @@
>     ctx = repo[None]
>     parents = ctx.parents()
>     pnode = parents[0].node()
> +    marks = []
> 
>     for p in parents:
>         # label with log.changeset (instead of log.parent) since this
> @@ -4728,7 +4729,7 @@
>                  label='log.changeset')
>         ui.write(' '.join(p.tags()), label='log.tag')
>         if p.bookmarks():
> -            ui.write(' ' + ' '.join(p.bookmarks()), label='log.bookmark')
> +            marks.extend(p.bookmarks())
>         if p.rev() == -1:
>             if not len(repo):
>                 ui.write(_(' (empty repository)'))
> @@ -4747,6 +4748,17 @@
>     else:
>         ui.status(m, label='log.branch')
> 
> +    if marks:
> +        current = repo._bookmarkcurrent
> +        if current is not None:
> +            try:
> +                marks.remove(current)
> +                marks = ['* ' + current] + marks

I know the `bookmarks` command puts a space between the '*' and the current bookmark, but it seems not very readable to do so when listing them inline like this.

Also, is there a way to get the color hinting in there for the current bookmark? e.g. by splitting the ui.write into two calls, including the '\n' only in the last one?

pacem in terris / mir / shanti / salaam / heiwa
Kevin R. Bullock

> +            except ValueError:
> +                # current bookmark not in parent ctx marks
> +                pass
> +        ui.write(_('bookmarks: %s\n') % ' '.join(marks), label='log.bookmark')
> +
>     st = list(repo.status(unknown=True))[:6]
> 
>     c = repo.dirstate.copies()
> diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t
> --- a/tests/test-bookmarks.t
> +++ b/tests/test-bookmarks.t
> @@ -239,9 +239,10 @@
> test summary
> 
>   $ hg summary
> -  parent: 2:db815d6d32e6 tip Y Z x  y
> +  parent: 2:db815d6d32e6 tip
>    2
>   branch: default
> +  bookmarks: * Z Y x  y
>   commit: (clean)
>   update: 1 new changesets, 2 branch heads (merge)
> 
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel




More information about the Mercurial-devel mailing list