Patchwork Add support for english date names on non-english systems

login
register
mail settings
Submitter A. Klitzing
Date Feb. 27, 2015, 11:29 a.m.
Message ID <CAJaftdhgYBNbX4VGF3f1ATzZUxF9wKz3ZU5RC+uXLgfO9xWmXw@mail.gmail.com>
Download mbox | patch
Permalink /patch/7846/
State Deferred
Headers show

Comments

A. Klitzing - Feb. 27, 2015, 11:29 a.m.
Hi!

Thanks for your reply. I attached a new patch with improved commit message.
;-)

Best regards
  André Klitzing


2015-02-24 16:26 GMT+01:00 Yuya Nishihara <yuya@tcha.org>:

> You should include these in commit messages.
>

Patch

# HG changeset patch
# User André Klitzing <aklitzing@gmail.com>
# Date 1424783533 -3600
#      Tue Feb 24 14:12:13 2015 +0100
# Node ID 619543a27d036264977bd5ca97be688416ce4cc9
# Parent  ff5caa8dfd993680d9602ca6ebb14da9de10d5f4
util: accept "now, today, yesterday" for dates even the locale is not english

Fixed date names are helpful for automated systems. So it is possible to
use english date parameter even if the underlying system uses another
locale.

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1350,11 +1350,11 @@ 
         formats = defaultdateformats
     date = date.strip()
 
-    if date == _('now'):
+    if date == 'now' or date == _('now'):
         return makedate()
-    if date == _('today'):
+    if date == 'today' or date == _('today'):
         date = datetime.date.today().strftime('%b %d')
-    elif date == _('yesterday'):
+    elif date == 'yesterday' or date == _('yesterday'):
         date = (datetime.date.today() -
                 datetime.timedelta(days=1)).strftime('%b %d')