예제 #1
0
파일: tasks.py 프로젝트: Evanlec/config
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
예제 #2
0
def uisetup(ui):
    if ui.plain():
        return

    try:
        extensions.find('color')
    except KeyError:
        ui.warn(_("warning: 'diff-highlight' requires 'color' extension "
                  "to be enabled, but not\n"))
        return

    if not isinstance(ui, colorui):
        colorui.__bases__ = (ui.__class__,)
        ui.__class__ = colorui

    def colorconfig(orig, *args, **kwargs):
        ret = orig(*args, **kwargs)

        styles = color._styles
        if INSERT_EMPH not in styles:
            styles[INSERT_EMPH] = styles[INSERT_NORM] + ' inverse'

        if DELETE_EMPH not in styles:
            styles[DELETE_EMPH] = styles[DELETE_NORM] + ' inverse'

        return ret

    extensions.wrapfunction(color, 'configstyles', colorconfig)
예제 #3
0
파일: prompt.py 프로젝트: EdJoJob/dots
    def _patch(m):
        g = m.groups()

        try:
            extensions.find("mq")
        except KeyError:
            return ""

        q = repo.mq

        if _get_filter("quiet", g) and not len(q.series):
            return ""

        if _get_filter("topindex", g):
            if len(q.applied):
                out = str(len(q.applied) - 1)
            else:
                out = ""
        elif _get_filter("applied", g):
            out = str(len(q.applied))
        elif _get_filter("unapplied", g):
            out = str(len(q.unapplied(repo)))
        elif _get_filter("count", g):
            out = str(len(q.series))
        else:
            out = q.applied[-1].name if q.applied else ""

        return _with_groups(g, out) if out else ""
예제 #4
0
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)
예제 #5
0
def extsetup(ui):
    if _fbsparseexists(ui):
        cmdtable.clear()
        return
    _setupclone(ui)
    _setuplog(ui)
    _setupadd(ui)
    _setupdirstate(ui)
    _setupdiff(ui)
    # if fsmonitor is enabled, tell it to use our hash function
    try:
        fsmonitor = extensions.find('fsmonitor')
        def _hashignore(orig, ignore):
            return _hashmatcher(ignore)
        extensions.wrapfunction(fsmonitor, '_hashignore', _hashignore)
    except KeyError:
        pass
    # do the same for hgwatchman, old name
    try:
        hgwatchman = extensions.find('hgwatchman')
        def _hashignore(orig, ignore):
            return _hashmatcher(ignore)
        extensions.wrapfunction(hgwatchman, '_hashignore', _hashignore)
    except KeyError:
        pass
예제 #6
0
파일: prompt.py 프로젝트: billxu09/dotfiles
    def _patch(m):
        g = m.groups()

        try:
            extensions.find('mq')
        except KeyError:
            return ''

        q = repo.mq

        if _get_filter('quiet', g) and not len(q.series):
            return ''

        if _get_filter('topindex', g):
            if len(q.applied):
                out = str(len(q.applied) - 1)
            else:
                out = ''
        elif _get_filter('applied', g):
            out = str(len(q.applied))
        elif _get_filter('unapplied', g):
            out = str(len(q.unapplied(repo)))
        elif _get_filter('count', g):
            out = str(len(q.series))
        else:
            out = q.applied[-1].name if q.applied else ''

        return _with_groups(g, out) if out else ''
예제 #7
0
파일: eol.py 프로젝트: michalliu/MyCygwin
def extsetup(ui):
    try:
        extensions.find('win32text')
        ui.warn(_("the eol extension is incompatible with the "
                  "win32text extension\n"))
    except KeyError:
        pass
예제 #8
0
def extsetup(ui):
    try:
        extensions.find('win32text')
        ui.warn(_("the eol extension is incompatible with the "
                  "win32text extension\n"))
    except KeyError:
        pass
예제 #9
0
def _deleteunreachable(repo, ctx):
    """Deletes all ancestor and descendant commits of the given revision that
    aren't reachable from another bookmark.
    """
    keepheads = "bookmark() + ."
    try:
        extensions.find('remotenames')
        keepheads += " + remotenames()"
    except KeyError:
        pass
    hiderevs = repo.revs('::%s - ::(%r)', ctx.rev(), keepheads)
    if hiderevs:
        lock = None
        try:
            lock = repo.lock()
            if _isobsstoreenabled(repo):
                markers = []
                for rev in hiderevs:
                    markers.append((repo[rev], ()))
                obsolete.createmarkers(repo, markers)
                repo.ui.status(_("%d changesets pruned\n") % len(hiderevs))
            else:
                repair.strip(repo.ui, repo,
                             [repo.changelog.node(r) for r in hiderevs])
        finally:
            lockmod.release(lock)
예제 #10
0
파일: eol.py 프로젝트: helloandre/cr48
def extsetup(ui):
    try:
        extensions.find('win32text')
        raise util.Abort(_("the eol extension is incompatible with the "
                           "win32text extension"))
    except KeyError:
        pass
예제 #11
0
def extsetup(ui):
    try:
        extensions.find('win32text')
        raise util.Abort(
            _("the eol extension is incompatible with the "
              "win32text extension"))
    except KeyError:
        pass
