[PATCH STABLE] bookmarks: recreating the same bookmark should be a no-op (BC)

Matt Mackall mpm at selenic.com
Mon Jul 30 11:58:43 CDT 2012


On Mon, 2012-07-30 at 15:35 +0200, Patrick Mezard wrote:
> # HG changeset patch
> # User Patrick Mezard <patrick at mezard.eu>
> # Date 1343654778 -7200
> # Branch stable
> # Node ID 954100d6dacade7e43a794a4e248af48025938f8
> # Parent  7a9246abf9febedfe00d6799bcb9a3383eb87beb
> bookmarks: recreating the same bookmark should be a no-op (BC)
> 
> The following command sequences do not fail anymore:
> 
>   $ hg bo abookmark
>   $ hg bo abookmark
>   $ hg bo -r . abookmark
> 
>   $ hg bo --inactive abookmark
>   $ hg bo --inactive abookmark
>   $ hg bo --inactive -r . abookmark
> 
> Before this change the calls following the first one would have aborted with:
> 
>   abort: bookmark 'abookmark' already exists (use -f to force)

Why is this an improvement? It seems to me that if you try to create
something that already exists (even if it's the same), it's because your
internal model of the state is wrong. If I don't know bookmark X exists
(for instance, because someone else created for a different purpose),
then I may be making a blunder.

> As a side-effect, bookmarks on parent changeset can be activated without
> --force.

Seems like this is actually motivated by the side-effect. Why not just
use the normal way to activate a bookmark:

 hg up thebookmark

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list