read-only bookmarks

Matt Mackall mpm at
Mon Jun 20 15:18:38 CDT 2011

On Mon, 2011-06-20 at 21:04 +0200, Pascal Quantin wrote:
> Hi,
> Le 20/06/2011 20:58, Augie Fackler a écrit :
> > On Mon, Jun 20, 2011 at 1:41 PM, Felix Dorner <fdorner at> wrote:
> >> Hi Kevin,
> >>
> >> On Mon, Jun 20, 2011 at 6:17 PM, Kevin Bullock
> >> <kbullock+mercurial at> wrote:
> >>
> >>> Bookmarks aren't designed to do this.
> >> Yes. I didn't feel it's a good idea either.
> >>
> >>> Tags are created with commits because this makes them auditable in the same way that the rest of the project history is auditable. An alternate design would put tags in a > parallel history (i.e., their own revlog—and this has been discussed to death here and on -devel), but that's not the design choice that was made.
> >> Say I follow the (good?) practice and the tagging changesets only
> >> affect .hgtags, no other files. What would be a good way to filter
> >> them out from the history? What I'd need is a hg log that shows me all
> >> changesets except the ones that only modified .hgtags. And also the
> >> inverse: A log of all changesets that affect .hgtags and only .hgtags.
> >> I bet there's an easy one :)
> > hg log -r 'not modifies(.hgtags)'
> This command will not hide the first tag adding the .hgtags file. hg log
> -r "not filelog(.hgtags)" seems to filter all of them.

Almost, but not quite: file revisions are not necessarily 1:1 with
changesets. If identical changes appear on two branches -with the same
parents-, there will only be one filelog entry. So this version will be
a) very fast and b) occasionally mistaken. This will probably never
happen in practice with .hgtags, though.

But Augie was pretty close, the right answer is:

hg log -r 'not file(.hgtags)'

This will skip all changesets that touch .hgtags by either modifying,
adding, or removing it.

This will give you some idea of the speed difference:

$ time hg log -r 'filelog(.hgtags)' -q | wc
     51      51     933

real	0m0.270s
user	0m0.237s
sys	0m0.030s

$ time hg log -r 'file(.hgtags)' -q | wc
     51      51     933

real	0m2.983s
user	0m2.923s
sys	0m0.037s

Mathematics is the supreme nostalgia of our time.

More information about the Mercurial mailing list