예제 #12
0
def unamend(ui, repo, **opts):
    """undo the amend operation on a current changeset

    This command will roll back to the previous version of a changeset,
    leaving working directory in state in which it was before running
    `hg amend` (e.g. files modified as part of an amend will be
    marked as modified `hg status`)"""
    try:
        extensions.find('inhibit')
    except KeyError:
        hint = _("please add inhibit to the list of enabled extensions")
        e = _("unamend requires inhibit extension to be enabled")
        raise error.Abort(e, hint=hint)

    unfi = repo.unfiltered()

    # identify the commit from which to unamend
    curctx = repo['.']

    # identify the commit to which to unamend
    markers = list(predecessormarkers(curctx))
    if len(markers) != 1:
        e = _("changeset must have one predecessor, found %i predecessors")
        raise error.Abort(e % len(markers))

    prednode = markers[0].prednode()
    predctx = unfi[prednode]

    if curctx.children():
        raise error.Abort(_("cannot unamend in the middle of a stack"))

    with repo.wlock(), repo.lock():
        ctxbookmarks = curctx.bookmarks()
        changedfiles = []
        wctx = repo[None]
        wm = wctx.manifest()
        cm = predctx.manifest()
        dirstate = repo.dirstate
        diff = cm.diff(wm)
        changedfiles.extend(diff.iterkeys())

        tr = repo.transaction('unamend')
        with dirstate.parentchange():
            dirstate.rebuild(prednode, cm, changedfiles)
            # we want added and removed files to be shown
            # properly, not with ? and ! prefixes
            for filename, data in diff.iteritems():
                if data[0][0] is None:
                    dirstate.add(filename)
                if data[1][0] is None:
                    dirstate.remove(filename)
        changes = []
        for book in ctxbookmarks:
            changes.append((book, prednode))
        repo._bookmarks.applychanges(repo, tr, changes)
        obsolete.createmarkers(repo, [(curctx, (predctx,))])
        tr.close()
예제 #13
0
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)
예제 #14
0
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)
예제 #15
0
def _checkobsrebasewrapper(orig, repo, ui, *args):
    overrides = {}
    try:
        extensions.find('inhibit')
        # if inhibit is enabled, allow divergence
        overrides[('experimental', 'evolution.allowdivergence')] = True
    except KeyError:
        pass
    with repo.ui.configoverride(overrides, 'tweakdefaults'):
        orig(repo, ui, *args)
예제 #16
0
def uisetup(ui):
    try:
        extensions.find('mq')
        cmdtable.update(_mqcmdtable)
    except KeyError:
        pass

    # ignore --no-commit on hg<3.7 (ce76c4d2b85c)
    _aliases, entry = cmdutil.findcmd('backout', commands.table)
    if not any(op for op in entry[1] if op[1] == 'no-commit'):
        entry[1].append(('', 'no-commit', None, '(EXPERIMENTAL)'))
예제 #17
0
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

    # rebase part must go before the changeset part, so we can mark the
    # changeset part as done first.
    partorder.insert(partorder.index('changeset'),
                     partorder.pop(partorder.index(rebaseparttype)))

    # rebase pack part must go before rebase part so it can write to the pack to
    # disk for reading.
    partorder.insert(partorder.index(rebaseparttype),
                     partorder.pop(partorder.index(rebasepackparttype)))

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

    if 'check-bookmarks' in partorder:
        # check-bookmarks is intended for non-pushrebase scenarios when
        # we can't push to a bookmark if it's changed in the meantime
        partorder.pop(partorder.index('check-bookmarks'))

    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

    origphaseheadshandler = bundle2.parthandlermapping['phase-heads']
    newphaseheadshandler = lambda *args, **kwargs: \
        bundle2phaseheads(origphaseheadshandler, *args, **kwargs)
    newphaseheadshandler.params = origphaseheadshandler.params
    bundle2.parthandlermapping['phase-heads'] = newphaseheadshandler

    wrapfunction(exchange, 'unbundle', unbundle)

    wrapfunction(hg, '_peerorrepo', _peerorrepo)
예제 #18
0
    def _patches(m):
        g = m.groups()

        try:
            extensions.find('mq')
        except KeyError:
            return ''

        join_filter = _get_filter('join', g)
        join_filter_arg = _get_filter_arg(join_filter)
        if join_filter:
            sep = join_filter_arg 
        else:
            sep = ' -> '

        patches = repo.mq.series
        applied = [p.name for p in repo.mq.applied]
        unapplied = filter(lambda p: p not in applied, patches)

        if _get_filter('hide_applied', g):
            patches = filter(lambda p: p not in applied, patches)
        if _get_filter('hide_unapplied', g):
            patches = filter(lambda p: p not in unapplied, patches)

        if _get_filter('reverse', g):
            patches = reversed(patches)

        pre_applied_filter = _get_filter('pre_applied', g)
        pre_applied_filter_arg = _get_filter_arg(pre_applied_filter)
        post_applied_filter = _get_filter('post_applied', g)
        post_applied_filter_arg = _get_filter_arg(post_applied_filter)

        pre_unapplied_filter = _get_filter('pre_unapplied', g)
        pre_unapplied_filter_arg = _get_filter_arg(pre_unapplied_filter)
        post_unapplied_filter = _get_filter('post_unapplied', g)
        post_unapplied_filter_arg = _get_filter_arg(post_unapplied_filter)

        for n, patch in enumerate(patches):
            if patch in applied:
                if pre_applied_filter:
                    patches[n] = pre_applied_filter_arg + patches[n]
                if post_applied_filter:
                    patches[n] = patches[n] + post_applied_filter_arg
            elif patch in unapplied:
                if pre_unapplied_filter:
                    patches[n] = pre_unapplied_filter_arg + patches[n]
                if post_unapplied_filter:
                    patches[n] = patches[n] + post_unapplied_filter_arg

        if patches:
            return _with_groups(g, sep.join(patches))
        else:
            return ''
