bookmarks and branches again: files

Uwe Brauer oub at mat.ucm.es
Tue Jul 12 14:07:21 UTC 2016


   > 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.

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

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

Uwe 




More information about the Mercurial mailing list