Mercurial > public > mercurial-scm > hg
comparison mercurial/repair.py @ 17922:7f5dab94e48c
bookmarks: introduce a bmstore to manage bookmark persistence
Bookmarks persistence still showed a fair amount of its legacy as a
monkeypatching extension. This encapsulates all bookmarks
serialization and parsing in a single class, and offers a single
location where other bookmarks storage engines can be substituted
in. As a result, many files no longer import the bookmarks module,
which strikes me as an encapsulation win.
This doesn't do anything to the current bookmark state yet, but I'm
hoping put that in the bmstore class as well.
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Wed, 07 Nov 2012 16:21:39 -0600 |
parents | 1b51638bf44a |
children | 747a2f43d5d9 |
comparison
equal
deleted
inserted
replaced
17921:4ac9cf3d810c | 17922:7f5dab94e48c |
---|---|
4 # Copyright 2007 Matt Mackall | 4 # Copyright 2007 Matt Mackall |
5 # | 5 # |
6 # This software may be used and distributed according to the terms of the | 6 # This software may be used and distributed according to the terms of the |
7 # GNU General Public License version 2 or any later version. | 7 # GNU General Public License version 2 or any later version. |
8 | 8 |
9 from mercurial import changegroup, bookmarks | 9 from mercurial import changegroup |
10 from mercurial.node import short | 10 from mercurial.node import short |
11 from mercurial.i18n import _ | 11 from mercurial.i18n import _ |
12 import os | 12 import os |
13 import errno | 13 import errno |
14 | 14 |
179 if e.errno != errno.ENOENT: | 179 if e.errno != errno.ENOENT: |
180 ui.warn(_('error removing %s: %s\n') % (undofile, str(e))) | 180 ui.warn(_('error removing %s: %s\n') % (undofile, str(e))) |
181 | 181 |
182 for m in updatebm: | 182 for m in updatebm: |
183 bm[m] = repo[newbmtarget].node() | 183 bm[m] = repo[newbmtarget].node() |
184 bookmarks.write(repo) | 184 bm.write() |
185 except: # re-raises | 185 except: # re-raises |
186 if backupfile: | 186 if backupfile: |
187 ui.warn(_("strip failed, full bundle stored in '%s'\n") | 187 ui.warn(_("strip failed, full bundle stored in '%s'\n") |
188 % backupfile) | 188 % backupfile) |
189 elif saveheads: | 189 elif saveheads: |