Patchwork [Bug,5194] New: importing crecord.py changes locale environment, breaks date parsing/formatting

login
register
mail settings
Submitter mercurial-bugs@selenic.com
Date April 9, 2016, 4:59 a.m.
Message ID <bug-5194-285@https.bz.mercurial-scm.org/>
Download mbox | patch
Permalink /patch/14450/
State Not Applicable
Headers show

Comments

mercurial-bugs@selenic.com - April 9, 2016, 4:59 a.m.
https://bz.mercurial-scm.org/show_bug.cgi?id=5194

            Bug ID: 5194
           Summary: importing crecord.py changes locale environment,
                    breaks date parsing/formatting
           Product: Mercurial
           Version: default branch
          Hardware: PC
                OS: Windows
            Status: UNCONFIRMED
          Severity: bug
          Priority: normal
         Component: record
          Assignee: bugzilla@selenic.com
          Reporter: yuya@tcha.org
                CC: adrian@cadifra.com, mercurial-devel@selenic.com

crecord.py initializes the locale to the user's default, which changes
date formatting (and perhaps parsing.)

https://selenic.com/repo/hg/file/3.7.3/mercurial/crecord.py#l32

On Japanese Windows XP (32bit), I got the following test failure because
"Sep" isn't a valid month on Japanese locale of Windows.

$ ./run-tests.py -l test-doctest.py

Patch

--- z:/work/hghacks/mercurial-work/tests/test-doctest.py.out
+++ z:/work/hghacks/mercurial-work/tests/test-doctest.py.err
@@ -0,0 +1,28 @@ 
+**********************************************************************
+File "z:\work\hghacks\mercurial-work\mercurial\util.py", line 1745, in
mercurial.util.matchdate
+Failed example:
+    p5 = parsedate("Sep 15 10:30:00 1999")
+Exception raised:
+    Traceback (most recent call last):
+      File "c:\Python27\lib\doctest.py", line 1315, in __run
+        compileflags, 1) in test.globs
+      File "<doctest mercurial.util.matchdate[4]>", line 1, in <module>
+        p5 = parsedate("Sep 15 10:30:00 1999")
+      File "z:\work\hghacks\mercurial-work\mercurial\util.py", line 1717, in
parsedate
+        raise Abort(_('invalid date: %r') % date)
+    Abort: invalid date: 'Sep 15 10:30:00 1999'

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel