def checkhghelps(ui): errorcnt = 0 for names, sec, doc in helptable: if callable(doc): doc = doc(ui) errorcnt += checkseclevel(ui, doc, '%s help topic' % names[0], initlevel_topic) errorcnt += checkcmdtable(ui, table, '%s command', initlevel_cmd) for name in sorted( list(extensions.enabled()) + list(extensions.disabled())): mod = extensions.load(ui, name, None) if not mod.__doc__: ui.note(('skip checking %s extension: no help document\n') % name) continue errorcnt += checkseclevel(ui, mod.__doc__, '%s extension' % name, initlevel_ext) cmdtable = getattr(mod, 'cmdtable', None) if cmdtable: errorcnt += checkcmdtable(ui, cmdtable, '%%s command of %s extension' % name, initlevel_ext_cmd) return errorcnt
def checkhghelps(): errorcnt = 0 for names, sec, doc in helptable: if util.safehasattr(doc, '__call__'): doc = doc() errorcnt += checkseclevel(doc, '%s help topic' % names[0], initlevel_topic) errorcnt += checkcmdtable(table, '%s command', initlevel_cmd) for name in sorted(extensions.enabled().keys() + extensions.disabled().keys()): mod = extensions.load(None, name, None) if not mod.__doc__: verbose('skip checking %s extension: no help document' % name) continue errorcnt += checkseclevel(mod.__doc__, '%s extension' % name, initlevel_ext) cmdtable = getattr(mod, 'cmdtable', None) if cmdtable: errorcnt += checkcmdtable(cmdtable, '%s command of ' + name + ' extension', initlevel_ext_cmd) return errorcnt
def setup(): """Wraps user-facing mercurial commands with narrow-aware versions.""" entry = extensions.wrapcommand(commands.table, b'clone', clonenarrowcmd) entry[1].append( (b'', b'narrow', None, _(b"create a narrow clone of select files"))) entry[1].append(( b'', b'depth', b'', _(b"limit the history fetched by distance from heads"), )) entry[1].append( (b'', b'narrowspec', b'', _(b"read narrowspecs from file"))) # TODO(durin42): unify sparse/narrow --include/--exclude logic a bit if b'sparse' not in extensions.enabled(): entry[1].append((b'', b'include', [], _(b"specifically fetch this file/directory"))) entry[1].append(( b'', b'exclude', [], _(b"do not fetch this file/directory, even if included"), )) entry = extensions.wrapcommand(commands.table, b'pull', pullnarrowcmd) entry[1].append(( b'', b'depth', b'', _(b"limit the history fetched by distance from heads"), )) extensions.wrapcommand(commands.table, b'archive', archivenarrowcmd)
def checkhghelps(): errorcnt = 0 for names, sec, doc in helptable: if callable(doc): doc = doc() errorcnt += checkseclevel(doc, '%s help topic' % names[0], initlevel_topic) errorcnt += checkcmdtable(table, '%s command', initlevel_cmd) for name in sorted(extensions.enabled().keys() + extensions.disabled().keys()): mod = extensions.load(None, name, None) if not mod.__doc__: verbose('skip checking %s extension: no help document' % name) continue errorcnt += checkseclevel(mod.__doc__, '%s extension' % name, initlevel_ext) cmdtable = getattr(mod, 'cmdtable', None) if cmdtable: errorcnt += checkcmdtable(cmdtable, '%s command of ' + name + ' extension', initlevel_ext_cmd) return errorcnt
def allextensionnames(): extensionnames = [] extensionsdictionary = extensions.enabled()[0] extensionnames.extend(extensionsdictionary.keys()) extensionsdictionary = extensions.disabled()[0] extensionnames.extend(extensionsdictionary.keys()) return extensionnames
def enabledextensions(): """Return the {name: shortdesc} dict of enabled extensions shortdesc is in local encoding. """ ret = extensions.enabled() if type(ret) is tuple: # hg <= 1.8 return ret[0] else: # hg <= 1.9 return ret
def reposetup(ui, repo): # We don't work with largefiles or inotify exts = extensions.enabled() for ext in _blacklist: if ext in exts: ui.warn( _("The fsmonitor extension is incompatible with the %s " "extension and has been disabled.\n") % ext ) return if util.safehasattr(repo, "dirstate"): # We don't work with subrepos either. Note that we can get passed in # e.g. a statichttprepo, which throws on trying to access the substate. # XXX This sucks. try: # if repo[None].substate can cause a dirstate parse, which is too # slow. Instead, look for a file called hgsubstate, if repo.wvfs.exists(".hgsubstate") or repo.wvfs.exists(".hgsub"): return except AttributeError: return fsmonitorstate = state.state(repo) if fsmonitorstate.mode == "off": return try: client = watchmanclient.client(repo) except Exception as ex: _handleunavailable(ui, fsmonitorstate, ex) return repo._fsmonitorstate = fsmonitorstate repo._watchmanclient = client # at this point since fsmonitorstate wasn't present, repo.dirstate is # not a fsmonitordirstate repo.dirstate.__class__ = makedirstate(repo.dirstate.__class__) # nuke the dirstate so that _fsmonitorinit and subsequent configuration # changes take effect on it del repo._filecache["dirstate"] delattr(repo.unfiltered(), "dirstate") class fsmonitorrepo(repo.__class__): def status(self, *args, **kwargs): orig = super(fsmonitorrepo, self).status return overridestatus(orig, self, *args, **kwargs) repo.__class__ = fsmonitorrepo
def reposetup(ui, repo): # We don't work with largefiles or inotify exts = extensions.enabled() for ext in _blacklist: if ext in exts: ui.warn( _('The fsmonitor extension is incompatible with the %s ' 'extension and has been disabled.\n') % ext) return if util.safehasattr(repo, 'dirstate'): # We don't work with subrepos either. Note that we can get passed in # e.g. a statichttprepo, which throws on trying to access the substate. # XXX This sucks. try: # if repo[None].substate can cause a dirstate parse, which is too # slow. Instead, look for a file called hgsubstate, if repo.wvfs.exists('.hgsubstate') or repo.wvfs.exists('.hgsub'): return except AttributeError: return fsmonitorstate = state.state(repo) if fsmonitorstate.mode == 'off': return try: client = watchmanclient.client(repo) except Exception as ex: _handleunavailable(ui, fsmonitorstate, ex) return repo._fsmonitorstate = fsmonitorstate repo._watchmanclient = client # at this point since fsmonitorstate wasn't present, repo.dirstate is # not a fsmonitordirstate repo.dirstate.__class__ = makedirstate(repo.dirstate.__class__) # nuke the dirstate so that _fsmonitorinit and subsequent configuration # changes take effect on it del repo._filecache['dirstate'] delattr(repo.unfiltered(), 'dirstate') class fsmonitorrepo(repo.__class__): def status(self, *args, **kwargs): orig = super(fsmonitorrepo, self).status return overridestatus(orig, self, *args, **kwargs) repo.__class__ = fsmonitorrepo
def reposetup(ui, repo): # We don't work with largefiles or inotify exts = extensions.enabled() for ext in _blacklist: if ext in exts: ui.warn( _('The fsmonitor extension is incompatible with the %s ' 'extension and has been disabled.\n') % ext) return if repo.local(): # We don't work with subrepos either. # # if repo[None].substate can cause a dirstate parse, which is too # slow. Instead, look for a file called hgsubstate, if repo.wvfs.exists('.hgsubstate') or repo.wvfs.exists('.hgsub'): return fsmonitorstate = state.state(repo) if fsmonitorstate.mode == 'off': return try: client = watchmanclient.client(repo) except Exception as ex: _handleunavailable(ui, fsmonitorstate, ex) return repo._fsmonitorstate = fsmonitorstate repo._watchmanclient = client dirstate, cached = localrepo.isfilecached(repo, 'dirstate') if cached: # at this point since fsmonitorstate wasn't present, # repo.dirstate is not a fsmonitordirstate makedirstate(repo, dirstate) class fsmonitorrepo(repo.__class__): def status(self, *args, **kwargs): orig = super(fsmonitorrepo, self).status return overridestatus(orig, self, *args, **kwargs) repo.__class__ = fsmonitorrepo
def checkhghelps(ui): errorcnt = 0 for names, sec, doc in helptable: if callable(doc): doc = doc(ui) errorcnt += checkseclevel(ui, doc, "%s help topic" % names[0], initlevel_topic) errorcnt += checkcmdtable(ui, table, "%s command", initlevel_cmd) for name in sorted(extensions.enabled().keys() + extensions.disabled().keys()): mod = extensions.load(None, name, None) if not mod.__doc__: ui.note(("skip checking %s extension: no help document\n") % name) continue errorcnt += checkseclevel(ui, mod.__doc__, "%s extension" % name, initlevel_ext) cmdtable = getattr(mod, "cmdtable", None) if cmdtable: errorcnt += checkcmdtable(ui, cmdtable, "%s command of " + name + " extension", initlevel_ext_cmd) return errorcnt
def allextensionnames(): return extensions.enabled().keys() + extensions.disabled().keys()
# Mercurial VCS back-end code for qct # # Copyright 2006 Steve Borho # # This software may be used and distributed according to the terms # of the GNU General Public License, incorporated herein by reference. import os, sys from stat import * from qctlib.utils import * from tempfile import mkstemp from StringIO import StringIO from mercurial.extensions import enabled HAS_COLOR = "color" in enabled()[0] def findHg(): path = os.environ["PATH"].split(os.pathsep) for d in path: if os.name == "nt": pathexts = os.environ["PATHEXT"].split(os.pathsep) for ext in pathexts: exepath = os.path.join(d, 'hg' + ext) if os.access(exepath, os.X_OK): try: runProgram([exepath, 'version']) return exepath except: pass else: exepath = os.path.join(d, 'hg')
def enabledextensions(): """Return the {name: shortdesc} dict of enabled extensions shortdesc is in local encoding. """ return extensions.enabled()
def reposetup(ui, repo): # We don't work with largefiles or inotify exts = extensions.enabled() for ext in _blacklist: if ext in exts: ui.warn( _(b'The fsmonitor extension is incompatible with the %s ' b'extension and has been disabled.\n') % ext) return if repo.local(): # We don't work with subrepos either. # # if repo[None].substate can cause a dirstate parse, which is too # slow. Instead, look for a file called hgsubstate, if repo.wvfs.exists(b'.hgsubstate') or repo.wvfs.exists(b'.hgsub'): return if repo_has_depth_one_nested_repo(repo): return fsmonitorstate = state.state(repo) if fsmonitorstate.mode == b'off': return try: client = watchmanclient.client(repo.ui, repo.root) except Exception as ex: _handleunavailable(ui, fsmonitorstate, ex) return repo._fsmonitorstate = fsmonitorstate repo._watchmanclient = client dirstate, cached = localrepo.isfilecached(repo, b'dirstate') if cached: # at this point since fsmonitorstate wasn't present, # repo.dirstate is not a fsmonitordirstate makedirstate(repo, dirstate) class fsmonitorrepo(repo.__class__): def status(self, *args, **kwargs): orig = super(fsmonitorrepo, self).status return overridestatus(orig, self, *args, **kwargs) def wlocknostateupdate(self, *args, **kwargs): return super(fsmonitorrepo, self).wlock(*args, **kwargs) def wlock(self, *args, **kwargs): l = super(fsmonitorrepo, self).wlock(*args, **kwargs) if not ui.configbool(b"experimental", b"fsmonitor.transaction_notify"): return l if l.held != 1: return l origrelease = l.releasefn def staterelease(): if origrelease: origrelease() if l.stateupdate: l.stateupdate.exit() l.stateupdate = None try: l.stateupdate = None l.stateupdate = state_update(self, name=b"hg.transaction") l.stateupdate.enter() l.releasefn = staterelease except Exception as e: # Swallow any errors; fire and forget self.ui.log(b'watchman', b'Exception in state update %s\n', e) return l repo.__class__ = fsmonitorrepo