Mercurial > public > mercurial-scm > hg-stable
diff hgext/blackbox.py @ 48599:abbecb5cd6f3
blackbox: change year in logs to ISO 8601 format
AFAIK, year/month/day is not a format than anyone uses. It seems more
sensible to me to use ISO 8601, as that's standard and unambiguously
year-month-day.
Compatibility-wise, I think it's acceptable to change the default
format. It's most for human consumption. It's plausible that a few
tools parse this format, but it has already changed in the past (for
instance to add the current revision).
Differential Revision: https://phab.mercurial-scm.org/D12006
author | Valentin Gatien-Baron <valentin.gatienbaron@gmail.com> |
---|---|
date | Mon, 17 Jan 2022 21:20:46 -0500 |
parents | 011f5218ff2d |
children | 6000f5b25c9b |
line wrap: on
line diff
--- a/hgext/blackbox.py Mon Jan 17 21:00:33 2022 -0500 +++ b/hgext/blackbox.py Mon Jan 17 21:20:46 2022 -0500 @@ -141,7 +141,7 @@ # We want to display milliseconds (more precision seems # unnecessary). Since %.3f is not supported, use %f and truncate # microseconds. - date = dateutil.datestr(default, b'%Y/%m/%d %H:%M:%S.%f')[:-3] + date = dateutil.datestr(default, b'%Y-%m-%d %H:%M:%S.%f')[:-3] user = procutil.getuser() pid = b'%d' % procutil.getpid() changed = b'' @@ -227,9 +227,13 @@ if count >= limit: break - # count the commands by matching lines like: 2013/01/23 19:13:36 root> + # count the commands by matching lines like: + # 2013/01/23 19:13:36 root> + # 2013/01/23 19:13:36 root (1234)> + # 2013/01/23 19:13:36 root @0000000000000000000000000000000000000000 (1234)> + # 2013-01-23 19:13:36.000 root @0000000000000000000000000000000000000000 (1234)> if re.match( - br'^\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}(.\d*)? .*> .*', line + br'^\d{4}[-/]\d{2}[-/]\d{2} \d{2}:\d{2}:\d{2}(.\d*)? .*> .*', line ): count += 1 output.append(line)