Example #1
0
def extsetup(ui):
    extensions.wrapfunction(wireproto, '_capabilities', capabilities)
    pushkey.register('strip', pushstrip, liststrip)

    # Add a pushkey namespace to obtain the list of available review
    # repositories. This is used for repository discovery.
    pushkey.register('reviewrepos', lambda *x: False, listreviewrepos)
Example #2
0
def extsetup(ui):
    # Modelled after dispatch._dispatch. We have to re-parse the
    # arguments to find the path to the repository since there is no
    # repo object yet.
    # extsetup is called after all the extension are loaded, and can be useful in case one extension optionally depends on another extension. Signature:
    # https://www.mercurial-scm.org/wiki/WritingExtensions#Setup_Callbacks
    
    #moved to uisetup
    #args = sys.argv[1:]
    #rpath = dispatch._earlygetopt(["-R", "--repository", "--repo"], args)
    #readprojrc(ui, rpath)
    
    extensions.loadall(ui)

    if hasattr(dispatch, "_loaded"):
        for name, module in extensions.extensions():
            if name in dispatch._loaded:
                continue
            cmdtable = getattr(module, 'cmdtable', {})
            overrides = [cmd for cmd in cmdtable if cmd in commands.table]
            if overrides:
                ui.warn(_("extension '%s' overrides commands: %s\n")
                        % (name, " ".join(overrides)))
            commands.table.update(cmdtable)
            dispatch._loaded.add(name)
    else:

         #dispatch._loaded was removed in the latest mercurial
        faux_loaded = set()

        for name in extensions._extensions:
            faux_loaded.add(name)

        for name, module in extensions.extensions():
            if name in faux_loaded:
                continue
            cmdtable = getattr(module, 'cmdtable', {})
            overrides = [cmd for cmd in cmdtable if cmd in commands.table]
            if overrides:
                ui.warn(_("extension '%s' overrides commands: %s\n")
                        % (name, " ".join(overrides)))
            commands.table.update(cmdtable)
            faux_loaded.add(name)

    extensions.wrapfunction(hg, 'clone', clone)
    extensions.wrapfunction(hg, 'incoming', incoming)
    extensions.wrapfunction(exchange, 'pull', pull)
    pushkey.register('projrc', pushprojrc, listprojrc)
Example #3
0
def extsetup(ui):
    extensions.wrapfunction(wireproto, '_capabilities', capabilities)
    pushkey.register('strip', pushstrip, liststrip)

    # To short circuit operations with discovery repos.
    extensions.wrapcommand(wireproto.commands, 'heads', wrappedwireprotoheads)

    setattr(webcommands, 'mozreviewcapabilities', capabilitieswebcommand)
    webcommands.__all__.append('mozreviewcapabilities')

    setattr(webcommands, 'mozreviewsubmitseries', submitserieswebcommand)
    webcommands.__all__.append('mozreviewsubmitseries')

    setattr(webcommands, 'mozreviewpublish', publishwebcommand)
    webcommands.__all__.append('mozreviewpublish')

    setattr(webcommands, 'mozreviewreviewrepos', reviewreposwebcommand)
    webcommands.__all__.append('mozreviewreviewrepos')
Example #4
0
def extsetup(ui):
    extensions.wrapfunction(wireproto, '_capabilities', capabilities)
    pushkey.register('strip', pushstrip, liststrip)

    # To short circuit operations with discovery repos.
    extensions.wrapcommand(wireproto.commands, 'heads', wrappedwireprotoheads)

    setattr(webcommands, 'mozreviewcapabilities', capabilitieswebcommand)
    webcommands.__all__.append('mozreviewcapabilities')

    setattr(webcommands, 'mozreviewsubmitseries', submitserieswebcommand)
    webcommands.__all__.append('mozreviewsubmitseries')

    setattr(webcommands, 'mozreviewpublish', publishwebcommand)
    webcommands.__all__.append('mozreviewpublish')

    setattr(webcommands, 'mozreviewreviewrepos', reviewreposwebcommand)
    webcommands.__all__.append('mozreviewreviewrepos')
Example #5
0
def reposetup(ui, repo):
    # Pushing keys is disabled; unclear whether/how it should work.
    pushfunc = lambda *x: False
    x = [_nsnormalize(s) for s in ui.configlist('trees', 'namespaces', [])]
    try:
        for ns in [_ns(ui, {})] + x:
            pushkey.register(ns, pushfunc, genlistkeys(ns))
    except exceptions.ImportError:
        # hg < 1.6 - no pushkey.
        def _listkeys(self, namespace):
            # trees are ordered, so the keys are the non-negative integers.
            d = {}
            i = 0
            try:
                for line in self.opener(namespace):
                    d[("%d" % i)] = line.rstrip('\n\r')
                    i += 1
                return d
            except:
                return {}
        setattr(type(repo), 'listkeys', _listkeys)
Example #6
0
def uisetup(ui):
    extensions.wrapfunction(repair, "strip", strip)
    if ui.configbool('bookmarks', 'track.current'):
        extensions.wrapcommand(commands.table, 'update', updatecurbookmark)

    entry = extensions.wrapcommand(commands.table, 'pull', pull)
    entry[1].append(('B', 'bookmark', [],
                     _("bookmark to import"),
                     _('BOOKMARK')))
    entry = extensions.wrapcommand(commands.table, 'push', push)
    entry[1].append(('B', 'bookmark', [],
                     _("bookmark to export"),
                     _('BOOKMARK')))
    entry = extensions.wrapcommand(commands.table, 'incoming', incoming)
    entry[1].append(('B', 'bookmarks', False,
                     _("compare bookmark")))
    entry = extensions.wrapcommand(commands.table, 'outgoing', outgoing)
    entry[1].append(('B', 'bookmarks', False,
                     _("compare bookmark")))

    pushkey.register('bookmarks', pushbookmark, listbookmarks)
Example #7
0
def reposetup(ui, repo):
    # Pushing keys is disabled; unclear whether/how it should work.
    pushfunc = lambda *x: False
    x = [_nsnormalize(s) for s in ui.configlist('trees', 'namespaces', [])]
    try:
        for ns in [_ns(ui, {})] + x:
            pushkey.register(ns, pushfunc, genlistkeys(ns))
    except exceptions.ImportError:
        # hg < 1.6 - no pushkey.
        def _listkeys(self, namespace):
            # trees are ordered, so the keys are the non-negative integers.
            d = {}
            i = 0
            try:
                for line in _repo_opener(self, namespace):
                    d[("%d" % i)] = line.rstrip('\n\r')
                    i += 1
                return d
            except:
                return {}

        setattr(type(repo), 'listkeys', _listkeys)
Example #8
0
def extsetup(ui):
    extensions.wrapfunction(wireproto, '_capabilities', capabilities)
    pushkey.register('strip', pushstrip, liststrip)

    # To short circuit operations with discovery repos.
    extensions.wrapcommand(wireproto.commands, 'heads', wrappedwireprotoheads)