comparison mercurial/cmdutil.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 8f85151ce201
children c8ffde272653
comparison
equal deleted inserted replaced
17921:4ac9cf3d810c 17922:7f5dab94e48c
8 from node import hex, nullid, nullrev, short 8 from node import hex, nullid, nullrev, short
9 from i18n import _ 9 from i18n import _
10 import os, sys, errno, re, tempfile 10 import os, sys, errno, re, tempfile
11 import util, scmutil, templater, patch, error, templatekw, revlog, copies 11 import util, scmutil, templater, patch, error, templatekw, revlog, copies
12 import match as matchmod 12 import match as matchmod
13 import subrepo, context, repair, bookmarks, graphmod, revset, phases, obsolete 13 import subrepo, context, repair, graphmod, revset, phases, obsolete
14 import changelog 14 import changelog
15 import lock as lockmod 15 import lock as lockmod
16 16
17 def parsealiases(cmd): 17 def parsealiases(cmd):
18 return cmd.lstrip("^").split("|") 18 return cmd.lstrip("^").split("|")
1754 repo.setparents(newid, nullid) 1754 repo.setparents(newid, nullid)
1755 1755
1756 # Move bookmarks from old parent to amend commit 1756 # Move bookmarks from old parent to amend commit
1757 bms = repo.nodebookmarks(old.node()) 1757 bms = repo.nodebookmarks(old.node())
1758 if bms: 1758 if bms:
1759 marks = repo._bookmarks
1759 for bm in bms: 1760 for bm in bms:
1760 repo._bookmarks[bm] = newid 1761 marks[bm] = newid
1761 bookmarks.write(repo) 1762 marks.write()
1762 #commit the whole amend process 1763 #commit the whole amend process
1763 if obsolete._enabled and newid != old.node(): 1764 if obsolete._enabled and newid != old.node():
1764 # mark the new changeset as successor of the rewritten one 1765 # mark the new changeset as successor of the rewritten one
1765 new = repo[newid] 1766 new = repo[newid]
1766 obs = [(old, (new,))] 1767 obs = [(old, (new,))]