예제 #19
0
    def _patches(m):
        g = m.groups()

        try:
            extensions.find('mq')
        except KeyError:
            return ''

        join_filter = _get_filter('join', g)
        join_filter_arg = _get_filter_arg(join_filter)
        if join_filter:
            sep = join_filter_arg
        else:
            sep = ' -> '

        patches = repo.mq.series
        applied = [p.name for p in repo.mq.applied]
        unapplied = filter(lambda p: p not in applied, patches)

        if _get_filter('hide_applied', g):
            patches = filter(lambda p: p not in applied, patches)
        if _get_filter('hide_unapplied', g):
            patches = filter(lambda p: p not in unapplied, patches)

        if _get_filter('reverse', g):
            patches = reversed(patches)

        pre_applied_filter = _get_filter('pre_applied', g)
        pre_applied_filter_arg = _get_filter_arg(pre_applied_filter)
        post_applied_filter = _get_filter('post_applied', g)
        post_applied_filter_arg = _get_filter_arg(post_applied_filter)

        pre_unapplied_filter = _get_filter('pre_unapplied', g)
        pre_unapplied_filter_arg = _get_filter_arg(pre_unapplied_filter)
        post_unapplied_filter = _get_filter('post_unapplied', g)
        post_unapplied_filter_arg = _get_filter_arg(post_unapplied_filter)

        for n, patch in enumerate(patches):
            if patch in applied:
                if pre_applied_filter:
                    patches[n] = pre_applied_filter_arg + patches[n]
                if post_applied_filter:
                    patches[n] = patches[n] + post_applied_filter_arg
            elif patch in unapplied:
                if pre_unapplied_filter:
                    patches[n] = pre_unapplied_filter_arg + patches[n]
                if post_unapplied_filter:
                    patches[n] = patches[n] + post_unapplied_filter_arg

        if patches:
            return _with_groups(g, sep.join(patches))
        else:
            return ''
예제 #20
0
def blame(ui, repo, *args, **kwargs):
    cmdoptions = [
    ]
    args, opts = parseoptions(ui, cmdoptions, args)
    try:
        # If tweakdefaults is enabled then we have access to -p, which adds
        # Phabricator diff ID
        extensions.find('tweakdefaults')
        cmd = Command('annotate -pudl')
    except KeyError:
        cmd = Command('annotate -udl')
    cmd.extend([convert(v) for v in args])
    ui.status((str(cmd)), "\n")
예제 #21
0
파일: kiln.py 프로젝트: istruble/dotfiles
def extsetup(ui):
    try:
        g = extensions.find('gestalt')
        extensions.wrapcommand(g.cmdtable, 'overview', guess_kilnpath)
        extensions.wrapcommand(g.cmdtable, 'advice', guess_kilnpath)
        extensions.wrapcommand(g.cmdtable, 'next', guess_kilnpath)
    except KeyError:
        pass

    try:
        f = extensions.find('fetch')
        extensions.wrapcommand(f.cmdtable, 'fetch', guess_kilnpath)
    except KeyError:
        pass
예제 #22
0
파일: kiln.py 프로젝트: szechyjs/dotfiles
def extsetup(ui):
    try:
        g = extensions.find('gestalt')
        extensions.wrapcommand(g.cmdtable, 'overview', guess_kilnpath)
        extensions.wrapcommand(g.cmdtable, 'advice', guess_kilnpath)
        extensions.wrapcommand(g.cmdtable, 'next', guess_kilnpath)
    except KeyError:
        pass

    try:
        f = extensions.find('fetch')
        extensions.wrapcommand(f.cmdtable, 'fetch', guess_kilnpath)
    except KeyError:
        pass
예제 #23
0
def extsetup(ui):
    global bz_available
    try:
        extensions.find('bzexport')
        bz_available = True
    except KeyError:
        pass

    extensions.wrapfunction(exchange, 'pull', pull)
    extensions.wrapfunction(exchange, 'push', push)
    extensions.wrapfunction(exchange, '_pullobsolete', exchangepullpushlog)

    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
예제 #24
0
def reposetup(ui, repo):
    # Don't update the ui for remote peer repos, since they won't have the local
    # configs.
    if repo.local() is None:
        return

    # always update the ui object.
    FastManifestExtension.set_ui(ui)

    if ui.configbool('fastmanifest', 'usetree'):
        try:
            extensions.find('treemanifest')
        except KeyError:
            raise error.Abort(_("fastmanifest.usetree cannot be enabled without"
                                " enabling treemanifest"))
