[PATCH] strip: use repo._bookmarks.recordchange instead of repo._bookmarks.write

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Nov 20 19:38:49 CST 2015



On 11/20/2015 01:50 PM, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon at fb.com>
> # Date 1448055996 28800
> #      Fri Nov 20 13:46:36 2015 -0800
> # Node ID 49bd868a99249497179cb7e7a43d5ad88055bf39
> # Parent  8b9c04fb4c7e6d6cb872c63f7289ea679296dd3e
> strip: use repo._bookmarks.recordchange instead of repo._bookmarks.write
>
> Before this patch, strip was using repo._bookmarks.write.
> This patch replaces this code with the recommended way of saving bookmarks
> changes: repo._bookmarks.recordchange.
>
> diff --git a/hgext/strip.py b/hgext/strip.py
> --- a/hgext/strip.py
> +++ b/hgext/strip.py
> @@ -64,13 +64,19 @@
>
>           repomarks = repo._bookmarks
>           if bookmarks:
> -            if repo._activebookmark in bookmarks:
> -                bookmarksmod.deactivate(repo)
> -            for bookmark in bookmarks:
> -                del repomarks[bookmark]
> -            repomarks.write()
> -            for bookmark in sorted(bookmarks):
> -                ui.write(_("bookmark '%s' deleted\n") % bookmark)
> +            tr = None
> +            try:
> +                tr = repo.transaction('bookmark')

Same feedback on the transaction name. 'bookmark' seems too generic.

I've changed it to 'strip' and pushed it to the clowncopter.

Thanks a lot for this bookmark clean up.

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list