D2438: util: use util.shellquote() instead of repr() in date parse abort

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Mon Feb 26 01:02:17 EST 2018


durin42 updated this revision to Diff 6099.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2438?vs=6086&id=6099

REVISION DETAIL
  https://phab.mercurial-scm.org/D2438

AFFECTED FILES
  mercurial/util.py
  tests/test-commit.t
  tests/test-revset.t

CHANGE DETAILS

diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -413,7 +413,7 @@
   hg: parse error: invalid \x escape
   [255]
   $ log 'date(tip)'
-  hg: parse error: invalid date: 'tip'
+  hg: parse error: invalid date: tip
   [255]
   $ log '0:date'
   abort: unknown revision 'date'!
diff --git a/tests/test-commit.t b/tests/test-commit.t
--- a/tests/test-commit.t
+++ b/tests/test-commit.t
@@ -18,7 +18,7 @@
   hg: parse error: impossible time zone offset: 4444444
   [255]
   $ hg commit -d '1	15.1' -m commit-4
-  hg: parse error: invalid date: '1\t15.1'
+  hg: parse error: invalid date: '1	15.1'
   [255]
   $ hg commit -d 'foo bar' -m commit-5
   hg: parse error: invalid date: 'foo bar'
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -2192,7 +2192,7 @@
             else:
                 break
         else:
-            raise error.ParseError(_('invalid date: %r') % date)
+            raise error.ParseError(_('invalid date: %s') % shellquote(date))
     # validate explicit (probably user-specified) date and
     # time zone offset. values must fit in signed 32 bits for
     # current 32-bit linux runtimes. timezones go from UTC-12



To: durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list