changeset 26504:875e5d89dc86

merge with stable
author Matt Mackall <mpm@selenic.com>
date Wed, 07 Oct 2015 13:44:48 -0500
parents 0748083f2898 (current diff) 5a84a453b503 (diff)
children 6086ddc1fdc6
files mercurial/templater.py tests/test-command-template.t
diffstat 3 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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