merge with stable
authorMatt Mackall <mpm@selenic.com>
Wed, 07 Oct 2015 13:44:48 -0500
changeset 26504 875e5d89dc86
parent 26501 0748083f2898 (current diff)
parent 26503 5a84a453b503 (diff)
child 26505 6086ddc1fdc6
merge with stable
mercurial/templater.py
tests/test-command-template.t
--- a/hgext/notify.py	Fri Oct 02 13:00:47 2015 -0700
+++ b/hgext/notify.py	Wed Oct 07 13:44:48 2015 -0500
@@ -406,6 +406,8 @@
             return
         count += 1
         n.diff(ctx)
+        if not author:
+            author = ctx.user()
 
     data += ui.popbuffer()
     fromauthor = ui.config('notify', 'fromauthor')
--- a/mercurial/templater.py	Fri Oct 02 13:00:47 2015 -0700
+++ b/mercurial/templater.py	Wed Oct 07 13:44:48 2015 -0500
@@ -713,7 +713,7 @@
         splitter = None
 
     tokens = text.split(splitter)
-    if num >= len(tokens):
+    if num >= len(tokens) or num < -len(tokens):
         return ''
     else:
         return tokens[num]
--- a/tests/test-command-template.t	Fri Oct 02 13:00:47 2015 -0700
+++ b/tests/test-command-template.t	Wed Oct 07 13:44:48 2015 -0500
@@ -3448,6 +3448,11 @@
   hg: parse error: word expects an integer index
   [255]
 
+Test word for out of range
+
+  $ hg log -R a --template "{word(10000, desc)}"
+  $ hg log -R a --template "{word(-10000, desc)}"
+
 Test indent and not adding to empty lines
 
   $ hg log -T "-----\n{indent(desc, '>> ', ' > ')}\n" -r 0:1 -R a