Mercurial > hg
comparison mercurial/bookmarks.py @ 37397:46d9f998c3ed
bookmarks: use isrevsymbol() for detecting collision with existing symbol
Differential Revision: https://phab.mercurial-scm.org/D3167
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 06 Apr 2018 11:28:26 -0700 |
parents | a973bb92ab71 |
children | 81d35d5d35f9 |
comparison
equal
deleted
inserted
replaced
37396:9966f44ecab4 | 37397:46d9f998c3ed |
---|---|
236 mark == self._repo.dirstate.branch()) and not force): | 236 mark == self._repo.dirstate.branch()) and not force): |
237 raise error.Abort( | 237 raise error.Abort( |
238 _("a bookmark cannot have the name of an existing branch")) | 238 _("a bookmark cannot have the name of an existing branch")) |
239 if len(mark) > 3 and not force: | 239 if len(mark) > 3 and not force: |
240 try: | 240 try: |
241 shadowhash = (mark in self._repo) | 241 shadowhash = scmutil.isrevsymbol(self._repo, mark) |
242 except error.LookupError: # ambiguous identifier | 242 except error.LookupError: # ambiguous identifier |
243 shadowhash = False | 243 shadowhash = False |
244 if shadowhash: | 244 if shadowhash: |
245 self._repo.ui.warn( | 245 self._repo.ui.warn( |
246 _("bookmark %s matches a changeset hash\n" | 246 _("bookmark %s matches a changeset hash\n" |