• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python extensions.wrapcommand函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mercurial.extensions.wrapcommand函数的典型用法代码示例。如果您正苦于以下问题:Python wrapcommand函数的具体用法?Python wrapcommand怎么用?Python wrapcommand使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wrapcommand函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
开发者ID:chaptastic,项目名称:config_files,代码行数:28,代码来源:__init__.py


示例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)
开发者ID:glandium,项目名称:git-cinnabar,代码行数:30,代码来源:cinnabarclone.py


示例3: wrapstrip

def wrapstrip(loaded):
    try:
        stripmod = extensions.find('strip')
    except KeyError:
        pass
    else:
        extensions.wrapcommand(stripmod.cmdtable, 'strip', safestrip)
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:7,代码来源:prune.py


示例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())
开发者ID:MikeLing,项目名称:version-control-tools,代码行数:8,代码来源:hgext.py


示例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
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:9,代码来源:dirsync.py


示例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)
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:9,代码来源:sparse.py


示例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)
开发者ID:emilio,项目名称:gecko-dev,代码行数:10,代码来源:__init__.py


示例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
开发者ID:Evanlec,项目名称:config,代码行数:29,代码来源:tasks.py


示例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
开发者ID:ZanderZhang,项目名称:Andriod-Learning,代码行数:54,代码来源:__init__.py


示例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
开发者ID:TerminalSpirit,项目名称:dotfiles,代码行数:53,代码来源:__init__.py


示例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
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:52,代码来源:__init__.py


示例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)
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:15,代码来源:sparse.py


示例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
开发者ID:simar7,项目名称:git-version-control-tools-clone,代码行数:48,代码来源:__init__.py


示例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')
开发者ID:pombredanne,项目名称:version-control-tools,代码行数:25,代码来源:__init__.py


示例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)'))
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:7,代码来源:partialcommit.py


示例16: uisetup

def uisetup(ui):
    'Replace pull with a decorator to provide --rebase option'
    entry = extensions.wrapcommand(commands.table, 'pull', pullrebase)
    entry[1].append(('', 'rebase', None,
                     _("rebase working directory to branch head")))
    entry[1].append(('t', 'tool', '',
                     _("specify merge tool for rebase")))
开发者ID:rybesh,项目名称:mysite-lib,代码行数:7,代码来源:rebase.py


示例17: extsetup

def extsetup(ui):
    entry = wrapcommand(commands.table, 'push', _push)
    try:
        # Don't add the 'to' arg if it already exists
        extensions.find('remotenames')
    except KeyError:
        entry[1].append(('', 'to', '', _('server revision to rebase onto')))

    partorder = exchange.b2partsgenorder
    partorder.insert(partorder.index('changeset'),
                     partorder.pop(partorder.index(rebaseparttype)))

    partorder.insert(0, partorder.pop(partorder.index(commonheadsparttype)))

    wrapfunction(discovery, 'checkheads', _checkheads)
    # we want to disable the heads check because in pushrebase repos, we
    # expect the heads to change during the push and we should not abort.

    # The check heads functions are used to verify that the heads haven't
    # changed since the client did the initial discovery. Pushrebase is meant
    # to allow concurrent pushes, so the heads may have very well changed.
    # So let's not do this check.
    wrapfunction(exchange, 'check_heads', _exchangecheckheads)
    wrapfunction(exchange, '_pushb2ctxcheckheads', _skipcheckheads)

    origpushkeyhandler = bundle2.parthandlermapping['pushkey']
    newpushkeyhandler = lambda *args, **kwargs: \
        bundle2pushkey(origpushkeyhandler, *args, **kwargs)
    newpushkeyhandler.params = origpushkeyhandler.params
    bundle2.parthandlermapping['pushkey'] = newpushkeyhandler
    bundle2.parthandlermapping['b2x:pushkey'] = newpushkeyhandler

    wrapfunction(exchange, 'unbundle', unbundle)

    wrapfunction(hg, '_peerorrepo', _peerorrepo)
开发者ID:kilikkuo,项目名称:version-control-tools,代码行数:35,代码来源:__init__.py


示例18: uisetup

def uisetup(ui):
    '''Replaces pull with a decorator to provide --rebaseif option'''

    entry = extensions.wrapcommand(commands.table, 'pull', pullrebaseif)
    entry[1].append(('', 'rebaseif', None,
                     _('rebase or merge working directory to branch head'))
)
开发者ID:SeanTAllen,项目名称:dotfiles,代码行数:7,代码来源:rebaseif.py


示例19: _wrapcmd

def _wrapcmd(ui, cmd, table, wrapfn):
    '''wrap the command'''
    def graph(orig, *args, **kwargs):
        if kwargs['graph']:
            return wrapfn(*args, **kwargs)
        return orig(*args, **kwargs)
    entry = extensions.wrapcommand(table, cmd, graph)
    entry[1].append(('G', 'graph', None, _("show the revision DAG")))
开发者ID:ThissDJ,项目名称:designhub,代码行数:8,代码来源:graphlog.py


示例20: has_automv

 def has_automv(loaded):
     if not loaded:
         return
     automv = extensions.find('automv')
     entry = extensions.wrapcommand(cmdtable, 'amend', automv.mvcheck)
     entry[1].append(
         ('', 'no-move-detection', None,
          _('disable automatic file move detection')))
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:8,代码来源:__init__.py



注:本文中的mercurial.extensions.wrapcommand函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python extensions.wrapfunction函数代码示例发布时间:2022-05-27
下一篇:
Python extensions.find函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap