bookmarks and branches again: files
Simon King
simon at simonking.org.uk
Wed Jul 13 10:37:13 UTC 2016
On Wed, Jul 13, 2016 at 9:18 AM, Uwe Brauer <oub at mat.ucm.es> wrote:
>
>
> > The `hg update` is unnecessary. `hg bookmark book2` creates book2 on
> > the current revision and makes it the active bookmark.
>
> Ok, maybe I was confusing this with branches, after creating a branch I
> have to update to that branch.
Not true. "hg branch <branchname>" tells mercurial that the next
commit should be created with the branch set to <branchname>.
ie.
hg branch my_new_banch
hg commit
is sufficent to create a commit on my_new_branch. No "hg update" is required.
>
>
> > Now you've gone back to a commit that doesn't have test2.txt in it.
>
>
> > As expected, test2.txt is not in this revision.
>
>
> > But it is in here.
>
>
> > Indeed, as expected, you have the commit formerly bookmarked 'master'
> > checked out (which by the way in hg should be spelled '@' instead).
>
>
> Why, I think I have read this somewhere, that @ is recommended but why?
>
>
> > 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.
>
> The problem is, how do I know which commit I have to checkout, after
> having deleted the bookmark? Is there any command which would allow me
> to list all the files which have been added in any revision?
>
Finding revisions that added, edited or removed a file is easy using
revsets (https://selenic.com/hg/help/revsets)
For example, list the revisions that touched test2.txt:
hg log -r "file('test2.txt')"
As well as "file", there are "adds" and "removes" functions for
finding revisions where a file was added or removed.
Note that in your example, "removes('test2.txt')" would not return any
results, because you've never actually issued an "hg rm" command to
delete the file; you've simply checked out an older version of the
repository, before the file existed.
Hope that helps,
Simon
More information about the Mercurial
mailing list