예제 #25
0
def extsetup(ui):
    global bz_available
    try:
        extensions.find('bzexport')
        bz_available = True
    except KeyError:
        pass

    extensions.wrapfunction(exchange, 'pull', pull)
    extensions.wrapfunction(exchange, 'push', push)
    extensions.wrapfunction(exchange, '_pullobsolete', exchangepullpushlog)

    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
예제 #26
0
def extsetup_post_crecord():
    crecord_ext = extensions.find('crecord')
    entry = extensions.wrapcommand(crecord_ext.cmdtable, 'qcrecord',
                                   qcrecord_wrapper)
    entry[1].extend([('Q', 'mqcommit', None, 'commit change to patch queue'),
                     ('M', 'mqmessage', '%a: %p%Q',
                      'commit message for patch creation')])
예제 #27
0
def _revive(repo, rev):
    """Brings the given rev back into the repository. Finding it in backup
    bundles if necessary.
    """
    unfi = repo.unfiltered()
    try:
        ctx = unfi[rev]
    except error.RepoLookupError:
        # It could either be a revset or a stripped commit.
        pass
    else:
        if ctx.obsolete():
            try:
                inhibit = extensions.find('inhibit')
            except KeyError:
                raise error.Abort(_('cannot revive %s - inhibit extension '
                                    'is not enabled') % ctx)
            else:
                torevive = unfi.set('::%d & obsolete()', ctx.rev())
                inhibit.revive(torevive, operation='reset')

    try:
        revs = scmutil.revrange(repo, [rev])
        if len(revs) > 1:
            raise error.Abort(_('exactly one revision must be specified'))
        if len(revs) == 1:
            return repo[revs.first()]
    except error.RepoLookupError:
        revs = []

    return _pullbundle(repo, rev)
예제 #28
0
def _push(orig, ui, repo, *args, **opts):
    oldonto = ui.backupconfig(experimental, configonto)
    oldremotenames = ui.backupconfig('remotenames', 'allownonfastforward')
    oldphasemove = None

    try:
        onto = opts.get('to')
        if not onto and not opts.get('rev') and not opts.get('dest'):
            try:
                # If it's a tracking bookmark, remotenames will push there,
                # so let's set that up as our --to.
                remotenames = extensions.find('remotenames')
                active = remotenames.bmactive(repo)
                tracking = remotenames._readtracking(repo)
                if active and active in tracking:
                    track = tracking[active]
                    path, book = remotenames.splitremotename(track)
                    onto = book
            except KeyError:
                # No remotenames? No big deal.
                pass

        ui.setconfig(experimental, configonto, onto, '--to')
        if ui.config(experimental, configonto):
            ui.setconfig(experimental, 'bundle2.pushback', True)
            oldphasemove = wrapfunction(exchange, '_localphasemove', _phasemove)
        ui.setconfig('remotenames', 'allownonfastforward', True)
        result = orig(ui, repo, *args, **opts)
    finally:
        ui.restoreconfig(oldonto)
        ui.restoreconfig(oldremotenames)
        if oldphasemove:
            exchange._localphasemove = oldphasemove

    return result
예제 #29
0
파일: hgshelve.py 프로젝트: nailxx/dotfiles
def extsetup():
    try:
        # enable color diff in shelve command via Color extension
        color = extensions.find("color")
        color._setupcmd(_ui, "shelve", cmdtable, color.colordiff, color._diff_effects)
    except KeyError:
        pass
예제 #30
0
def qrecord(ui, repo, patch, *pats, **opts):
    '''interactively record a new patch

    See :hg:`help qnew` & :hg:`help record` for more information and
    usage.
    '''

    try:
        mq = extensions.find('mq')
    except KeyError:
        raise util.Abort(_("'mq' extension not loaded"))

    repo.mq.checkpatchname(patch)

    def committomq(ui, repo, *pats, **opts):
        opts['checkname'] = False
        mq.new(ui, repo, patch, *pats, **opts)

    backup = ui.backupconfig('experimental', 'crecord')
    try:
        ui.setconfig('experimental', 'crecord', False, 'record')
        cmdutil.dorecord(ui, repo, committomq, 'qnew', False,
                         cmdutil.recordfilter, *pats, **opts)
    finally:
        ui.restoreconfig(backup)
예제 #31
0
def uisetup(ui):
    try:
        mq = extensions.find('mq')
        if mq is None:
            ui.warn("mqext extension is mostly disabled when mq is disabled")
            return
    except KeyError:
        ui.warn("mqext extension is mostly disabled when mq is not installed")
        return # mq not loaded at all

    # check whether mq is loaded before mqext. If not, do a nasty hack to set
    # it up first so that mqext can modify what it does and not have the
    # modifications get clobbered. Mercurial really needs to implement
    # inter-extension dependencies.

    aliases, entry = cmdutil.findcmd('init', commands.table)
    try:
        if not [ e for e in entry[1] if e[1] == 'mq' ]:
            orig = mq.uisetup
            mq.uisetup = lambda ui: deferred_uisetup(orig, ui, mq)
            return
    except AttributeError:
        # argh! Latest mq does not use uisetup anymore. Now it does its stuff
        # in extsetup (phase 2). Fortunately, it now installs its commands
        # early enough that the order no longer matters.
        pass

    uisetup_post_mq(ui, mq)
