[PATCH STABLE] fix bookmarks rollback behavior

David Soria Parra dsp at php.net
Sun May 1 17:31:50 CDT 2011


On 2011-05-01, Alexander Solovyov <alexander at solovyov.net> wrote:
> # HG changeset patch
> # User Alexander Solovyov <alexander at solovyov.net>
> # Date 1304248020 -7200
> # Branch stable
> # Node ID f815ee0e597cd5e8e220f5df9b9a5154a80cf10e
> # Parent  30cb7ece4378a874c0abc8610ebe5af32d3eb0b7
> fix bookmarks rollback behavior
>
> Before this patch undo.bookmarks was created on bookmarks write and not with
> other transaction-related files. There were two issues: first is that if you
> have changed bookmarks few times after a transaction happened, rollback will
> give you a state which can point to non-existing revision. Second is that if you
> have not changed bookmarks after a transaction, rollback will touch your state
> anyway.
>
> This change also adds `localrepo._writejournal` method, which can be used by
> other extensions to save their transaction-related backup in right time.

I like the idea. 
 
One thing that might confuse people is that:

 $ hg bookmark a
 $ hg commit
 $ hg bookmark -m c a
 $ hg bookmark d
 $ hg rollback

will also rename c to a again. Before your patch the rename would still
be there.  Now the last commit is the last saved state. I hope this doesn't
confuse people. Generally I'm fine with the patch.

Please also fix the tests.

> diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
> --- a/mercurial/bookmarks.py
> +++ b/mercurial/bookmarks.py
> @@ -61,12 +61,6 @@ def write(repo):

there is a comment about undo.bookmarks two lines above, please remove them
in your patch as well.



More information about the Mercurial-devel mailing list