bookmarks and branches again: files

Simon King simon at simonking.org.uk
Tue Jul 12 14:42:43 UTC 2016


On Tue, Jul 12, 2016 at 3:07 PM, Uwe Brauer <oub at mat.ucm.es> wrote:
>
>    > On Tue, Jul 12, 2016 at 2:31 PM, Uwe Brauer <oub at mat.ucm.es> wrote:
>
>
>    > So when you executed "hg update default", mercurial interpreted that
>    > to mean "update to the latest revision on the branch 'default'", which
>    > happens to be the same commit pointed at by your "master" bookmark. In
>    > other words, "hg update default" didn't move you to a different
>    > revision, all it did was deactivate your active bookmark.
>
>    > In mercurial, all commits are part of a named branch, even if you are
>    > using bookmarks. If you haven't used "hg branch" at all, then all
>    > commits are part of the branch called "default".
>
> Ok I see that is important to know.
>
> It seem that the following producing something similar with bookmarks
> (to the branch case)
>
>  hg init
>  hg bookmark master
>  echo one > test1.txt
>  hg add test1.txt
>  hg commit -m "0"
>  hg bookmark book2
>  hg update book2
>  echo two >> test2.txt
>  hg add test2.txt
>  hg commit -m "1"
>  echo three >> test1.txt
>  hg commit -m "2"
>  hg update master
>  echo four >> test1.txt
>  hg commit -m "3"
>
>
> So the idea is to use  two bookmarks instead of only one, so
>
> hg update master «deletes»
> hg update book2 «recovers»
>
> the file test2.txt
>
> However when I delete the two bookmarks then test2.txt might disappear
> depending which bookmark was last active.

Is that really true? Deleting a bookmark doesn't change the revision
that is currently checked out, so I don't see how a file can disappear
simply because you delete a bookmark.

> And hg status does not give any information about the file test2.txt.

Not quite sure what you mean by this. "hg status" tells you about the
status of files in your working copy, relative to the revision that
you've got checked out. What would you *like* it to tell you about
test2.txt?

> So as longer as I think about it as more dangerous bookmarks seem.

I don't know what you mean by "dangerous" here - can you explain?

Thanks,

Simon



More information about the Mercurial mailing list