--- a/hgext/graphlog.py Wed Mar 16 17:43:43 2011 +0100
+++ b/hgext/graphlog.py Thu Mar 17 12:00:49 2011 -0500
@@ -324,6 +324,7 @@
except TypeError, e:
if len(args) > wrapfn.func_code.co_argcount:
raise util.Abort(_('--graph option allows at most one file'))
+ raise
return orig(*args, **kwargs)
entry = extensions.wrapcommand(table, cmd, graph)
entry[1].append(('G', 'graph', None, _("show the revision DAG")))
--- a/mercurial/archival.py Wed Mar 16 17:43:43 2011 +0100
+++ b/mercurial/archival.py Thu Mar 17 12:00:49 2011 -0500
@@ -9,7 +9,7 @@
from node import hex
import cmdutil
import util, encoding
-import cStringIO, os, stat, tarfile, time, zipfile
+import cStringIO, os, tarfile, time, zipfile
import zlib, gzip
def tidyprefix(dest, kind, prefix):
@@ -172,10 +172,10 @@
# unzip will not honor unix file modes unless file creator is
# set to unix (id 3).
i.create_system = 3
- ftype = stat.S_IFREG
+ ftype = 0x8000 # UNX_IFREG in unzip source code
if islink:
mode = 0777
- ftype = stat.S_IFLNK
+ ftype = 0xa000 # UNX_IFLNK in unzip source code
i.external_attr = (mode | ftype) << 16L
self.z.writestr(i, data)
--- a/mercurial/commands.py Wed Mar 16 17:43:43 2011 +0100
+++ b/mercurial/commands.py Thu Mar 17 12:00:49 2011 -0500
@@ -1237,7 +1237,7 @@
def debugrevspec(ui, repo, expr):
'''parse and apply a revision specification'''
if ui.verbose:
- tree = revset.parse(expr)
+ tree = revset.parse(expr)[0]
ui.note(tree, "\n")
func = revset.match(expr)
for c in func(repo, range(len(repo))):
--- a/mercurial/config.py Wed Mar 16 17:43:43 2011 +0100
+++ b/mercurial/config.py Thu Mar 17 12:00:49 2011 -0500
@@ -138,5 +138,5 @@
def read(self, path, fp=None, sections=None, remap=None):
if not fp:
- fp = open(path)
+ fp = util.posixfile(path)
self.parse(path, fp.read(), sections, remap, self.read)
--- a/mercurial/hgweb/hgwebdir_mod.py Wed Mar 16 17:43:43 2011 +0100
+++ b/mercurial/hgweb/hgwebdir_mod.py Thu Mar 17 12:00:49 2011 -0500
@@ -77,7 +77,10 @@
if not os.path.exists(self.conf):
raise util.Abort(_('config file %s not found!') % self.conf)
u.readconfig(self.conf, remap=map, trust=True)
- paths = u.configitems('hgweb-paths')
+ paths = []
+ for name, ignored in u.configitems('hgweb-paths'):
+ for path in u.configlist('hgweb-paths', name):
+ paths.append((name, path))
elif isinstance(self.conf, (list, tuple)):
paths = self.conf
elif isinstance(self.conf, dict):
--- a/mercurial/parser.py Wed Mar 16 17:43:43 2011 +0100
+++ b/mercurial/parser.py Thu Mar 17 12:00:49 2011 -0500
@@ -78,7 +78,9 @@
'generate a parse tree from a message'
self._iter = self._tokenizer(message)
self._advance()
- return self._parse()
+ res = self._parse()
+ token, value, pos = self.current
+ return res, pos
def eval(self, tree):
'recursively evaluate a parse tree using node methods'
if not isinstance(tree, tuple):
--- a/mercurial/revset.py Wed Mar 16 17:43:43 2011 +0100
+++ b/mercurial/revset.py Thu Mar 17 12:00:49 2011 -0500
@@ -394,7 +394,7 @@
for e in c.files() + [c.user(), c.description()]:
if gr.search(e):
l.append(r)
- continue
+ break
return l
def author(repo, subset, x):
@@ -423,7 +423,7 @@
for f in repo[r].files():
if m(f):
s.append(r)
- continue
+ break
return s
def contains(repo, subset, x):
@@ -438,13 +438,12 @@
for r in subset:
if pat in repo[r]:
s.append(r)
- continue
else:
for r in subset:
for f in repo[r].manifest():
if m(f):
s.append(r)
- continue
+ break
return s
def checkstatus(repo, subset, pat, field):
@@ -466,12 +465,11 @@
if fast:
if pat in files:
s.append(r)
- continue
else:
for f in files:
if m(f):
s.append(r)
- continue
+ break
return s
def modifies(repo, subset, x):
@@ -823,7 +821,9 @@
def match(spec):
if not spec:
raise error.ParseError(_("empty query"))
- tree = parse(spec)
+ tree, pos = parse(spec)
+ if (pos != len(spec)):
+ raise error.ParseError("invalid token", pos)
weight, tree = optimize(tree, True)
def mfunc(repo, subset):
return getset(repo, subset, tree)
--- a/mercurial/templatefilters.py Wed Mar 16 17:43:43 2011 +0100
+++ b/mercurial/templatefilters.py Thu Mar 17 12:00:49 2011 -0500
@@ -36,16 +36,22 @@
now = time.time()
then = date[0]
+ future = False
if then > now:
- return 'in the future'
-
- delta = max(1, int(now - then))
- if delta > agescales[0][1] * 2:
- return util.shortdate(date)
+ future = True
+ delta = max(1, int(then - now))
+ if delta > agescales[0][1] * 30:
+ return 'in the distant future'
+ else:
+ delta = max(1, int(now - then))
+ if delta > agescales[0][1] * 2:
+ return util.shortdate(date)
for t, s in agescales:
n = delta // s
if n >= 2 or s == 1:
+ if future:
+ return '%s from now' % fmt(t, n)
return '%s ago' % fmt(t, n)
def basename(path):
--- a/mercurial/templater.py Wed Mar 16 17:43:43 2011 +0100
+++ b/mercurial/templater.py Thu Mar 17 12:00:49 2011 -0500
@@ -69,7 +69,6 @@
else:
raise error.ParseError(_("syntax error"), pos)
pos += 1
- data[2] = pos
yield ('end', None, pos)
def compiletemplate(tmpl, context):
@@ -91,8 +90,8 @@
parsed.append(("string", tmpl[pos:n]))
pd = [tmpl, n + 1, stop]
- parsed.append(p.parse(pd))
- pos = pd[2]
+ parseres, pos = p.parse(pd)
+ parsed.append(parseres)
return [compileexp(e, context) for e in parsed]
--- a/tests/test-command-template.t Wed Mar 16 17:43:43 2011 +0100
+++ b/tests/test-command-template.t Thu Mar 17 12:00:49 2011 -0500
@@ -1115,7 +1115,7 @@
$ hg log --template '{date|age}\n' > /dev/null || exit 1
$ hg log -l1 --template '{date|age}\n'
- in the future
+ 8 years from now
$ hg log --template '{date|date}\n'
Wed Jan 01 10:01:00 2020 +0000
Mon Jan 12 13:46:40 1970 +0000
--- a/tests/test-revset.t Wed Mar 16 17:43:43 2011 +0100
+++ b/tests/test-revset.t Thu Mar 17 12:00:49 2011 -0500
@@ -356,3 +356,10 @@
9
$ log 'ancestors(8) and (heads(branch("-a-b-c-")) or heads(branch(é)))'
4
+
+issue2654: report a parse error if the revset was not completely parsed
+
+ $ log '1 OR 2'
+ hg: parse error at 2: invalid token
+ [255]
+