本文整理汇总了Python中mercurial.extensions.wrapcommand函数的典型用法代码示例。如果您正苦于以下问题:Python wrapcommand函数的具体用法?Python wrapcommand怎么用?Python wrapcommand使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wrapcommand函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: uisetup
def uisetup(ui):
"""insert command wrappers for a bunch of commands"""
docvals = {'extension': 'hgsubversion'}
for cmd, (generic, target, fixdoc, ppopts, opts) in wrapcmds.iteritems():
if fixdoc and wrappers.generic.__doc__:
docvals['command'] = cmd
docvals['Command'] = cmd.capitalize()
docvals['target'] = target
doc = wrappers.generic.__doc__.strip() % docvals
fn = getattr(commands, cmd)
fn.__doc__ = fn.__doc__.rstrip() + '\n\n ' + doc
wrapped = generic and wrappers.generic or getattr(wrappers, cmd)
entry = extensions.wrapcommand(commands.table, cmd, wrapped)
if ppopts:
entry[1].extend(svnopts)
if opts:
entry[1].extend(opts)
try:
rebase = extensions.find('rebase')
if not rebase:
return
entry = extensions.wrapcommand(rebase.cmdtable, 'rebase', wrappers.rebase)
entry[1].append(('', 'svn', None, 'automatic svn rebase'))
except:
pass
示例2: extsetup
def extsetup(ui):
try:
from mercurial import wireproto
except:
from mercurial import wireprotov1server as wireproto
from mercurial import extensions
try:
extensions.wrapfunction(wireproto, '_capabilities', _capabilities)
except AttributeError:
extensions.wrapcommand(
wireproto.commands, 'capabilities', capabilities)
def wireprotocommand(name, args='', permission='push'):
if hasattr(wireproto, 'wireprotocommand'):
try:
return wireproto.wireprotocommand(name, args, permission)
except TypeError:
if hasattr(wireproto, 'permissions'):
wireproto.permissions[name] = permission
return wireproto.wireprotocommand(name, args)
def register(func):
commands = wireproto.commands
assert name not in commands
commands[name] = (func, args)
return register
wireprotocommand('cinnabarclone', permission='pull')(cinnabar)
示例3: wrapstrip
def wrapstrip(loaded):
try:
stripmod = extensions.find('strip')
except KeyError:
pass
else:
extensions.wrapcommand(stripmod.cmdtable, 'strip', safestrip)
示例4: extsetup
def extsetup(ui):
extensions.wrapcommand(commands.table, 'init', initcommand)
# Configure null handler for kafka.* loggers to prevent "No handlers could
# be found" messages from creeping into output.
kafkalogger = logging.getLogger('kafka')
if not kafkalogger.handlers:
kafkalogger.addHandler(logging.NullHandler())
示例5: wrapshelve
def wrapshelve(loaded=False):
try:
shelvemod = extensions.find('shelve')
extensions.wrapcommand(shelvemod.cmdtable, 'shelve',
_bypassdirsync)
extensions.wrapcommand(shelvemod.cmdtable, 'unshelve',
_bypassdirsync)
except KeyError:
pass
示例6: _setupclone
def _setupclone(ui):
entry = commands.table['^clone']
entry[1].append(('', 'enable-profile', [],
'enable a sparse profile'))
entry[1].append(('', 'include', [],
'include sparse pattern'))
entry[1].append(('', 'exclude', [],
'exclude sparse pattern'))
extensions.wrapcommand(commands.table, 'clone', _clonesparsecmd)
示例7: extsetup
def extsetup(ui):
# Ensure required extensions are loaded.
for ext in ('purge', 'share'):
try:
extensions.find(ext)
except KeyError:
extensions.load(ui, ext, None)
purgemod = extensions.find('purge')
extensions.wrapcommand(purgemod.cmdtable, 'purge', purgewrapper)
示例8: uisetup
def uisetup(ui):
extensions.wrapfunction(repair, 'strip', strip)
extensions.wrapcommand(commands.table, 'update', tasksupdate)
extensions.wrapcommand(commands.table, 'log', taskslog)
extensions.wrapcommand(commands.table, 'export', tasksexport)
entry = extensions.wrapcommand(commands.table, 'push', taskspush)
entry[1].append(('', 'completed-tasks', None,
_('push all heads that have completed tasks only')))
entry[1].append(('', 'all-tasks', None,
_('push all heads including those with incomplete tasks')))
try:
transplant = extensions.find('transplant')
if transplant:
entry = extensions.wrapcommand(transplant.cmdtable, 'transplant',
taskstransplant)
entry[1].append(('t', 'task', '',
_('transplant all changesets in task TASK')))
except:
pass
try:
patchbomb = extensions.find('patchbomb')
if patchbomb:
entry = extensions.wrapcommand(patchbomb.cmdtable, 'email',
tasksemail)
entry[1].append(('t', 'task', '',
_('email all changesets in task TASK')))
except:
pass
示例9: extsetup
def extsetup(ui):
"""insert command wrappers for a bunch of commands"""
docvals = {"extension": "hgsubversion"}
for cmd, (generic, target, fixdoc, ppopts, opts) in wrapcmds.iteritems():
if fixdoc and wrappers.generic.__doc__:
docvals["command"] = cmd
docvals["Command"] = cmd.capitalize()
docvals["target"] = target
doc = wrappers.generic.__doc__.strip() % docvals
fn = getattr(commands, cmd)
fn.__doc__ = fn.__doc__.rstrip() + "\n\n " + doc
wrapped = generic and wrappers.generic or getattr(wrappers, cmd)
entry = extensions.wrapcommand(commands.table, cmd, wrapped)
if ppopts:
entry[1].extend(svnopts)
if opts:
entry[1].extend(opts)
try:
rebase = extensions.find("rebase")
if not rebase:
return
entry = extensions.wrapcommand(rebase.cmdtable, "rebase", wrappers.rebase)
entry[1].append(("", "svn", None, "automatic svn rebase"))
except:
pass
if not hgutil.safehasattr(localrepo.localrepository, "push"):
# Mercurial >= 3.2
extensions.wrapfunction(exchange, "push", wrappers.exchangepush)
if not hgutil.safehasattr(localrepo.localrepository, "pull"):
# Mercurial >= 3.2
extensions.wrapfunction(exchange, "pull", wrappers.exchangepull)
helpdir = os.path.join(os.path.dirname(__file__), "help")
entries = (
(
["subversion"],
"Working with Subversion Repositories",
lambda: open(os.path.join(helpdir, "subversion.rst")).read(),
),
)
help.helptable.extend(entries)
templatekw.keywords.update(util.templatekeywords)
revset.symbols.update(util.revsets)
subrepo.types["hgsubversion"] = svnexternals.svnsubrepo
示例10: extsetup
def extsetup():
"""insert command wrappers for a bunch of commands"""
# add the ui argument to this function once we drop support for 1.3
docvals = {'extension': 'hgsubversion'}
for cmd, (generic, target, fixdoc, ppopts, opts) in wrapcmds.iteritems():
if fixdoc and wrappers.generic.__doc__:
docvals['command'] = cmd
docvals['Command'] = cmd.capitalize()
docvals['target'] = target
doc = wrappers.generic.__doc__.strip() % docvals
fn = getattr(commands, cmd)
fn.__doc__ = fn.__doc__.rstrip() + '\n\n ' + doc
wrapped = generic and wrappers.generic or getattr(wrappers, cmd)
entry = extensions.wrapcommand(commands.table, cmd, wrapped)
if ppopts:
entry[1].extend(svnopts)
if opts:
entry[1].extend(opts)
try:
rebase = extensions.find('rebase')
if not rebase:
return
entry = extensions.wrapcommand(rebase.cmdtable, 'rebase', wrappers.rebase)
entry[1].append(('', 'svn', None, 'automatic svn rebase'))
except:
pass
helpdir = os.path.join(os.path.dirname(__file__), 'help')
entries = (
(['subversion'],
"Working with Subversion Repositories",
lambda: open(os.path.join(helpdir, 'subversion.rst')).read()),
)
# in 1.6 and earler the help table is a tuple
if getattr(help.helptable, 'extend', None):
help.helptable.extend(entries)
else:
help.helptable = help.helptable + entries
if templatekw:
templatekw.keywords.update(util.templatekeywords)
if revset:
revset.symbols.update(util.revsets)
if subrepo:
subrepo.types['hgsubversion'] = svnexternals.svnsubrepo
示例11: extsetup
def extsetup(ui):
"""insert command wrappers for a bunch of commands"""
docvals = {'extension': 'hgsubversion'}
for cmd, (generic, target, fixdoc, ppopts, opts) in wrapcmds.iteritems():
if fixdoc and wrappers.generic.__doc__:
docvals['command'] = cmd
docvals['Command'] = cmd.capitalize()
docvals['target'] = target
doc = wrappers.generic.__doc__.strip() % docvals
fn = getattr(commands, cmd)
fn.__doc__ = fn.__doc__.rstrip() + '\n\n ' + doc
wrapped = generic and wrappers.generic or getattr(wrappers, cmd)
entry = extensions.wrapcommand(commands.table, cmd, wrapped)
if ppopts:
entry[1].extend(svnopts)
if opts:
entry[1].extend(opts)
try:
rebase = extensions.find('rebase')
if not rebase:
return
entry = extensions.wrapcommand(rebase.cmdtable, 'rebase', wrappers.rebase)
entry[1].append(('', 'svn', None, 'automatic svn rebase'))
except:
pass
if not hgutil.safehasattr(localrepo.localrepository, 'push'):
# Mercurial >= 3.2
extensions.wrapfunction(exchange, 'push', wrappers.exchangepush)
if not hgutil.safehasattr(localrepo.localrepository, 'pull'):
# Mercurial >= 3.2
extensions.wrapfunction(exchange, 'pull', wrappers.exchangepull)
helpdir = os.path.join(os.path.dirname(__file__), 'help')
entries = (
(['subversion'],
"Working with Subversion Repositories",
# Mercurial >= 3.6: doc(ui)
lambda *args: open(os.path.join(helpdir, 'subversion.rst')).read()),
)
help.helptable.extend(entries)
templatekw.keywords.update(util.templatekeywords)
revset.symbols.update(util.revsets)
subrepo.types['hgsubversion'] = svnexternals.svnsubrepo
示例12: _setupadd
def _setupadd(ui):
entry = commands.table['^add']
entry[1].append(('s', 'sparse', None,
'also include directories of added files in sparse config'))
def _add(orig, ui, repo, *pats, **opts):
if opts.get('sparse'):
dirs = set()
for pat in pats:
dirname, basename = util.split(pat)
dirs.add(dirname)
_config(ui, repo, list(dirs), opts, include=True)
return orig(ui, repo, *pats, **opts)
extensions.wrapcommand(commands.table, 'add', _add)
示例13: extsetup
def extsetup(ui):
global bz_available
try:
extensions.find('bzexport')
bz_available = True
except KeyError:
pass
extensions.wrapcommand(commands.table, 'pull', pullexpand)
extensions.wrapfunction(exchange, 'pull', pull)
extensions.wrapfunction(exchange, 'push', push)
revset.symbols['bug'] = revset_bug
revset.symbols['dontbuild'] = revset_dontbuild
revset.symbols['me'] = revset_me
revset.symbols['nobug'] = revset_nobug
revset.symbols['reviewer'] = revset_reviewer
revset.symbols['reviewed'] = revset_reviewed
if not ui.configbool('mozext', 'disable_local_database'):
revset.symbols['pushhead'] = revset_pushhead
revset.symbols['tree'] = revset_tree
revset.symbols['firstpushdate'] = revset_firstpushdate
revset.symbols['firstpushtree'] = revset_firstpushtree
revset.symbols['pushdate'] = revset_pushdate
templatekw.keywords['bug'] = template_bug
templatekw.keywords['bugs'] = template_bugs
templatekw.keywords['reviewer'] = template_reviewer
templatekw.keywords['reviewers'] = template_reviewers
if not ui.configbool('mozext', 'disable_local_database'):
templatekw.keywords['firstrelease'] = template_firstrelease
templatekw.keywords['firstbeta'] = template_firstbeta
templatekw.keywords['firstaurora'] = template_firstaurora
templatekw.keywords['firstnightly'] = template_firstnightly
templatekw.keywords['auroradate'] = template_auroradate
templatekw.keywords['nightlydate'] = template_nightlydate
templatekw.keywords['firstpushuser'] = template_firstpushuser
templatekw.keywords['firstpushtree'] = template_firstpushtree
templatekw.keywords['firstpushtreeherder'] = template_firstpushtreeherder
templatekw.keywords['firstpushdate'] = template_firstpushdate
templatekw.keywords['pushdates'] = template_pushdates
templatekw.keywords['pushheaddates'] = template_pushheaddates
templatekw.keywords['trees'] = template_trees
templatekw.keywords['reltrees'] = template_reltrees
templater.funcs['dates'] = template_dates
示例14: extsetup
def extsetup(ui):
extensions.wrapfunction(webutil, 'changesetentry', changesetentry)
extensions.wrapfunction(webutil, 'changelistentry', changelistentry)
extensions.wrapfunction(bookmarks, 'updatefromremote', bmupdatefromremote)
revset.symbols['reviewer'] = revset_reviewer
revset.safesymbols.add('reviewer')
entry = extensions.wrapcommand(commands.table, 'serve', servehgmo)
entry[1].append(('', 'hgmo', False,
'Run a server configured like hg.mozilla.org'))
wrapper = ui.config('hgmo', 'mozbuildinfowrapper')
if wrapper:
if '"' in wrapper or "'" in wrapper:
raise util.Abort('quotes may not appear in hgmo.mozbuildinfowrapper')
setattr(webcommands, 'mozbuildinfo', mozbuildinfowebcommand)
webcommands.__all__.append('mozbuildinfo')
setattr(webcommands, 'info', infowebcommand)
webcommands.__all__.append('info')
setattr(webcommands, 'headdivergence', headdivergencewebcommand)
webcommands.__all__.append('headdivergence')
示例15: uisetup
def uisetup(ui):
extensions.wrapfunction(context.workingfilectx, 'data', wfctx_data)
extensions.wrapfunction(context.workingfilectx, 'flags', wfctx_flags)
extensions.wrapfunction(context.workingfilectx, 'renamed', wfctx_renamed)
entry = extensions.wrapcommand(commands.table, 'commit', partialcommit)
entry[1].append(('', 'partials', '',
'selected patch chunks (internal use only)'))