예제 #32
0
    def run(self):
        msg = None
        if not self.dialog.server:
            msg = _("Invalid Settings - The ReviewBoard server is not setup")
        elif not self.dialog.user:
            msg = _("Invalid Settings - Please provide your ReviewBoard username")
        else:
            rb = extensions.find("reviewboard")
            try:
                pwd = self.dialog.password
                #if we don't have a password send something here to skip
                #the cli getpass in the extension. We will set the password
                #later
                if not pwd:
                    pwd = "None"

                self.reviewboard = rb.make_rbclient(self.dialog.server,
                                                    self.dialog.user,
                                                    pwd)
                self.loadCombos()

            except rb.ReviewBoardError, e:
                msg = e.msg
            except TypeError:
                msg = _("Invalid reviewboard plugin. Please download the "
                        "mercurial reviewboard plugin version 3.5 or higher "
                        "from the website below.\n\n %s") % \
                        u'http://bitbucket.org/mdelagra/mercurial-reviewboard/'
예제 #33
0
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
예제 #34
0
def qrecord(ui, repo, patch, *pats, **opts):
    '''interactively record a new patch

    See :hg:`help qnew` & :hg:`help record` for more information and
    usage.
    '''

    try:
        mq = extensions.find('mq')
    except KeyError:
        raise util.Abort(_("'mq' extension not loaded"))

    repo.mq.checkpatchname(patch)

    def committomq(ui, repo, *pats, **opts):
        opts['checkname'] = False
        mq.new(ui, repo, patch, *pats, **opts)

    backup = ui.backupconfig('experimental', 'crecord')
    try:
        ui.setconfig('experimental', 'crecord', False, 'record')
        cmdutil.dorecord(ui, repo, committomq, 'qnew', False,
                         cmdutil.recordfilter, *pats, **opts)
    finally:
        ui.restoreconfig(backup)
예제 #35
0
파일: mbox.py 프로젝트: Garoth/Configs
def importpatch(ui, repo, patchname, msg):
    """qimport the patch found in msg as patchname"""
    try:
        mq = extensions.find('mq')
    except KeyError:
        raise util.Abort(_("'mq' extension not loaded"))

    s = getpayload(msg)
    if s is None:
        raise util.Abort(_("cannot find patch in message content"))

    s = s.replace('\r\n', '\n')
    tmpfd, tmppath = tempfile.mkstemp(prefix='hg-mbox-')
    try:
        try:
            fp = os.fdopen(tmpfd, 'wb')
            fp.write(s)
            fp.close()
            tmpfd = None
        except IOError:
            if tmpfd:
                os.close(tmpfd)
            raise

        mq.qimport(ui, repo, tmppath, name=patchname, existing=False,
                   force=False, rev=[], git=False)
    finally:
        os.remove(tmppath)
예제 #36
0
def _deleteinfinitepushbookmarks(ui, repo, path, names):
    """Prune remote names by removing the bookmarks we don't want anymore,
    then writing the result back to disk
    """
    remotenamesext = extensions.find('remotenames')

    # remotename format is:
    # (node, nametype ("branches" or "bookmarks"), remote, name)
    nametype_idx = 1
    remote_idx = 2
    name_idx = 3
    remotenames = [remotename for remotename in \
                   remotenamesext.readremotenames(repo) \
                   if remotename[remote_idx] == path]
    remote_bm_names = [remotename[name_idx] for remotename in \
                       remotenames if remotename[nametype_idx] == "bookmarks"]

    for name in names:
        if name not in remote_bm_names:
            raise error.Abort(
                _("infinitepush bookmark '{}' does not exist "
                  "in path '{}'").format(name, path))

    bookmarks = {}
    branches = collections.defaultdict(list)
    for node, nametype, remote, name in remotenames:
        if nametype == "bookmarks" and name not in names:
            bookmarks[name] = node
        elif nametype == "branches":
            # saveremotenames wants binary nodes for branches
            branches[name].append(bin(node))

    remotenamesext.saveremotenames(repo, path, branches, bookmarks)
예제 #37
0
def uisetup(ui):
    try:
        mq = extensions.find('mq')
        if mq is None:
            ui.debug("mqext extension is mostly disabled when mq is disabled\n")
            return
    except KeyError:
        ui.debug("mqext extension is mostly disabled when mq is not installed\n")
        return # mq not loaded at all

    # check whether mq is loaded before mqext. If not, do a nasty hack to set
    # it up first so that mqext can modify what it does and not have the
    # modifications get clobbered. Mercurial really needs to implement
    # inter-extension dependencies.

    aliases, entry = cmdutil.findcmd('init', commands.table)
    try:
        if not [ e for e in entry[1] if e[1] == 'mq' ]:
            orig = mq.uisetup
            mq.uisetup = lambda ui: deferred_uisetup(orig, ui, mq)
            return
    except AttributeError:
        # argh! Latest mq does not use uisetup anymore. Now it does its stuff
        # in extsetup (phase 2). Fortunately, it now installs its commands
        # early enough that the order no longer matters.
        pass

    uisetup_post_mq(ui, mq)
예제 #38
0
def wrapstrip(loaded):
    try:
        stripmod = extensions.find('strip')
    except KeyError:
        pass
    else:
        extensions.wrapcommand(stripmod.cmdtable, 'strip', safestrip)
