hg log -G for bookmarks

John W jwdevel at gmail.com
Wed Feb 3 18:16:27 UTC 2016


Hi Uwe,

I might not be fully understanding you, but at least for me, on plain
Mercurial 3.0, I see bookmarks noted in the "log -G" output. Is the
below not what you see?

Here's my session (look for my "###" comments in the log output):

$ export HGPLAIN=true
$ hg ini
$ hg bookmark branch1
$ echo foo > foo.txt
$ hg st
? foo.txt

$ hg add
adding foo.txt
$ hg ci -m "initial commit"

$ echo moretext >> foo.txt
$ hg ci -m "change in branch1"

$ hg log -G

@  changeset:   1:fa8246e34747
|  bookmark:    branch1       ### <---- This is what you want, yes?
|  tag:         tip
|  user:        John Waugh <j.waugh at f5.com>
|  date:        Wed Feb 03 10:10:16 2016 -0800
|  summary:     change in branch1
|
o  changeset:   0:61c0917d884d
   user:        John Waugh <j.waugh at f5.com>
   date:        Wed Feb 03 10:09:42 2016 -0800
   summary:     initial commit

$ hg up 0
1 files updated, 0 files merged, 0 files removed, 0 files unresolved

$ hg book branch2
$ echo blablabla >> foo.txt
$ hg ci -m "change in branch2"
created new head

$ hg log -G

@  changeset:   2:0d5fc939e9fb
|  bookmark:    branch2    ### <---- Right?
|  tag:         tip
|  parent:      0:61c0917d884d
|  user:        John Waugh <j.waugh at f5.com>
|  date:        Wed Feb 03 10:10:44 2016 -0800
|  summary:     change in branch2
|
| o  changeset:   1:fa8246e34747
|/   bookmark:    branch1            ### <---- Right?
|    user:        John Waugh <j.waugh at f5.com>
|    date:        Wed Feb 03 10:10:16 2016 -0800
|    summary:     change in branch1
|
o  changeset:   0:61c0917d884d
   user:        John Waugh <j.waugh at f5.com>
   date:        Wed Feb 03 10:09:42 2016 -0800
   summary:     initial commit

$ hg version
Mercurial Distributed SCM (version 3.0)
...


Or maybe there is something else you are asking for, and I misunderstand.

-John

On 2/2/16, Uwe Brauer <oub at mat.ucm.es> wrote:
>>>> "Matt" == Matt Mackall <mpm at selenic.com> writes:
>
>    > On Mon, 2016-02-01 at 19:52 +0100, Raffaele Salmaso wrote:
>    >> On Mon, Feb 1, 2016 at 7:45 PM, Kevin Bullock <
>    >> kbullock+mercurial at ringworld.org> wrote:
>    >>
>    >> > You can do this with templates (hg help templates). No plans to add
> it
>    >> > because changing our default log template would break our
>    >> > backward-compatibility guarantees <
>    >> > https://www.mercurial-scm.org/wiki/CompatibilityRules>;.
>    >> >
>    >> I use
>    >> hg log --graph --follow --rev $1
>    >> But it would be nice to have a -B option, like -b for branches
>
>    > You can make arbitrarily elaborate customizations. For instance, I use
> this:
>
>    > [alias]
>    > sl = log -Gr smart -Tsl
>
>    > [revsetaliases]
>    > smart = (parents(not public()) or not public() or . or head()) and (not
> secret(\
>    > ) or ::.)
>
>    > [templates]
>    > sl = '{ifeq(branch,"default","","{label(blue_background, branch)}
> ")}{label("lo\
>    > g.changeset changeset.{phase}", shortest(node))} {label("grep.user",
> author|use\
>    > r)}{label("tags.normal", if(tags," {tags}"))} {label("sl.book",
> if(bookmarks," \
>    > {bookmarks}"))} {label(bold,topics)}\n{label(ifcontains(rev,
> revset('.'), 'desc\
>    > .here'),desc|firstline)}'
>
>
> Thanks, but I am not sure I understood completely. I made a test case.
>
> A dummy directory with one files. Branches are: default and one branch
> called branch1.
>
> hg branches
> default                        4:9b4317b408fb
> branch1                        3:f833d2810ce6
>
>
> I made a couple of edits and commits and switched between these
> branches. Then
>
>  hg log -G
>
> Gives me this
>
>
> @  changeset:   4:9b4317b408fb
> |  tag:         tip
> |  parent:      1:62312e36d7c5
> |  user:        Uwe Brauer <oub at mat.ucm.es>
> |  date:        Tue Feb 02 14:28:22 2016 +0000
> |  summary:     continue default
> |
> | o  changeset:   3:f833d2810ce6
> | |  branch:      branch1
> | |  user:        Uwe Brauer <oub at mat.ucm.es>
> | |  date:        Tue Feb 02 14:27:22 2016 +0000
> | |  summary:     branch1
> | |
> | o  changeset:   2:a549c1f41ba8
> |/   branch:      branch1
> |    user:        Uwe Brauer <oub at mat.ucm.es>
> |    date:        Tue Feb 02 14:26:53 2016 +0000
> |    summary:     branch1 created
> |
> o  changeset:   1:62312e36d7c5
> |  user:        Uwe Brauer <oub at mat.ucm.es>
> |  date:        Tue Feb 02 14:25:44 2016 +0000
> |  summary:     3
> |
> o  changeset:   0:f098482c122c
>    user:        Uwe Brauer <oub at mat.ucm.es>
>    date:        Tue Feb 02 14:25:33 2016 +0000
>    summary:     *** empty log message ***
>
> Again this is the output I would like to have for bookmarks.
>
> So I did basically the same in another dummy directory. One file, now 2
> bookmarks
>
> hg bookmarks
>    book1                     3:013fcaf046ca
>  * book2                     5:a1d4cd558f61
>
> And again a couple of edits and a couple of commits for both bookmarks.
> So I hoped your command
> Would show me something similar to
>
>
>  hg log -G
>
>
> However which your setting,
> hg log -Gr smart -Tsl
>
> Gives me
> abort: unknown revision 'smart'!
>
> (I am running 3.0.1, could it be that my version of hg does not
> understand the definition
> [revsetaliases]
> smart = (parents(not public()) or not public() or . or head())  and (not
> secret() or ::.)
>
>
> ???
>
>
> So I tried
>
>
>  log -Gr book1 -Tsl
>
>
> In the example above, but the result was:
> @  a1d4 oub tip  book2
> |  2 book2
>
> I presume I misunderstood your command, could you please clarify?
>
> Thanks
>
> Uwe Brauer
>
> _______________________________________________
> Mercurial mailing list
> Mercurial at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial
>



More information about the Mercurial mailing list