本文整理汇总了Python中git_handler.GitHandler.map_git_get方法的典型用法代码示例。如果您正苦于以下问题:Python GitHandler.map_git_get方法的具体用法?Python GitHandler.map_git_get怎么用?Python GitHandler.map_git_get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类git_handler.GitHandler
的用法示例。
在下文中一共展示了GitHandler.map_git_get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: write
# 需要导入模块: from git_handler import GitHandler [as 别名]
# 或者: from git_handler.GitHandler import map_git_get [as 别名]
def write(self, *args, **kwargs):
super(ext_ui, self).write(*args, **kwargs)
# Changesets are printed twice in the current hg code, always with label log.changeset
if kwargs.has_key('label') and kwargs['label'] == 'log.changeset' and len(args) and cached_repo:
global changeset_re
global cached_git
if not changeset_re:
changeset_re = re.compile('(\d+):\w+(\s*)$')
match = changeset_re.search(args[0])
if match:
# Parse out from the changeset string: The numeric local rev, and the line terminator
# (So that we know if we need to print the git revision with a newline or not)
rev, terminator = match.group(1,2)
try: # Works in Mercurial 1.9.x
from mercurial.templatefilters import hexfilter, short
except: # Works in Mercurial 1.8.x
from mercurial.templatefilters import filters
hexfilter = filters["hex"]
short = filters["short"]
hgsha = cached_repo.lookup(int(rev)) # Ints are efficient on lookup
if (hgsha):
hgsha = hexfilter(hgsha)
if not cached_git:
cached_git = GitHandler(cached_repo, self)
gitsha = cached_git.map_git_get(hgsha)
else: # Currently this case is hit when you do hg outgoing. I'm not sure why.
gitsha = None
if gitsha:
if terminator == '\n': # hg log, etc
output = _("git-rev: %s\n")
else: # hg sum
output = "git:%s "
super(ext_ui, self).write(output % (short(gitsha)), label='log.gitchangeset')
示例2: revset_fromgit
# 需要导入模块: from git_handler import GitHandler [as 别名]
# 或者: from git_handler.GitHandler import map_git_get [as 别名]
def revset_fromgit(repo, subset, x):
'''``fromgit()``
Select changesets that originate from Git.
'''
args = revset.getargs(x, 0, 0, "fromgit takes no arguments")
git = GitHandler(repo, repo.ui)
return [r for r in subset if git.map_git_get(repo[r].hex()) is not None]
示例3: gitnodekw
# 需要导入模块: from git_handler import GitHandler [as 别名]
# 或者: from git_handler.GitHandler import map_git_get [as 别名]
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
示例4: gsummary
# 需要导入模块: from git_handler import GitHandler [as 别名]
# 或者: from git_handler.GitHandler import map_git_get [as 别名]
def gsummary(ui, repo):
ctx = repo[None]
parents = ctx.parents()
git = GitHandler(repo, ui)
for p in parents:
repo.ui.status(_('git-rev: %s\n') % git.map_git_get(p.hex()))