예제 #39
0
    def run(self):
        msg = None
        if not self.dialog.server:
            msg = _("Invalid Settings - The ReviewBoard server is not setup")
        elif not self.dialog.user:
            msg = _(
                "Invalid Settings - Please provide your ReviewBoard username")
        else:
            rb = extensions.find("reviewboard")
            try:
                pwd = self.dialog.password
                #if we don't have a password send something here to skip
                #the cli getpass in the extension. We will set the password
                #later
                if not pwd:
                    pwd = "None"

                self.reviewboard = rb.make_rbclient(self.dialog.server,
                                                    self.dialog.user, pwd)
                self.loadCombos()

            except rb.ReviewBoardError, e:
                msg = e.msg
            except TypeError:
                msg = _("Invalid reviewboard plugin. Please download the "
                        "Mercurial reviewboard plugin version 3.5 or higher "
                        "from the website below.\n\n %s") % \
                        u'https://bitbucket.org/mdelagra/mercurial-reviewboard/'
예제 #40
0
def uisetup(ui):
    extensions.wrapcommand(commands.table, 'pull', _pull_with_cache)
    extensions.wrapcommand(commands.table, 'push', _push_with_cache)
    try:
        extensions.wrapcommand(extensions.find("fetch").cmdtable, 'fetch', _pull_with_cache)
    except KeyError:
        pass
def reposetup(ui, repo):
    fasupport = import_module('hgext.fastannotate.support')

    if not fasupport:
        return

    # fastannotate in Mercurial 4.8 has buggy hgweb support. We always remove
    # its monkeypatch if present.
    try:
        extensions.unwrapfunction(webutil, b'annotate',
                                  fasupport._hgwebannotate)
    except ValueError:
        pass

    # And we install our own if fastannotate is enabled.
    try:
        fastannotate = extensions.find(b'fastannotate')
    except KeyError:
        fastannotate = None

    if fastannotate and b'hgweb' in ui.configlist(b'fastannotate', b'modes'):
        # Guard against recursive chaining, since we're in reposetup().
        try:
            extensions.unwrapfunction(webutil, b'annotate', hgwebfastannotate)
        except ValueError:
            pass

        extensions.wrapfunction(webutil, b'annotate', hgwebfastannotate)
예제 #42
0
파일: prompt.py 프로젝트: EdJoJob/dots
    def _patches(m):
        g = m.groups()

        try:
            extensions.find("mq")
        except KeyError:
            return ""

        join_filter = _get_filter("join", g)
        join_filter_arg = _get_filter_arg(join_filter)
        sep = join_filter_arg if join_filter else " -> "

        patches = repo.mq.series
        applied = [p.name for p in repo.mq.applied]
        unapplied = filter(lambda p: p not in applied, patches)

        if _get_filter("hide_applied", g):
            patches = filter(lambda p: p not in applied, patches)
        if _get_filter("hide_unapplied", g):
            patches = filter(lambda p: p not in unapplied, patches)

        if _get_filter("reverse", g):
            patches = reversed(patches)

        pre_applied_filter = _get_filter("pre_applied", g)
        pre_applied_filter_arg = _get_filter_arg(pre_applied_filter)
        post_applied_filter = _get_filter("post_applied", g)
        post_applied_filter_arg = _get_filter_arg(post_applied_filter)

        pre_unapplied_filter = _get_filter("pre_unapplied", g)
        pre_unapplied_filter_arg = _get_filter_arg(pre_unapplied_filter)
        post_unapplied_filter = _get_filter("post_unapplied", g)
        post_unapplied_filter_arg = _get_filter_arg(post_unapplied_filter)

        for n, patch in enumerate(patches):
            if patch in applied:
                if pre_applied_filter:
                    patches[n] = pre_applied_filter_arg + patches[n]
                if post_applied_filter:
                    patches[n] = patches[n] + post_applied_filter_arg
            elif patch in unapplied:
                if pre_unapplied_filter:
                    patches[n] = pre_unapplied_filter_arg + patches[n]
                if post_unapplied_filter:
                    patches[n] = patches[n] + post_unapplied_filter_arg

        return _with_groups(g, sep.join(patches)) if patches else ""
예제 #43
0
파일: prompt.py 프로젝트: nishp1/dotfiles
 def _bookmark(m):
     try:
         book = extensions.find('bookmarks').current(repo)
     except AttributeError:
         book = getattr(repo, '_bookmarkcurrent', None)
     except KeyError:
         book = getattr(repo, '_bookmarkcurrent', None)
     return _with_groups(m.groups(), book) if book else ''
예제 #44
0
    def _queue(m):
        g = m.groups()

        try:
            extensions.find('mq')
        except KeyError:
            return ''

        q = repo.mq

        out = os.path.basename(q.path)
        if out == 'patches' and not os.path.isdir(q.path):
            out = ''
        elif out.startswith('patches-'):
            out = out[8:]

        return _with_groups(g, out) if out else ''
예제 #45
0
def extsetup():
    try:
        # enable color diff in shelve command via Color extension
        color = extensions.find('color')
        color._setupcmd(_ui, 'shelve', cmdtable, color.colordiff,
                        color._diff_effects)
    except KeyError:
        pass
