merge with stable
authorMatt Mackall <mpm@selenic.com>
Wed, 24 Jun 2015 13:41:27 -0500
changeset 25662 ff5172c83002
parent 25661 20de1ace07a9 (current diff)
parent 25638 6047b60cdd09 (diff)
child 25663 edd2d20ac687
merge with stable
mercurial/match.py
mercurial/templater.py
tests/test-command-template.t
--- a/mercurial/match.py	Tue Jun 23 22:20:01 2015 -0700
+++ b/mercurial/match.py	Wed Jun 24 13:41:27 2015 -0500
@@ -505,6 +505,8 @@
     if kind == 're':
         return pat
     if kind == 'path':
+        if pat == '.':
+            return ''
         return '^' + util.re.escape(pat) + '(?:/|$)'
     if kind == 'relglob':
         return '(?:|.*/)' + _globre(pat) + globsuffix
--- a/mercurial/templater.py	Tue Jun 23 22:20:01 2015 -0700
+++ b/mercurial/templater.py	Wed Jun 24 13:41:27 2015 -0500
@@ -47,7 +47,7 @@
             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 @@
         # 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()
 
--- a/tests/test-command-template.t	Tue Jun 23 22:20:01 2015 -0700
+++ b/tests/test-command-template.t	Wed Jun 24 13:41:27 2015 -0500
@@ -2849,6 +2849,17 @@
   <>\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 @@
   Rev: 0
   Ancestor: 0
   
+  $ hg log --template '{revset("TIP"|lower)}\n' -l1
+  2
+
 Test active bookmark templating
 
   $ hg book foo
--- a/tests/test-locate.t	Tue Jun 23 22:20:01 2015 -0700
+++ b/tests/test-locate.t	Wed Jun 24 13:41:27 2015 -0500
@@ -106,6 +106,19 @@
   $ 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)