From patchwork Fri Feb 27 15:15:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: Add support for english date names on non-english systems From: =?utf-8?q?Jordi_Guti=C3=A9rrez_Hermoso?= X-Patchwork-Id: 7847 Message-Id: <1425050122.15413.9.camel@Iris> To: "A. Klitzing" Cc: mercurial-devel@selenic.com Date: Fri, 27 Feb 2015 10:15:22 -0500 On Fri, 2015-02-27 at 12:29 +0100, A. Klitzing wrote: > Thanks for your reply. I attached a new patch with improved commit > message. What Yuya meant is that we expected in the body of your email a commit like the one below. That is, the commit message should be the body of your email message. Yes, put your blog post in your commit message. Include a poem, if you want. Or a novel that proceeds as slowly as life itself about an adulterous woman, disgraced by Russian society, who suicides on the train tracks. Make your commit message lyrical, gigantic, beautiful. Or if you possess the soul of wit and have time to make it shorter, do so. Anything you have to say should go in the commit message. Look at some examples in `hg log -v`. The Mercurial patchbomb extension can help you do this. # HG changeset patch # User André Klitzing # 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 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 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')