예제 #46
0
 def _task(m):
     try:
         task = extensions.find('tasks').current(repo)
         if task:
             return _with_groups(m.groups(), task)
         else:
             return ''
     except KeyError:
         return ''
예제 #47
0
 def _lfsloaded(loaded=False):
     lfsmod = None
     try:
         lfsmod = extensions.find(b'lfs')
     except KeyError:
         pass
     if lfsmod:
         lfsmod.wrapfilelog(remotefilelog.remotefilelog)
         fileserverclient._lfsmod = lfsmod
예제 #48
0
def loadextension(ui, name):
    # Between Mercurial revisions 1.2 and 1.3, extensions.load() stopped
    # calling uisetup() after loading an extension.  This could do
    # unexpected things if you use an hg version < 1.3
    extensions.load(ui, name, None)
    mod = extensions.find(name)
    uisetup = getattr(mod, 'uisetup', None)
    if uisetup:
        uisetup(ui)
예제 #49
0
def extsetup():
    try:
        keyword = extensions.find('keyword')
        keyword.restricted += ' crecord qcrecord qcrefresh'
        try:
            keyword.recordextensions += ' crecord'
            keyword.recordcommands += ' crecord qcrecord qcrefresh'
        except AttributeError:
            pass
    except KeyError:
        pass

    try:
        mq = extensions.find('mq')
    except KeyError:
        return

    qnew = '^qnew'
    if not qnew in mq.cmdtable:
        # backwards compatible with pre 301633755dec
        qnew = 'qnew'

    qrefresh = '^qrefresh'
    if not qrefresh in mq.cmdtable:
        # backwards compatible?
        qrefresh = 'qrefresh'

    qcmdtable = {
        "qcrecord": (
            qcrecord,

            # add qnew options, except '--force'
            [opt for opt in mq.cmdtable[qnew][1] if opt[1] != 'force'],
            _('hg qcrecord [OPTION]... PATCH [FILE]...')),
        "qcrefresh": (
            qcrefresh,

            # same options as qrefresh
            mq.cmdtable[qrefresh][1],
            _('hg qcrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] [FILE]...')
        ),
    }

    cmdtable.update(qcmdtable)
예제 #50
0
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
예제 #51
0
파일: try.py 프로젝트: nwgh/mozdev
def run_try(ui, repo, *args, **opts):
    """Push the current head to try
    """
    if not opts['build'] or not opts['platform']:
        raise util.Abort('Both -b and -p are required')

    # We rely on the try server to validate anything beyond that simple
    # check above, so let's just blindly go about our business!

    tryopts = []
    tryopts.append('-b')
    tryopts.extend(opts['build'])
    tryopts.append('-p')
    tryopts.extend(opts['platform'])
    if opts.get('unit'):
        tryopts.append('-u')
        tryopts.extend(opts['unit'])
    if opts.get('talos'):
        tryopts.append('-t')
        tryopts.extend(opts['talos'])

    trymsg = 'try: %s' % (' '.join(tryopts),)

    if repo[None].dirty():
        raise util.Abort('You have outstanding changes')

    try:
        strip = extensions.find('strip')
    except KeyError:
        ui.warn('strip extension not found, use the following syntax:\n')
        ui.write('%s\n' % (trymsg,))
        return

    ui.write('setting try selections...\n')

    # This next bit here is a hack to get an empty commit
    cwd = os.getcwd()
    junkfile = tempfile.mktemp(prefix='hgjunk', dir='')
    os.chdir(repo.root)
    file(junkfile, 'w').close()
    commands.add(ui, repo, junkfile)
    commands.commit(ui, repo, message='add junk file (will be gone)')
    commands.remove(ui, repo, junkfile)
    commands.commit(ui, repo, amend=True, message=trymsg, logfile=None)
    os.chdir(cwd)

    # Get the revision of our try commit so we can strip it later
    node = repo[None].p1().hex()

    ui.write('pushing to try...\n')
    commands.push(ui, repo, 'try', force=True)

    # Now we must clean up after ourslves by stripping the try commit
    strip.stripcmd(ui, repo, node, rev=[], no_backup=True)
예제 #52
0
def _handlelfs(repo, missing):
    """Special case if lfs is enabled

    If lfs is enabled then we need to call prepush hook
    to make sure large files are uploaded to lfs
    """
    try:
        lfsmod = extensions.find(b'lfs')
        lfsmod.wrapper.uploadblobsfromrevs(repo, missing)
    except KeyError:
        # Ignore if lfs extension is not enabled
        return
예제 #53
0
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
예제 #54
0
 def _bookmark(m):
     try:
         book = extensions.find('bookmarks').current(repo)
     except AttributeError:
         book = getattr(repo, '_bookmarkcurrent', None)
     except KeyError:
         book = getattr(repo, '_bookmarkcurrent', None)
     if book:
         cur = repo['.'].node()
         if repo._bookmarks[book] == cur:
             return _with_groups(m.groups(), book)
     else:
         return ''
예제 #55
0
def extsetup(ui=None):
    # The cmdtable is initialized here to pick up options added by other
    # extensions (e.g., rebase, bookmarks).
    #
    # Commands tagged with '^' are listed by 'hg help'.
    global defpath_mod
    defpath_mod = None
    defpath_opts = []
    try:
        defpath_mod = extensions.find('defpath')
        defpath_opts = __builtin__.list(defpath_mod.opts) + subtreesopts
        defpath_doc = getattr(defpath_mod, 'common_docstring', '')
        if defpath_doc:
            defpath.__doc__ += defpath_doc
    except:
        pass

    # The command and function names are duplicated here from the command
    # decorators above. This could benefit from further cleanup.
    cmdtable['^tclone'] = _newcte('clone', clone, cloneopts,
                                  _('[OPTION]... SOURCE [DEST [SUBTREE]...]'))
    cmdtable['tcommand|tcmd'] = (command_cmd, commandopts,
                                 _('command [arg] ...'))
    cmdtable['tcommit|tci'] = _newcte('commit', commit, subtreesopts)
    cmdtable['tconfig'] = (config, configopts, _('[OPTION]... [SUBTREE]...'))
    cmdtable['tdiff'] = _newcte('diff', diff, subtreesopts)
    cmdtable['theads'] = _newcte('heads', heads, subtreesopts)
    cmdtable['tincoming'] = _newcte('incoming', incoming, subtreesopts)
    cmdtable['toutgoing'] = _newcte('outgoing', outgoing, subtreesopts)
    cmdtable['tlist'] = (list_cmd, listopts, _('[OPTION]...'))
    cmdtable['^tlog|thistory'] = _newcte('log', log, subtreesopts)
    cmdtable['tmerge'] = _newcte('merge', merge, subtreesopts)
    cmdtable['tparents'] = _newcte('parents', parents, subtreesopts)
    cmdtable['tpaths'] = _newcte('paths', paths, subtreesopts)
    cmdtable['^tpull'] = _newcte('pull', pull, subtreesopts)
    cmdtable['^tpush'] = _newcte('push', push, subtreesopts)
    cmdtable['^tstatus'] = _newcte('status', status, subtreesopts)
    try:
        cmdtable['tsummary'] = _newcte('summary', summary, subtreesopts)
    except:
        # The summary command is not present in early versions of mercurial
        pass
    cmdtable['^tupdate'] = _newcte('update', update, subtreesopts)
    cmdtable['ttag'] = _newcte('tag', tag, subtreesopts)
    cmdtable['ttip'] = _newcte('tip', tip, subtreesopts)
    cmdtable['tversion'] = (version, [], '')
    cmdtable['tdebugkeys'] = (debugkeys, namespaceopt, '')
    if defpath_mod:
        cmdtable['tdefpath'] = (defpath, defpath_opts, _(''))
    if getattr(commands, 'summary', None):
        cmdtable['tsummary'] = _newcte('summary', summary, subtreesopts)
예제 #56
0
def extsetup(ui):
    '''Initialize the extension.'''
    _setupcmd(ui, 'diff', commands.table, colordiff, _diff_effects)
    _setupcmd(ui, 'incoming', commands.table, None, _diff_effects)
    _setupcmd(ui, 'log', commands.table, None, _diff_effects)
    _setupcmd(ui, 'outgoing', commands.table, None, _diff_effects)
    _setupcmd(ui, 'tip', commands.table, None, _diff_effects)
    _setupcmd(ui, 'status', commands.table, colorstatus, _status_effects)
    _setupcmd(ui, 'resolve', commands.table, colorresolve, _resolve_effects)

    try:
        mq = extensions.find('mq')
        _setupcmd(ui, 'qdiff', mq.cmdtable, colordiff, _diff_effects)
        _setupcmd(ui, 'qseries', mq.cmdtable, colorqseries, _patch_effects)
    except KeyError:
        mq = None

    try:
        rec = extensions.find('record')
        _setupcmd(ui, 'record', rec.cmdtable, colordiff, _diff_effects)
    except KeyError:
        rec = None

    if mq and rec:
        _setupcmd(ui, 'qrecord', rec.cmdtable, colordiff, _diff_effects)
    try:
        churn = extensions.find('churn')
        _setupcmd(ui, 'churn', churn.cmdtable, colorchurn, _diff_effects)
    except KeyError:
        churn = None

    try:
        bookmarks = extensions.find('bookmarks')
        _setupcmd(ui, 'bookmarks', bookmarks.cmdtable, colorbookmarks,
                  _bookmark_effects)
    except KeyError:
        # The bookmarks extension is not enabled
        pass
예제 #57
0
    def _patch(m):
        g = m.groups()

        try:
            extensions.find('mq')
        except KeyError:
            return ''

        q = repo.mq

        if _get_filter('quiet', g) and not len(q.series):
            return ''

        if _get_filter('applied', g):
            out = str(len(q.applied))
        elif _get_filter('unapplied', g):
            out = str(len(q.unapplied(repo)))
        elif _get_filter('count', g):
            out = str(len(q.series))
        else:
            out = q.applied[-1].name if q.applied else ''

        return _with_groups(g, out) if out else ''
예제 #58
0
파일: record.py 프로젝트: ezc/mercurial
def uisetup(ui):
    try:
        mq = extensions.find('mq')
    except KeyError:
        return

    qcmdtable = {
        "qrecord": (
            qrecord,
            mq.cmdtable['^qnew'][1],  # same options as qnew
            _('hg qrecord [OPTION]... PATCH [FILE]...')),
    }

    cmdtable.update(qcmdtable)