changeset 24188:5a7920c4d2ea

util: accept "now, today, yesterday" for dates even the locale is not english Hi there! 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. We have here a jenkins with build jobs on different slaves that will do some operations with "dates" parameter. Some systems uses English locale and some systems uses German locale. So we needed to configure the job to uses other date names. As this is really annoying to keep the systems locale in mind for some operations I looked into util.py. It would be helpful for automated systems if the "default English" date names would even usable on other locales. I attached a simple patch for this. Best regards André Klitzing
author André Klitzing <aklitzing@gmail.com>
date Tue, 24 Feb 2015 14:12:13 +0100
parents 30219bd46ed7
children 8b4b9ee6001a
files mercurial/util.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Fri Feb 27 14:26:22 2015 -0800
+++ b/mercurial/util.py	Tue Feb 24 14:12:13 2015 +0100
@@ -1352,11 +1352,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')