Mercurial > hg-git
diff hggit/__init__.py @ 482:00d591868a2f
templatekw: add support for gitnode template keyword
author | David M. Carr <david@carrclan.us> |
---|---|
date | Wed, 22 Aug 2012 23:39:45 -0400 |
parents | 9df1741f3977 |
children | d2caea269670 |
line wrap: on
line diff
--- a/hggit/__init__.py Wed Aug 22 23:39:45 2012 -0400 +++ b/hggit/__init__.py Wed Aug 22 23:39:45 2012 -0400 @@ -28,6 +28,7 @@ from mercurial import help from mercurial import hg from mercurial import localrepo +from mercurial import templatekw from mercurial import util as hgutil from mercurial import url from mercurial.i18n import _ @@ -92,6 +93,7 @@ extensions.wrapfunction(hg, 'addbranchrevs', safebranchrevs) def extsetup(): + templatekw.keywords.update({'gitnode': gitnodekw}) helpdir = os.path.join(os.path.dirname(__file__), 'help') entry = (['git'], _("Working with Git Repositories"), lambda: open(os.path.join(helpdir, 'git.rst')).read()) @@ -175,6 +177,16 @@ # 1.7+ pass +def gitnodekw(**args): + """:gitnode: String. The Git changeset identification hash, as a 40 hexadecimal digit string.""" + node = args['ctx'] + repo = args['repo'] + git = GitHandler(repo, repo.ui) + gitnode = git.map_git_get(node.hex()) + if gitnode is None: + gitnode = '' + return gitnode + cmdtable = { "gimport": (gimport, [], _('hg gimport')),