当前位置: 首页>>代码示例>>Python>>正文


Python extensions.wrapcommand函数代码示例

本文整理汇总了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
开发者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


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