bookmarks and branches again: files
Kevin Bullock
kbullock+mercurial at ringworld.org
Tue Jul 12 19:43:13 UTC 2016
> On Jul 12, 2016, at 10:43, Uwe Brauer <oub at mat.ucm.es> wrote:
>
>
>> On Tue, Jul 12, 2016 at 3:07 PM, Uwe Brauer <oub at mat.ucm.es> wrote:
>
>> 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.
>
> Well, I run the following
>
> hg init
> hg bookmark master
> echo one > test1.txt
> hg add test1.txt
> hg commit -m "0"
> hg bookmark book2
> hg update book2
The `hg update` is unnecessary. `hg bookmark book2` creates book2 on the current revision and makes it the active bookmark.
> echo two >> test2.txt
> hg add test2.txt
> hg commit -m "1"
> echo three >> test1.txt
> hg commit -m "2"
> hg update master
Now you've gone back to a commit that doesn't have test2.txt in it.
> echo four >> test1.txt
> hg commit -m "3"
>
> I obtain
> 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
> created new head
>
> ls -l tells me
>
> drwxr-xr-x 5 oub oub 4.0K 2016-07-12 15:40 .hg
> -rw-r--r-- 1 oub oub 351 2016-07-12 15:38 script-bookmark
> -rw-r--r-- 1 oub oub 270 2016-07-12 13:30 script-branch
> -rw-r--r-- 1 oub oub 9 2016-07-12 15:40 test1.txt
As expected, test2.txt is not in this revision.
> Hg update book2
>
> ls -l
>
> drwxr-xr-x 5 oub oub 4.0K 2016-07-12 15:40 .hg
> -rw-r--r-- 1 oub oub 351 2016-07-12 15:38 script-bookmark
> -rw-r--r-- 1 oub oub 270 2016-07-12 13:30 script-branch
> -rw-r--r-- 1 oub oub 10 2016-07-12 15:40 test1.txt
> -rw-r--r-- 1 oub oub 4 2016-07-12 15:40 test2.txt
But it is in here.
> Hg update master
>
> hg update master
> 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
>
> Now I delete both bookmarks
>
> hg bookmark -d book2
> hg bookmark -d master
>
>
> ls -l
> total 12
> -rw-r--r-- 1 oub oub 351 2016-07-12 15:38 script-bookmark
> -rw-r--r-- 1 oub oub 270 2016-07-12 13:30 script-branch
> -rw-r--r-- 1 oub oub 9 2016-07-12 15:41 test1.txt
>
> So test2.txt is not there.
Indeed, as expected, you have the commit formerly bookmarked 'master' checked out (which by the way in hg should be spelled '@' instead).
If you now check out the commit that was labelled 'book2', you would have test2.txt back. The commits don't go anywhere when you delete the bookmark, only the bookmarks do.
pacem in terris / мир / शान्ति / سَلاَم / 平和
Kevin R. Bullock
More information about the Mercurial
mailing list