Mercurial > hg
changeset 3229:7feeb6517d96
merge with crew
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Mon, 02 Oct 2006 08:40:26 +0200 |
parents | 403ebd4d92d7 (current diff) 618a7f2c1b82 (diff) |
children | 3bd3a98b4921 |
files | |
diffstat | 19 files changed, 155 insertions(+), 111 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/churn.py Mon Oct 02 08:36:29 2006 +0200 +++ b/contrib/churn.py Mon Oct 02 08:40:26 2006 +0200 @@ -58,7 +58,7 @@ for f in added: lines += dirtywork(f, None, mmap2) - + for f in removed: lines += dirtywork(f, mmap1, None) @@ -72,7 +72,7 @@ def gather_stats(ui, repo, amap, revs=None, progress=False): stats = {} - + cl = repo.changelog if not revs: @@ -117,7 +117,7 @@ def churn(ui, repo, **opts): "Graphs the number of lines changed" - + def pad(s, l): if len(s) < l: return s + " " * (l-len(s)) @@ -125,7 +125,7 @@ def graph(n, maximum, width, char): n = int(n * width / float(maximum)) - + return char * (n) def get_aliases(f): @@ -137,7 +137,7 @@ aliases[alias] = actual return aliases - + amap = {} aliases = opts.get('aliases') if aliases:
--- a/hgext/fetch.py Mon Oct 02 08:36:29 2006 +0200 +++ b/hgext/fetch.py Mon Oct 02 08:40:26 2006 +0200 @@ -63,7 +63,7 @@ revs = [other.lookup(rev) for rev in opts['rev']] modheads = repo.pull(other, heads=revs, lock=lock) return postincoming(other, modheads) - + parent, p2 = repo.dirstate.parents() if parent != repo.changelog.tip(): raise util.Abort(_('working dir not at tip '
--- a/hgext/mq.py Mon Oct 02 08:36:29 2006 +0200 +++ b/hgext/mq.py Mon Oct 02 08:40:26 2006 +0200 @@ -130,7 +130,7 @@ for c in bad_chars: if c in guard: return _('invalid character in guard %r: %r') % (guard, c) - + def set_active(self, guards): for guard in guards: bad = self.check_guard(guard) @@ -172,7 +172,7 @@ self.full_series[idx] = drop + ''.join([' #' + g for g in guards]) self.parse_series() self.series_dirty = True - + def pushable(self, idx): if isinstance(idx, str): idx = self.series.index(idx) @@ -724,7 +724,7 @@ return (i, a.rev, a.name) return None - # if the exact patch name does not exist, we try a few + # if the exact patch name does not exist, we try a few # variations. If strict is passed, we try only #1 # # 1) a number to indicate an offset in the series file @@ -1638,7 +1638,7 @@ hg qguard -- -foo To set guards on another patch: - hg qguard other.patch +2.6.17 -stable + hg qguard other.patch +2.6.17 -stable ''' def status(idx): guards = q.series_guards[idx] or ['unguarded'] @@ -1765,7 +1765,7 @@ absdest = q.join(name) if os.path.exists(absdest): raise util.Abort(_('%s already exists') % absdest) - + if name in q.series: raise util.Abort(_('A patch named %s already exists in the series file') % name) @@ -1862,7 +1862,7 @@ With no arguments, prints the currently active guards. With one argument, sets the active guard. - + Use -n/--none to deactivate guards (no other arguments needed). When no guards are active, patches with positive guards are skipped and patches with negative guards are pushed. @@ -1952,7 +1952,7 @@ parent = revlog.hex(self.dirstate.parents()[0]) if parent in [s.rev for s in self.mq.applied]: raise util.Abort(errmsg) - + def commit(self, *args, **opts): if len(args) >= 6: force = args[5] @@ -1968,7 +1968,7 @@ if self.mq.applied and not force: raise util.Abort(_('source has mq patches applied')) return super(mqrepo, self).push(remote, force, revs) - + def tags(self): if self.tagscache: return self.tagscache
--- a/mercurial/commands.py Mon Oct 02 08:36:29 2006 +0200 +++ b/mercurial/commands.py Mon Oct 02 08:40:26 2006 +0200 @@ -2502,7 +2502,7 @@ """ all = opts['all'] - + files, matchfn, anypats = cmdutil.matchpats(repo, pats, opts) cwd = (pats and repo.getcwd()) or '' modified, added, removed, deleted, unknown, ignored, clean = [ @@ -3236,7 +3236,7 @@ if t in table: ui.warn(_("module %s overrides %s\n") % (name, t)) table.update(cmdtable) - + def dispatch(args): for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM': num = getattr(signal, name, None)
--- a/mercurial/context.py Mon Oct 02 08:36:29 2006 +0200 +++ b/mercurial/context.py Mon Oct 02 08:40:26 2006 +0200 @@ -5,13 +5,10 @@ # This software may be used and distributed according to the terms # of the GNU General Public License, incorporated herein by reference. -from demandload import * from node import * -demandload(globals(), 'bdiff') - -from node import * +from i18n import gettext as _ from demandload import demandload -demandload(globals(), "ancestor util") +demandload(globals(), "ancestor bdiff repo revlog util") class changectx(object): """A changecontext object makes access to data related to a particular @@ -83,6 +80,9 @@ """get a file context from this changeset""" if fileid is None: fileid = self.filenode(path) + if not fileid: + raise repo.LookupError(_("'%s' does not exist in changeset %s") % + (path, hex(self.node()))) return filectx(self._repo, path, fileid=fileid) def filectxs(self): @@ -104,10 +104,10 @@ class filectx(object): """A filecontext object makes access to data related to a particular filerevision convenient.""" - def __init__(self, repo, path, changeid=None, fileid=None, filelog=None): + def __init__(self, repo_, path, changeid=None, fileid=None, filelog=None): """changeid can be a changeset revision, node, or tag. fileid can be a file revision or node.""" - self._repo = repo + self._repo = repo_ self._path = path assert changeid is not None or fileid is not None @@ -120,7 +120,10 @@ if fileid is None: self._changeid = changeid else: - self._filenode = self._filelog.lookup(fileid) + try: + self._filenode = self._filelog.lookup(fileid) + except revlog.RevlogError, inst: + raise repo.LookupError(str(inst)) self._changeid = self._filelog.linkrev(self._filenode) def __getattr__(self, name): @@ -223,7 +226,7 @@ pl[0] = (r[0], getlog(r[0]).rev(r[1])) return [ getctx(p, n) for p, n in pl if n != -1 ] - + # find all ancestors needed = {self: 1} visit = [self]
--- a/mercurial/dirstate.py Mon Oct 02 08:36:29 2006 +0200 +++ b/mercurial/dirstate.py Mon Oct 02 08:40:26 2006 +0200 @@ -206,7 +206,7 @@ self.dirs = {} for f in self.map: self.updatedirs(f, 1) - + def updatedirs(self, path, delta): if self.dirs is not None: for c in strutil.findall(path, '/'):
--- a/mercurial/hgweb/hgweb_mod.py Mon Oct 02 08:36:29 2006 +0200 +++ b/mercurial/hgweb/hgweb_mod.py Mon Oct 02 08:40:26 2006 +0200 @@ -648,25 +648,6 @@ form[name] = value del form[k] - if form.has_key('manifest'): - changeid = form['manifest'][0] - try: - req.changectx = self.repo.changectx(changeid) - except hg.RepoError: - man = self.repo.manifest - mn = man.lookup(changeid) - req.changectx = self.repo.changectx(man.linkrev(mn)) - - if form.has_key('filenode'): - changeid = form['filenode'][0] - path = self.cleanpath(form['file'][0]) - try: - req.changectx = self.repo.changectx(changeid) - req.filectx = req.changectx.filectx(path) - except hg.RepoError: - req.filectx = self.repo.filectx(path, fileid=changeid) - req.changectx = req.filectx.changectx() - self.refresh() expand_form(req.form) @@ -710,6 +691,34 @@ else: req.write(self.t("error")) + def changectx(self, req): + if req.form.has_key('node'): + changeid = req.form['node'][0] + else: + changeid = req.form['manifest'][0] + try: + ctx = self.repo.changectx(changeid) + except hg.RepoError: + man = self.repo.manifest + mn = man.lookup(changeid) + ctx = self.repo.changectx(man.linkrev(mn)) + + return ctx + + def filectx(self, req): + path = self.cleanpath(req.form['file'][0]) + if req.form.has_key('node'): + changeid = req.form['node'][0] + else: + changeid = req.form['filenode'][0] + try: + ctx = self.repo.changectx(changeid) + fctx = ctx.filectx(path) + except hg.RepoError: + fctx = self.repo.filectx(path, fileid=changeid) + + return fctx + def stripes(self, parity): "make horizontal stripes for easier reading" if self.stripecount: @@ -717,38 +726,31 @@ else: return 0 - def do_changelog(self, req): - if req.form.has_key('rev'): - hi = req.form['rev'][0] + def do_changelog(self, req, shortlog = False): + if req.form.has_key('node'): + ctx = self.changectx(req) else: - hi = self.repo.changelog.count() - 1 - try: - ctx = self.repo.changectx(hi) - except hg.RepoError: - req.write(self.search(hi)) # XXX redirect to 404 page? - return + if req.form.has_key('rev'): + hi = req.form['rev'][0] + else: + hi = self.repo.changelog.count() - 1 + try: + ctx = self.repo.changectx(hi) + except hg.RepoError: + req.write(self.search(hi)) # XXX redirect to 404 page? + return - req.write(self.changelog(ctx)) + req.write(self.changelog(ctx, shortlog = shortlog)) def do_shortlog(self, req): - if req.form.has_key('rev'): - hi = req.form['rev'][0] - else: - hi = self.repo.changelog.count() - 1 - try: - hi = self.repo.changectx(hi) - except hg.RepoError: - req.write(self.search(hi)) # XXX redirect to 404 page? - return - - req.write(self.changelog(ctx, shortlog = True)) + self.do_changelog(req, shortlog = True) def do_changeset(self, req): ctx = self.repo.changectx(req.form['node'][0]) req.write(self.changeset(ctx)) def do_manifest(self, req): - req.write(self.manifest(req.changectx, + req.write(self.manifest(self.changectx(req), self.cleanpath(req.form['path'][0]))) def do_tags(self, req): @@ -758,18 +760,16 @@ req.write(self.summary()) def do_filediff(self, req): - ctx = self.repo.changectx(req.form['node'][0]) - fctx = ctx.filectx(self.cleanpath(req.form['file'][0])) - req.write(self.filediff(fctx)) + req.write(self.filediff(self.filectx(req))) def do_file(self, req): - req.write(self.filerevision(req.filectx)) + req.write(self.filerevision(self.filectx(req))) def do_annotate(self, req): - req.write(self.fileannotate(req.filectx)) + req.write(self.fileannotate(self.filectx(req))) def do_filelog(self, req): - req.write(self.filelog(req.filectx)) + req.write(self.filelog(self.filectx(req))) def do_heads(self, req): resp = " ".join(map(hex, self.repo.heads())) + "\n"
--- a/mercurial/hgweb/hgwebdir_mod.py Mon Oct 02 08:36:29 2006 +0200 +++ b/mercurial/hgweb/hgwebdir_mod.py Mon Oct 02 08:40:26 2006 +0200 @@ -21,6 +21,7 @@ return [(name.strip(os.sep), path) for name, path in items] self.motd = "" + self.style = "" self.repos_sorted = ('name', False) if isinstance(config, (list, tuple)): self.repos = cleannames(config) @@ -32,8 +33,11 @@ cp = ConfigParser.SafeConfigParser() cp.read(config) self.repos = [] - if cp.has_section('web') and cp.has_option('web', 'motd'): - self.motd = cp.get('web', 'motd') + if cp.has_section('web'): + if cp.has_option('web', 'motd'): + self.motd = cp.get('web', 'motd') + if cp.has_option('web', 'style'): + self.style = cp.get('web', 'style') if cp.has_section('paths'): self.repos.extend(cleannames(cp.items('paths'))) if cp.has_section('collections'): @@ -66,6 +70,15 @@ yield tmpl("footer", motd=self.motd, **map) m = os.path.join(templater.templatepath(), "map") + style = self.style + if req.form.has_key('style'): + style = req.form['style'][0] + if style != "": + b = os.path.basename("map-" + style) + p = os.path.join(templater.templatepath(), b) + if os.path.isfile(p): + m = p + tmpl = templater.templater(m, templater.common_filters, defaults={"header": header, "footer": footer})
--- a/mercurial/httprepo.py Mon Oct 02 08:36:29 2006 +0200 +++ b/mercurial/httprepo.py Mon Oct 02 08:40:26 2006 +0200 @@ -165,7 +165,7 @@ proxyuser, proxypasswd or ''), proxypath, proxyquery, proxyfrag)) handler = urllib2.ProxyHandler({scheme: proxyurl}) - ui.debug(_('proxying through http://%s:%s\n') % + ui.debug(_('proxying through http://%s:%s\n') % (proxyhost, proxyport)) # urllib2 takes proxy values from the environment and those
--- a/mercurial/localrepo.py Mon Oct 02 08:36:29 2006 +0200 +++ b/mercurial/localrepo.py Mon Oct 02 08:40:26 2006 +0200 @@ -1760,6 +1760,6 @@ def instance(ui, path, create): return localrepository(ui, util.drop_scheme('file', path), create) - + def islocal(path): return True
--- a/mercurial/manifest.py Mon Oct 02 08:36:29 2006 +0200 +++ b/mercurial/manifest.py Mon Oct 02 08:40:26 2006 +0200 @@ -53,7 +53,7 @@ for f, n in self.parselines(delta): deltamap.rawset(f, n) return deltamap - + def read(self, node): if node == nullid: return manifestdict() # don't upset local cache if self.mapcache and self.mapcache[0] == node:
--- a/mercurial/patch.py Mon Oct 02 08:36:29 2006 +0200 +++ b/mercurial/patch.py Mon Oct 02 08:40:26 2006 +0200 @@ -128,7 +128,7 @@ self.op = 'MODIFY' self.copymod = False self.lineno = 0 - + # Filter patch for git information gitre = re.compile('diff --git a/(.*) b/(.*)') pf = file(patchname)
--- a/mercurial/repo.py Mon Oct 02 08:36:29 2006 +0200 +++ b/mercurial/repo.py Mon Oct 02 08:40:26 2006 +0200 @@ -9,6 +9,9 @@ class RepoError(Exception): pass +class LookupError(RepoError): + pass + class repository(object): def capable(self, name): '''tell whether repo supports named capability.
--- a/mercurial/sshserver.py Mon Oct 02 08:36:29 2006 +0200 +++ b/mercurial/sshserver.py Mon Oct 02 08:40:26 2006 +0200 @@ -124,7 +124,7 @@ def client_url(self): client = os.environ.get('SSH_CLIENT', '').split(' ', 1)[0] return 'remote:ssh:' + client - + def do_unbundle(self): their_heads = self.getarg()[1].split()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/index-gitweb.tmpl Mon Oct 02 08:40:26 2006 +0200 @@ -0,0 +1,23 @@ +#header# +<title>Mercurial repositories index</title> +</head> +<body> + +<div class="page_header"> +<a href="http://www.selenic.com/mercurial/" title="Mercurial"><div style="float:right;">Mercurial</div></a>Repositories list +</div> + +<table cellspacing="0"> + <tr> + <td><a href="?sort=#sort_name#">Name</a></td> + <td><a href="?sort=#sort_description#">Description</a></td> + <td><a href="?sort=#sort_contact#">Contact</a></td> + <td><a href="?sort=#sort_lastchange#">Last change</a></td> + <td> </td> + <tr> + #entries%indexentry# +</table> +<div class="page_footer"> +</div> +</body> +</html>
--- a/templates/map-gitweb Mon Oct 02 08:36:29 2006 +0200 +++ b/templates/map-gitweb Mon Oct 02 08:40:26 2006 +0200 @@ -48,3 +48,5 @@ shortlogentry = '<tr class="parity#parity#"><td class="age"><i>#date|age# ago</i></td><td><i>#author#</i></td><td><a class="list" href="?cmd=changeset;node=#node|short#;style=gitweb"><b>#desc|strip|firstline|escape#</b></a></td><td class="link"><a href="?cmd=changeset;node=#node|short#;style=gitweb">changeset</a> | <a href="?cmd=manifest;manifest=#node|short#;path=/;style=gitweb">manifest</a></td></tr>' filelogentry = '<tr class="parity#parity#"><td class="age"><i>#date|age# ago</i></td><td><a class="list" href="?cmd=changeset;node=#node|short#;style=gitweb"><b>#desc|strip|firstline|escape#</b></a></td><td class="link"><a href="?f=#node|short#;file=#file|urlescape#;style=gitweb">file</a> | <!-- FIXME: <a href="?fd=#node|short#;file=#file|urlescape#;style=gitweb">diff</a> | --> <a href="?fa=#node|short#;file=#file|urlescape#;style=gitweb">annotate</a> #rename%filelogrename#</td></tr>' archiveentry = ' | <a href="?ca=#node|short#;type=#type|urlescape#">#type|escape#</a> ' +indexentry = '<tr class="parity#parity#"><td><a class="list" href="#url#"><b>#name|escape#</b></a></td><td>#description#</td><td>#contact|obfuscate#</td><td class="age">#lastchange|age# ago</td><td class="indexlinks"><a class="rss_logo" href="#url#?cl=tip;style=rss">RSS</a> #archives%archiveentry#</td></tr>' +index = index-gitweb.tmpl
--- a/tests/coverage.py Mon Oct 02 08:36:29 2006 +0200 +++ b/tests/coverage.py Mon Oct 02 08:40:26 2006 +0200 @@ -87,19 +87,19 @@ self.excluded = excluded self.suite_spots = suite_spots self.excluding_suite = 0 - + def doRecursive(self, node): self.recordNodeLine(node) for n in node.getChildNodes(): self.dispatch(n) visitStmt = visitModule = doRecursive - + def doCode(self, node): if hasattr(node, 'decorators') and node.decorators: self.dispatch(node.decorators) self.doSuite(node, node.code) - + visitFunction = visitClass = doCode def getFirstLine(self, node): @@ -119,17 +119,17 @@ for n in node.getChildNodes(): lineno = max(lineno, self.getLastLine(n)) return lineno - + def doStatement(self, node): self.recordLine(self.getFirstLine(node)) visitAssert = visitAssign = visitAssTuple = visitDiscard = visitPrint = \ visitPrintnl = visitRaise = visitSubscript = visitDecorators = \ doStatement - + def recordNodeLine(self, node): return self.recordLine(node.lineno) - + def recordLine(self, lineno): # Returns a bool, whether the line is included or excluded. if lineno: @@ -153,9 +153,9 @@ self.statements[lineno] = 1 return 1 return 0 - + default = recordNodeLine - + def recordAndDispatch(self, node): self.recordNodeLine(node) self.dispatch(node) @@ -166,7 +166,7 @@ self.excluding_suite = 1 self.recordAndDispatch(body) self.excluding_suite = exsuite - + def doPlainWordSuite(self, prevsuite, suite): # Finding the exclude lines for else's is tricky, because they aren't # present in the compiler parse tree. Look at the previous suite, @@ -180,11 +180,11 @@ break else: self.doSuite(None, suite) - + def doElse(self, prevsuite, node): if node.else_: self.doPlainWordSuite(prevsuite, node.else_) - + def visitFor(self, node): self.doSuite(node, node.body) self.doElse(node.body, node) @@ -216,11 +216,11 @@ else: self.doSuite(a, h) self.doElse(node.handlers[-1][2], node) - + def visitTryFinally(self, node): self.doSuite(node, node.body) self.doPlainWordSuite(node.body, node.final) - + def visitGlobal(self, node): # "global" statements don't execute like others (they don't call the # trace function), so don't record their line numbers. @@ -240,7 +240,7 @@ # A dictionary with an entry for (Python source file name, line number # in that file) if that line has been executed. c = {} - + # A map from canonical Python source file name to a dictionary in # which there's an entry for each line number that has been # executed. @@ -266,12 +266,12 @@ self.xstack = [] self.relative_dir = os.path.normcase(os.path.abspath(os.curdir)+os.path.sep) - # t(f, x, y). This method is passed to sys.settrace as a trace function. - # See [van Rossum 2001-07-20b, 9.2] for an explanation of sys.settrace and + # t(f, x, y). This method is passed to sys.settrace as a trace function. + # See [van Rossum 2001-07-20b, 9.2] for an explanation of sys.settrace and # the arguments and return value of the trace function. # See [van Rossum 2001-07-20a, 3.2] for a description of frame and code # objects. - + def t(self, f, w, a): #pragma: no cover #print w, f.f_code.co_filename, f.f_lineno if w == 'line': @@ -279,7 +279,7 @@ for c in self.cstack: c[(f.f_code.co_filename, f.f_lineno)] = 1 return self.t - + def help(self, error=None): if error: print error @@ -330,7 +330,7 @@ self.help("You must specify at least one of -e, -x, -r, or -a.") if not args_needed and args: self.help("Unexpected arguments %s." % args) - + self.get_ready() self.exclude('#pragma[: ]+[nN][oO] [cC][oO][vV][eE][rR]') @@ -359,14 +359,14 @@ def use_cache(self, usecache): self.usecache = usecache - + def get_ready(self): if self.usecache and not self.cache: self.cache = os.path.abspath(os.environ.get(self.cache_env, self.cache_default)) self.restore() self.analysis_cache = {} - + def start(self): self.get_ready() if self.nesting == 0: #pragma: no cover @@ -374,7 +374,7 @@ if hasattr(threading, 'settrace'): threading.settrace(self.t) self.nesting += 1 - + def stop(self): self.nesting -= 1 if self.nesting == 0: #pragma: no cover @@ -398,7 +398,7 @@ def begin_recursive(self): self.cstack.append(self.c) self.xstack.append(self.exclude_re) - + def end_recursive(self): self.c = self.cstack.pop() self.exclude_re = self.xstack.pop() @@ -452,7 +452,7 @@ self.canonical_filename_cache[filename] = cf return self.canonical_filename_cache[filename] - # canonicalize_filenames(). Copy results from "c" to "cexecuted", + # canonicalize_filenames(). Copy results from "c" to "cexecuted", # canonicalizing filenames on the way. Clear the "c" map. def canonicalize_filenames(self): @@ -550,7 +550,7 @@ import parser tree = parser.suite(text+'\n\n').totuple(1) self.get_suite_spots(tree, suite_spots) - + # Use the compiler module to parse the text and find the executable # statements. We add newlines to be impervious to final partial lines. statements = {} @@ -713,7 +713,7 @@ except: if not ignore_errors: raise - + def annotate_file(self, filename, statements, excluded, missing, directory=None): source = open(filename, 'r') if directory: @@ -741,7 +741,7 @@ if self.blank_re.match(line): dest.write(' ') elif self.else_re.match(line): - # Special logic for lines containing only 'else:'. + # Special logic for lines containing only 'else:'. # See [GDR 2001-12-04b, 3.2]. if i >= len(statements) and j >= len(missing): dest.write('! ') @@ -850,7 +850,7 @@ # Thanks, Allen. # # 2005-12-02 NMB Call threading.settrace so that all threads are measured. -# Thanks Martin Fuzzey. Add a file argument to report so that reports can be +# Thanks Martin Fuzzey. Add a file argument to report so that reports can be # captured to a different destination. # # 2005-12-03 NMB coverage.py can now measure itself.
--- a/tests/md5sum.py Mon Oct 02 08:36:29 2006 +0200 +++ b/tests/md5sum.py Mon Oct 02 08:40:26 2006 +0200 @@ -16,7 +16,7 @@ except IOError, msg: sys.stderr.write('%s: Can\'t open: %s\n' % (filename, msg)) sys.exit(1) - + m = md5.new() try: while 1:
--- a/tests/run-tests.py Mon Oct 02 08:36:29 2006 +0200 +++ b/tests/run-tests.py Mon Oct 02 08:40:26 2006 +0200 @@ -104,7 +104,7 @@ # windows fallback shutil.copyfile(sys.executable, my_python) shutil.copymode(sys.executable, my_python) - + def install_hg(): vlog("# Performing temporary installation of HG") installerrs = os.path.join("tests", "install.err") @@ -358,7 +358,7 @@ args = os.listdir(".") for test in args: if (test.startswith("test-") and '~' not in test and - ('.' not in test or test.endswith('.py') or + ('.' not in test or test.endswith('.py') or test.endswith('.bat'))): ret = run_one(test) if ret is None: