hg log -G for bookmarks

Simon King simon at simonking.org.uk
Thu Feb 4 11:07:07 UTC 2016


On Thu, Feb 4, 2016 at 10:28 AM, Uwe Brauer <oub at mat.ucm.es> wrote:

> >>> "John" == John W <jwdevel at gmail.com> writes:
>
> Hi John,
>
>
>    > 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?
>
> It seems that I did not explain myself clearly enough
>
>    > $ hg log -G
>
>    > @  changeset:   1:fa8246e34747
>    > |  bookmark:    branch1       ### <---- This is what you want, yes?
> NO!
>    > |  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
>
> As far as I know, there are at least 2 possibilities of branching:[1]
>
>     -  using named branches
>
>     -  using bookmarks.
>
> And I think it would be wise to stick to one of theses possibilities
> that is not mixing named branches with bookmarks, but this is just my
> personal impression.
>
> Now if you chose named branches as I do, consider the following example
>
> hg log -G gives
>
>
> o  changeset:   148:aab09c89a511
> |  branch:      Uwe
> |  parent:      145:2c468b090b4b
> |  user:        Uwe Brauer <oub at mat.ucm.es>
> |  date:        Sat Jan 30 18:34:18 2016 +0000
> |  summary:     Checkin README.md from Ern branch
> |
> | @  changeset:   147:12a0e10e0c63
> | |  branch:      Ern
> | |  user:        Uwe Brauer <oub at mat.ucm.es>
> | |  date:        Sat Jan 30 17:57:14 2016 +0000
> | |  summary:     Minor upgrade, README
> | |
> | o  changeset:   146:8432f47039de
> |/   branch:      Ern
> |    user:        Uwe Brauer <oub at mat.ucm.es>
> |    date:        Fri Jan 29 17:21:02 2016 +0000
> |    summary:     Add information to README.md
> |
>
> It is displayed in a tree form. The question is now, suppose I would chose
> bookmarks for branching not named branches, I look for a possibility
> that
>
> hg log -G --some-option-or-template
>
> would give
>
>
> o  changeset:   148:aab09c89a511
> |  bookmark:      Uwe
> |  parent:      145:2c468b090b4b
> |  user:        Uwe Brauer <oub at mat.ucm.es>
> |  date:        Sat Jan 30 18:34:18 2016 +0000
> |  summary:     Checkin README.md from Ern branch
> |
> | @  changeset:   147:12a0e10e0c63
> | |  bookmark:      Ern
> | |  user:        Uwe Brauer <oub at mat.ucm.es>
> | |  date:        Sat Jan 30 17:57:14 2016 +0000
> | |  summary:     Minor upgrade, README
> | |
> | o  changeset:   146:8432f47039de
> |/   bookmark:      Ern
> |    user:        Uwe Brauer <oub at mat.ucm.es>
> |    date:        Fri Jan 29 17:21:02 2016 +0000
> |    summary:     Add information to README.md
> |
>
>
>
> And that seems not to be possible if I have understood the answers
> correctly
>
>
Displaying the log in tree form is completely independent of whether you
are using bookmarks or named branches. The tree is always displayed if you
pass "-G" to the log command.

In your example, earlier, you ran the equivalent of "hg log -Gr book1". "hg
log" only displays the revisions you asked for, and a bookmark points at a
single revision. That's why the command only displayed a single revision.
Note that it was still displaying a tree, but when there's only one
revision the tree isn't very interesting.

If you wanted to see all ancestor revisions for a particular bookmark, you
might write "hg log -Gr ::book1". If you wanted to see the tree for all
bookmarks, you could use "hg log -Gr '::bookmark()'"

Hope that helps,

Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20160204/66ab1c1f/attachment-0002.html>


More information about the Mercurial mailing list