##// END OF EJS Templates
git: implement a basic checkconflict bookmark store method...
Josef 'Jeff' Sipek -
r45113:bb3e05ca default
parent child Browse files
Show More
@@ -16,6 +16,7 b' from mercurial import ('
16 16 extensions,
17 17 localrepo,
18 18 pycompat,
19 scmutil,
19 20 store,
20 21 util,
21 22 )
@@ -219,6 +220,35 b' class gitbmstore(object):'
219 220 force=True,
220 221 )
221 222
223 def checkconflict(self, mark, force=False, target=None):
224 githead = _BMS_PREFIX + mark
225 cur = self.gitrepo.references['HEAD']
226 if githead in self.gitrepo.references and not force:
227 if target:
228 if self.gitrepo.references[githead] == target and target == cur:
229 # re-activating a bookmark
230 return []
231 # moving a bookmark - forward?
232 raise NotImplementedError
233 raise error.Abort(
234 _(b"bookmark '%s' already exists (use -f to force)") % mark
235 )
236 if len(mark) > 3 and not force:
237 try:
238 shadowhash = scmutil.isrevsymbol(self._repo, mark)
239 except error.LookupError: # ambiguous identifier
240 shadowhash = False
241 if shadowhash:
242 self._repo.ui.warn(
243 _(
244 b"bookmark %s matches a changeset hash\n"
245 b"(did you leave a -r out of an 'hg bookmark' "
246 b"command?)\n"
247 )
248 % mark
249 )
250 return []
251
222 252
223 253 def init(orig, ui, dest=b'.', **opts):
224 254 if opts.get('git', False):
General Comments 0
You need to be logged in to leave comments. Login now