comparison hgext/share.py @ 27186:34d26e22a2b0

bookmarks: hoist getbkfile out of bmstore class It's totally fine that this hook exists, but I don't see a need for it to live inside the bmstore class.
author Augie Fackler <augie@google.com>
date Wed, 11 Nov 2015 20:45:38 -0500
parents a7eecd021782
children 98e59d9e0d77
comparison
equal deleted inserted replaced
27185:d52765831086 27186:34d26e22a2b0
119 ) 119 )
120 120
121 return orig(ui, source, *args, **opts) 121 return orig(ui, source, *args, **opts)
122 122
123 def extsetup(ui): 123 def extsetup(ui):
124 extensions.wrapfunction(bookmarks.bmstore, 'getbkfile', getbkfile) 124 extensions.wrapfunction(bookmarks, '_getbkfile', getbkfile)
125 extensions.wrapfunction(bookmarks.bmstore, 'recordchange', recordchange) 125 extensions.wrapfunction(bookmarks.bmstore, 'recordchange', recordchange)
126 extensions.wrapfunction(bookmarks.bmstore, '_writerepo', writerepo) 126 extensions.wrapfunction(bookmarks.bmstore, '_writerepo', writerepo)
127 extensions.wrapcommand(commands.table, 'clone', clone) 127 extensions.wrapcommand(commands.table, 'clone', clone)
128 128
129 def _hassharedbookmarks(repo): 129 def _hassharedbookmarks(repo):
147 # the sharedpath always ends in the .hg; we want the path to the repo 147 # the sharedpath always ends in the .hg; we want the path to the repo
148 source = repo.vfs.split(repo.sharedpath)[0] 148 source = repo.vfs.split(repo.sharedpath)[0]
149 srcurl, branches = parseurl(source) 149 srcurl, branches = parseurl(source)
150 return repository(repo.ui, srcurl) 150 return repository(repo.ui, srcurl)
151 151
152 def getbkfile(orig, self, repo): 152 def getbkfile(orig, repo):
153 if _hassharedbookmarks(repo): 153 if _hassharedbookmarks(repo):
154 srcrepo = _getsrcrepo(repo) 154 srcrepo = _getsrcrepo(repo)
155 if srcrepo is not None: 155 if srcrepo is not None:
156 repo = srcrepo 156 repo = srcrepo
157 return orig(self, repo) 157 return orig(repo)
158 158
159 def recordchange(orig, self, tr): 159 def recordchange(orig, self, tr):
160 # Continue with write to local bookmarks file as usual 160 # Continue with write to local bookmarks file as usual
161 orig(self, tr) 161 orig(self, tr)
162 162