Mercurial > hg
changeset 23560:aead63705504
changectx: use names api to simplify and extend node lookup
Previously, changectx had to know about each type of name (bookmark, tag, etc.)
to look up. Now, we use repo.namenodes to simplify (and extend) this.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Thu, 16 Oct 2014 23:27:54 -0700 |
parents | 3b3a962e3677 |
children | 3c2419e07df5 |
files | mercurial/context.py |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/context.py Fri Oct 17 15:28:40 2014 -0700 +++ b/mercurial/context.py Thu Oct 16 23:27:54 2014 -0700 @@ -407,10 +407,14 @@ except (TypeError, LookupError): pass - if changeid in repo._bookmarks: - self._node = repo._bookmarks[changeid] + # lookup bookmarks through the name interface + try: + self._node = repo.names.singlenode(changeid) self._rev = repo.changelog.rev(self._node) return + except KeyError: + pass + if changeid in repo._tagscache.tags: self._node = repo._tagscache.tags[changeid] self._rev = repo.changelog.rev(self._node)