[PATCH] localrepo: drop useless `_writebookmarks`
Augie Fackler
lists at durin42.com
Fri Oct 5 10:16:29 CDT 2012
Please no. I actually need to finish cleaning this up, but it makes
implementing bookmarks support MUCH more difficult for non-localrepo
subclasses if the locking etc happens in a helper method like
bookmarks.write.
I actually /need/ this to go the other way: have the locking handled
by the repo class, and then only call out to bookmarks.py for the
bookmark-specific logic.
On Fri, Oct 5, 2012 at 10:10 AM, <pierre-yves.david at logilab.fr> wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at logilab.fr>
> # Date 1349446892 -7200
> # Node ID 24751fbcc88c649b74961c05c8b7ead6f4daa7c2
> # Parent 43b35b70f0a42d34a536ba17baf9928a7c002e8b
> localrepo: drop useless `_writebookmarks`
>
> This function was the same as `mercurial.bookmarks.write` but took an unused
> argument.
>
> diff --git a/hgext/mq.py b/hgext/mq.py
> --- a/hgext/mq.py
> +++ b/hgext/mq.py
> @@ -61,11 +61,11 @@ such as -f/--force or --exact are passed
>
> from mercurial.i18n import _
> from mercurial.node import bin, hex, short, nullid, nullrev
> from mercurial.lock import release
> from mercurial import commands, cmdutil, hg, scmutil, util, revset
> -from mercurial import repair, extensions, url, error, phases
> +from mercurial import repair, extensions, url, error, phases, bookmarks
> from mercurial import patch as patchmod
> import os, re, errno, shutil
>
> commands.norepo += " qclone"
>
> @@ -2980,11 +2980,11 @@ def strip(ui, repo, *revs, **opts):
> "ancestors(bookmark() and not bookmark(%s))",
> mark, mark, mark)
> revs.update(set(rsrevs))
> if not revs:
> del marks[mark]
> - repo._writebookmarks(mark)
> + bookmarks.write(repo)
> ui.write(_("bookmark '%s' deleted\n") % mark)
>
> if not revs:
> raise util.Abort(_('empty revision set'))
>
> @@ -3030,11 +3030,11 @@ def strip(ui, repo, *revs, **opts):
> finally:
> wlock.release()
>
> if opts.get('bookmark'):
> del marks[mark]
> - repo._writebookmarks(marks)
> + bookmarks.write(repo)
> ui.write(_("bookmark '%s' deleted\n") % mark)
>
> repo.mq.strip(repo, revs, backup=backup, update=update,
> force=opts.get('force'))
>
> diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
> --- a/mercurial/bookmarks.py
> +++ b/mercurial/bookmarks.py
> @@ -163,11 +163,11 @@ def update(repo, parents, node):
> marks[cur] = new.node()
> update = True
> if mark != cur:
> del marks[mark]
> if update:
> - repo._writebookmarks(marks)
> + write(repo)
> return update
>
> def listbookmarks(repo):
> # We may try to list bookmarks on a repo type that does not
> # support it (e.g., statichttprepository).
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -269,13 +269,10 @@ class localrepository(object):
>
> @filecache('bookmarks.current')
> def _bookmarkcurrent(self):
> return bookmarks.readcurrent(self)
>
> - def _writebookmarks(self, marks):
> - bookmarks.write(self)
> -
> def bookmarkheads(self, bookmark):
> name = bookmark.split('@', 1)[0]
> heads = []
> for mark, n in self._bookmarks.iteritems():
> if mark.split('@', 1)[0] == name:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list