本文整理汇总了Python中mercurial.templater.parsestring函数的典型用法代码示例。如果您正苦于以下问题:Python parsestring函数的具体用法?Python parsestring怎么用?Python parsestring使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parsestring函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, ui, repo, hooktype):
self.ui = ui
cfg = self.ui.config('notify', 'config')
if cfg:
self.ui.readconfig(cfg, sections=['usersubs', 'reposubs'])
self.repo = repo
self.stripcount = int(self.ui.config('notify', 'strip', 0))
self.root = self.strip(self.repo.root)
self.domain = self.ui.config('notify', 'domain')
self.mbox = self.ui.config('notify', 'mbox')
self.test = self.ui.configbool('notify', 'test', True)
self.charsets = mail._charsets(self.ui)
self.subs = self.subscribers()
self.merge = self.ui.configbool('notify', 'merge', True)
mapfile = self.ui.config('notify', 'style')
template = (self.ui.config('notify', hooktype) or
self.ui.config('notify', 'template'))
self.t = cmdutil.changeset_templater(self.ui, self.repo,
False, None, mapfile, False)
if not mapfile and not template:
template = deftemplates.get(hooktype) or single_template
if template:
template = templater.parsestring(template, quoted=False)
self.t.use_template(template)
示例2: update
def update(self, bugid, ctx):
'''update bugzilla bug with reference to changeset.'''
def webroot(root):
'''strip leading prefix of repo root and turn into
url-safe path.'''
count = int(self.ui.config('bugzilla', 'strip', 0))
root = util.pconvert(root)
while count > 0:
c = root.find('/')
if c == -1:
break
root = root[c+1:]
count -= 1
return root
mapfile = self.ui.config('bugzilla', 'style')
tmpl = self.ui.config('bugzilla', 'template')
t = cmdutil.changeset_templater(self.ui, self.repo,
False, None, mapfile, False)
if not mapfile and not tmpl:
tmpl = _('changeset {node|short} in repo {root} refers '
'to bug {bug}.\ndetails:\n\t{desc|tabindent}')
if tmpl:
tmpl = templater.parsestring(tmpl, quoted=False)
t.use_template(tmpl)
self.ui.pushbuffer()
t.show(ctx, changes=ctx.changeset(),
bug=str(bugid),
hgweb=self.ui.config('web', 'baseurl'),
root=self.repo.root,
webroot=webroot(self.repo.root))
data = self.ui.popbuffer()
self.add_comment(bugid, data, util.email(ctx.user()))
示例3: __init__
def __init__(self, ui, repo):
self.ui = ui
self.repo = repo
self.ciaurl = self.ui.config('cia', 'url', 'http://cia.vc')
self.user = self.ui.config('cia', 'user')
self.project = self.ui.config('cia', 'project')
self.module = self.ui.config('cia', 'module')
self.diffstat = self.ui.configbool('cia', 'diffstat')
self.emailfrom = self.ui.config('email', 'from')
self.dryrun = self.ui.configbool('cia', 'test')
self.url = self.ui.config('web', 'baseurl')
# Default to -1 for backward compatibility
self.stripcount = int(self.ui.config('cia', 'strip', -1))
self.root = self.strip(self.repo.root)
style = self.ui.config('cia', 'style')
template = self.ui.config('cia', 'template')
if not template:
template = self.diffstat and self.dstemplate or self.deftemplate
template = templater.parsestring(template, quoted=False)
t = cmdutil.changeset_templater(self.ui, self.repo, False, None,
style, False)
t.use_template(template)
self.templater = t
示例4: maketemplater
def maketemplater(ui, repo, tmpl):
tmpl = templater.parsestring(tmpl, quoted=False)
try:
t = cmdutil.changeset_templater(ui, repo, False, None, tmpl,
None, False)
except SyntaxError, inst:
raise util.Abort(inst.args[0])
示例5: __init__
def __init__(self, ui, repo, inc, exc):
self.ui = ui
self.repo = repo
self.match = match.match(repo.root, '', [], inc, exc)
self.restrict = kwtools['hgcmd'] in restricted.split()
self.postcommit = False
kwmaps = self.ui.configitems('keywordmaps')
if kwmaps: # override default templates
self.templates = dict((k, templater.parsestring(v, False))
for k, v in kwmaps)
else:
self.templates = _defaultkwmaps(self.ui)
示例6: __init__
def __init__(self, ui, repo, inc, exc):
self.ui = ui
self.repo = repo
self.match = match.match(repo.root, '', [], inc, exc)
self.restrict = kwtools['hgcmd'] in restricted.split()
self.record = False
kwmaps = self.ui.configitems('keywordmaps')
if kwmaps: # override default templates
self.templates = dict((k, templater.parsestring(v, False))
for k, v in kwmaps)
else:
self.templates = _defaultkwmaps(self.ui)
templatefilters.filters.update({'utcdate': utcdate,
'svnisodate': svnisodate,
'svnutcdate': svnutcdate})
示例7: __init__
def __init__(self, ui, repo):
self.ui = ui
self.repo = repo
self.match = match.match(repo.root, '', [],
kwtools['inc'], kwtools['exc'])
self.restrict = kwtools['hgcmd'] in restricted.split()
kwmaps = self.ui.configitems('keywordmaps')
if kwmaps: # override default templates
self.templates = dict((k, templater.parsestring(v, False))
for k, v in kwmaps)
escaped = map(re.escape, self.templates.keys())
kwpat = r'\$(%s)(: [^$\n\r]*? )??\$' % '|'.join(escaped)
self.re_kw = re.compile(kwpat)
templatefilters.filters['utcdate'] = utcdate
self.ct = cmdutil.changeset_templater(self.ui, self.repo,
False, None, '', False)
示例8: __init__
def __init__(self, ui, repo, inc, exc):
self.ui = ui
self.repo = repo
self.matcher = util.matcher(repo.root, inc=inc, exc=exc)[1]
self.restrict = kwtools['hgcmd'] in restricted.split()
kwmaps = self.ui.configitems('keywordmaps')
if kwmaps: # override default templates
kwmaps = [(k, templater.parsestring(v, quoted=False))
for (k, v) in kwmaps]
self.templates = dict(kwmaps)
escaped = map(re.escape, self.templates.keys())
kwpat = r'\$(%s)(: [^$\n\r]*? )??\$' % '|'.join(escaped)
self.re_kw = re.compile(kwpat)
templatefilters.filters['utcdate'] = utcdate
self.ct = cmdutil.changeset_templater(self.ui, self.repo,
False, '', False)
示例9: __init__
def __init__(self, ui, repo, inc, exc):
self.ui = ui
self.repo = repo
self.match = match.match(repo.root, '', [], inc, exc)
self.restrict = kwtools['hgcmd'] in restricted.split()
self.record = False
kwmaps = self.ui.configitems('keywordmaps')
if kwmaps: # override default templates
self.templates = dict((k, templater.parsestring(v, False))
for k, v in kwmaps)
else:
self.templates = _defaultkwmaps(self.ui)
escaped = '|'.join(map(re.escape, self.templates.keys()))
self.re_kw = re.compile(r'\$(%s)\$' % escaped)
self.re_kwexp = re.compile(r'\$(%s): [^$\n\r]*? \$' % escaped)
templatefilters.filters.update({'utcdate': utcdate,
'svnisodate': svnisodate,
'svnutcdate': svnutcdate})
示例10: __init__
def __init__(self, ui, repo):
self.ui = ui
self.repo = repo
self.ciaurl = self.ui.config("cia", "url", "http://cia.vc")
self.user = self.ui.config("cia", "user")
self.project = self.ui.config("cia", "project")
self.module = self.ui.config("cia", "module")
self.diffstat = self.ui.configbool("cia", "diffstat")
self.emailfrom = self.ui.config("email", "from")
self.dryrun = self.ui.configbool("cia", "test")
self.url = self.ui.config("web", "baseurl")
style = self.ui.config("cia", "style")
template = self.ui.config("cia", "template")
if not template:
template = self.diffstat and self.dstemplate or self.deftemplate
template = templater.parsestring(template, quoted=False)
t = cmdutil.changeset_templater(self.ui, self.repo, False, None, style, False)
t.use_template(template)
self.templater = t
示例11: __init__
def __init__(self, ui, repo):
self.ui = ui
self.repo = repo
self.ciaurl = self.ui.config("cia", "url", "http://cia.vc")
self.user = self.ui.config("cia", "user")
self.project = self.ui.config("cia", "project")
self.module = self.ui.config("cia", "module")
self.diffstat = self.ui.configbool("cia", "diffstat")
self.emailfrom = self.ui.config("email", "from")
self.dryrun = self.ui.configbool("cia", "test")
self.url = self.ui.config("web", "baseurl")
# Default to -1 for backward compatibility
self.stripcount = int(self.ui.config("cia", "strip", -1))
self.root = self.strip(self.repo.root)
style = self.ui.config("cia", "style")
template = self.ui.config("cia", "template")
if not template:
template = self.diffstat and self.dstemplate or self.deftemplate
template = templater.parsestring(template, quoted=False)
t = cmdutil.changeset_templater(self.ui, self.repo, False, None, template, style, False)
self.templater = t