Skip to content

Commit

Permalink
firefoxtree: automatically resolve firefox tree names
Browse files Browse the repository at this point in the history
  • Loading branch information
indygreg committed Jul 17, 2014
1 parent d0632c4 commit ce5f01e
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion hgext/firefoxtree/__init__.py
Expand Up @@ -25,7 +25,12 @@

import os

from mercurial import cmdutil
from mercurial import (
cmdutil,
extensions,
hg,
)
from mercurial.error import RepoError
from mercurial.i18n import _

OUR_DIR = os.path.dirname(__file__)
Expand All @@ -52,6 +57,19 @@
'\n',
])

# Wrap repo lookup to automagically resolve tree names to URIs.
def peerorrepo(orig, ui, path, *args, **kwargs):
try:
return orig(ui, path, *args, **kwargs)
except RepoError:
tree, uri = resolve_trees_to_uris([path])[0]
if not uri:
raise

return orig(ui, uri, *args, **kwargs)

extensions.wrapfunction(hg, '_peerorrepo', peerorrepo)

@command('fxheads', [
('T', 'template', shorttemplate,
_('display with template'), _('TEMPLATE')),
Expand Down

0 comments on commit ce5f01e

Please sign in to comment.