hg log -G for bookmarks
Matt Mackall
mpm at selenic.com
Thu Feb 4 17:56:56 UTC 2016
On Thu, 2016-02-04 at 15:13 +0000, Uwe Brauer wrote:
> Branches: I did
I'm going to draw a graph of your repo at each step, sideways, time left to
right.
> echo one > test.txt
> hg init
> hg add test.txt
> echo two >> test.txt
> hg commit -m "2"
default
> hg branch master
> hg commit -m "3"
default->master
> echo three >> test.txt
> hg commit -m "4"
default->master->master
> hg update default
> echo four >> test.txt
> hg commit -m "5"
default->master->master
\
default
>So far so good. Now to bookmarks
>
>
> echo one > test.txt
> hg init
> hg add test.txt
> echo two >> test.txt
> hg commit -m "2"
default
> hg bookmark master
default
^
*master <- bookmark points at first commit, is active
> hg commit -m "3"
No effect. Bookmarks are not part of the book and nothing else changed.
> echo three >> test.txt
> hg commit -m "4"
default->default
^
*master <- active bookmark advances
> hg bookmark book1
default->default
^
master
*book1 <- new active
bookmark
> hg update book1
No effect. We're already there.
> echo four >> test.txt
> hg commit -m "5"
default->default->default
^ ^
master *book1 <-
active bookmark advances
> hg log -Gr '::bookmark()'
The -r '::bookmark()' is unnecessary. Not sure what you think it does. The graph
shape is completely independent of bookmarks and is simply a matter of which
changesets are parents of which other changesets. Bookmarks are just pointers at
changesets and are completely external to the graph. Similarly, named branches
are just another field in the changeset description like user:, no effect on the
graph shape.
> @ changeset: 2:510400455b95
> > bookmark: book1
> > tag: tip
> > user: Uwe Brauer <oub at mat.ucm.es>
> > date: Thu Feb 04 15:03:13 2016 +0000
> > summary: 5
> >
> o changeset: 1:ba5cb90c015b
> > bookmark: master
> > user: Uwe Brauer <oub at mat.ucm.es>
> > date: Thu Feb 04 15:03:12 2016 +0000
> > summary: 4
> >
> o changeset: 0:755d311e9398
> user: Uwe Brauer <oub at mat.ucm.es>
> date: Thu Feb 04 15:03:10 2016 +0000
> summary: 2
>
> So the question is how do I get a graph, with a tree, with trunk and
> branches as in the first case.
This output is fully correct. To get a graph analogous to your first one, do:
$ hg init
$ hg book @ # @ is the hg equivalent of git's "master"
$ echo a > a
$ hg ci -Am0
default
^
*@ <- our @ bookmark on the first commit
$ hg book book1 # start a feature branch
$ echo b > b
$ hg ci -Am1
default->default
^ ^
@ *book1 <- new active bookmark
$ echo c > c
$ hg ci -Am2
default->default->default
^ ^
@ *book1 <-
bookmark advances
$ hg up @ # hop back to @, make it active
$ echo x > x
$ hg ci -Am3 # branch off
default->default->default
\ ^
default book1
^
*@
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial
mailing list