merge with stable
authorMatt Mackall <mpm@selenic.com>
Mon, 04 May 2015 13:15:15 -0500
changeset 24919 e5b507efb36e
parent 24918 2eac3ae0d088 (current diff)
parent 24906 a4ee6f774f14 (diff)
child 24921 86c0b5c09ee6
merge with stable
--- a/mercurial/commands.py	Wed Apr 22 12:33:08 2015 -0700
+++ b/mercurial/commands.py	Mon May 04 13:15:15 2015 -0500
@@ -105,7 +105,7 @@
 # hidden for now
 formatteropts = [
     ('T', 'template', '',
-     _('display with template (DEPRECATED)'), _('TEMPLATE')),
+     _('display with template (EXPERIMENTAL)'), _('TEMPLATE')),
 ]
 
 templateopts = [
--- a/mercurial/revset.py	Wed Apr 22 12:33:08 2015 -0700
+++ b/mercurial/revset.py	Mon May 04 13:15:15 2015 -0500
@@ -1294,7 +1294,10 @@
     # i18n: "id" is a keyword
     n = getstring(l[0], _("id requires a string"))
     if len(n) == 40:
-        rn = repo[n].rev()
+        try:
+            rn = repo.changelog.rev(node.bin(n))
+        except (LookupError, TypeError):
+            rn = None
     else:
         rn = None
         pm = repo.changelog._partialmatch(n)
--- a/mercurial/templater.py	Wed Apr 22 12:33:08 2015 -0700
+++ b/mercurial/templater.py	Mon May 04 13:15:15 2015 -0500
@@ -226,10 +226,17 @@
         raise error.ParseError(_("date expects one or two arguments"))
 
     date = args[0][0](context, mapping, args[0][1])
+    fmt = None
     if len(args) == 2:
         fmt = stringify(args[1][0](context, mapping, args[1][1]))
-        return util.datestr(date, fmt)
-    return util.datestr(date)
+    try:
+        if fmt is None:
+            return util.datestr(date)
+        else:
+            return util.datestr(date, fmt)
+    except (TypeError, ValueError):
+        # i18n: "date" is a keyword
+        raise error.ParseError(_("date expects a date information"))
 
 def diff(context, mapping, args):
     """:diff([includepattern [, excludepattern]]): Show a diff, optionally
--- a/mercurial/util.py	Wed Apr 22 12:33:08 2015 -0700
+++ b/mercurial/util.py	Mon May 04 13:15:15 2015 -0500
@@ -877,7 +877,7 @@
     Requires a path (like /foo/.hg) ending with a foldable final
     directory component.
     """
-    s1 = os.stat(path)
+    s1 = os.lstat(path)
     d, b = os.path.split(path)
     b2 = b.upper()
     if b == b2:
@@ -886,7 +886,7 @@
             return True # no evidence against case sensitivity
     p2 = os.path.join(d, b2)
     try:
-        s2 = os.stat(p2)
+        s2 = os.lstat(p2)
         if s2 == s1:
             return False
         return True
--- a/tests/test-command-template.t	Wed Apr 22 12:33:08 2015 -0700
+++ b/tests/test-command-template.t	Mon May 04 13:15:15 2015 -0500
@@ -2236,6 +2236,12 @@
   date: 70 01 01 01 +0000
   date: 70 01 01 00 +0000
 
+Test invalid date:
+
+  $ hg log -R latesttag -T '{date(rev)}\n'
+  hg: parse error: date expects a date information
+  [255]
+
 Test string escaping:
 
   $ hg log -R latesttag -r 0 --template '>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
--- a/tests/test-revset.t	Wed Apr 22 12:33:08 2015 -0700
+++ b/tests/test-revset.t	Mon May 04 13:15:15 2015 -0500
@@ -87,6 +87,7 @@
   $ hg ci -Aqm9
 
   $ hg tag -r6 1.0
+  $ hg bookmark -r6 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
   $ hg clone --quiet -U -r 7 . ../remote1
   $ hg clone --quiet -U -r 8 . ../remote2
@@ -554,6 +555,23 @@
   hg: parse error: rev expects a number
   [255]
 
+Test hexadecimal revision
+  $ log 'id(2)'
+  abort: 00changelog.i@2: ambiguous identifier!
+  [255]
+  $ log 'id(23268)'
+  4
+  $ log 'id(2785f51eece)'
+  0
+  $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532c)'
+  8
+  $ log 'id(d5d0dcbdc4a)'
+  $ log 'id(d5d0dcbdc4w)'
+  $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532d)'
+  $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532q)'
+  $ log 'id(1.0)'
+  $ log 'id(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)'
+
 Test null revision
   $ log '(null)'
   -1
--- a/tests/test-subrepo-git.t	Wed Apr 22 12:33:08 2015 -0700
+++ b/tests/test-subrepo-git.t	Mon May 04 13:15:15 2015 -0500
@@ -381,6 +381,20 @@
   $ hg commit --subrepos -qm missing
   abort: subrepo s is missing (in subrepo s)
   [255]
+
+#if symlink
+Don't crash if subrepo is a broken symlink
+  $ ln -s broken s
+  $ hg status -S
+  $ hg push -q
+  abort: subrepo s is missing (in subrepo s)
+  [255]
+  $ hg commit --subrepos -qm missing
+  abort: subrepo s is missing (in subrepo s)
+  [255]
+  $ rm s
+#endif
+
   $ hg update -C 2> /dev/null
   cloning subrepo s from $TESTTMP/gitroot
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved