read-only bookmarks

Kevin Bullock kbullock+mercurial at
Mon Jun 20 11:17:19 CDT 2011

On Jun 19, 2011, at 4:48 PM, Felix Dorner wrote:

> Hey,
> I'd like to use bookmarks to mark specific versions of our code. I'd
> like to set the bookmark once and then lock it down somehow. Never
> ever anyone should update the bookmark to point to a different
> revision. Of course I cannot control what people do in their clones,
> but at least in our official repository I'd like to have a
> set-and-lock mechanism. Why not use tags? I simply don't like that 10%
> of all our commits are "create tag xyz". I guess I need to write a
> hook that implements "Reject all pushes that modify the pointer of an
> existing bookmark whose name matches (bm-lock-*). Of course, it should
> also be hard for people to update/modify these bookmarks in their
> clones. If I create say, 30 bookmarks of that kind every week, would
> that still work fine after a year? 3 years? Maybe I should simply use
> some other mechanism, a text file, something outside mercurial, and
> build some tool around it.. Anyone has some experience to share here?

Bookmarks aren't designed to do this. You might be able to hack something together, but... why?

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.

Using bookmarks this way is bound to involve a lot of effort and be very brittle. On top of that, you still wouldn't have a reliable, auditable tag replacement.

pacem in terris / mir / shanti / salaam / heiwa
Kevin R. Bullock

More information about the Mercurial mailing list