diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -505,6 +505,8 @@ def _regex(kind, pat, globsuffix): if kind == 're': return pat if kind == 'path': + if pat == '.': + return '' return '^' + util.re.escape(pat) + '(?:/|$)' if kind == 'relglob': return '(?:|.*/)' + _globre(pat) + globsuffix diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -47,7 +47,7 @@ def tokenize(program, start, end): s = pos while pos < end: # find closing quote d = program[pos] - if decode and d == '\\': # skip over escaped characters + if d == '\\': # skip over escaped characters pos += 2 continue if d == c: @@ -450,7 +450,7 @@ def revset(context, mapping, args): # i18n: "revset" is a keyword raise error.ParseError(_("revset expects one or more arguments")) - raw = args[0][1] + raw = stringify(args[0][0](context, mapping, args[0][1])) ctx = mapping['ctx'] repo = ctx.repo() diff --git a/tests/test-command-template.t b/tests/test-command-template.t --- a/tests/test-command-template.t +++ b/tests/test-command-template.t @@ -2849,6 +2849,17 @@ Test string escaping: <>\n<]> <>\n< +Test string escaping of quotes: + + $ hg log -Ra -r0 -T '{"\""}\n' + " + $ hg log -Ra -r0 -T '{"\\\""}\n' + \" + $ hg log -Ra -r0 -T '{r"\""}\n' + \" + $ hg log -Ra -r0 -T '{r"\\\""}\n' + \\\" + Test exception in quoted template. single backslash before quotation mark is stripped before parsing: @@ -3121,6 +3132,9 @@ Test revset function Rev: 0 Ancestor: 0 + $ hg log --template '{revset("TIP"|lower)}\n' -l1 + 2 + Test active bookmark templating $ hg book foo diff --git a/tests/test-locate.t b/tests/test-locate.t --- a/tests/test-locate.t +++ b/tests/test-locate.t @@ -106,6 +106,19 @@ Issue294: hg remove --after dir fails wh $ mkdir otherdir $ cd otherdir + $ hg files path: + ../b (glob) + ../dir.h/foo (glob) + ../t.h (glob) + ../t/e.h (glob) + ../t/x (glob) + $ hg files path:. + ../b (glob) + ../dir.h/foo (glob) + ../t.h (glob) + ../t/e.h (glob) + ../t/x (glob) + $ hg locate b ../b (glob) ../t/b (glob)