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

login
register
mail settings
Submitter phabricator
Date Feb. 26, 2018, 6:02 a.m.
Message ID <5c112f420c4a318248693a6a18a0944a@localhost.localdomain>
Download mbox | patch
Permalink /patch/28380/
State Not Applicable
Headers show

Comments

phabricator - Feb. 26, 2018, 6:02 a.m.
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




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

Patch

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