Mercurial > hg
changeset 6135:be91a77b7f18
merge with crew
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Sat, 16 Feb 2008 13:34:11 +0100 |
parents | 7b937b26adf7 (diff) 1ee95f7df611 (current diff) |
children | acfb9fa494e2 |
files | mercurial/util.py |
diffstat | 3 files changed, 14 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Wed Feb 13 23:09:28 2008 +0100 +++ b/mercurial/commands.py Sat Feb 16 13:34:11 2008 +0100 @@ -78,7 +78,8 @@ detects as binary. With -a, annotate will generate an annotation anyway, probably with undesirable results. """ - getdate = util.cachefunc(lambda x: util.datestr(x[0].date())) + datefunc = ui.quiet and util.shortdate or util.datestr + getdate = util.cachefunc(lambda x: datefunc(x[0].date())) if not pats: raise util.Abort(_('at least one file name or pattern required')) @@ -1028,6 +1029,7 @@ prev = {} def display(fn, rev, states, prevstates): + datefunc = ui.quiet and util.shortdate or util.datestr found = False filerevmatches = {} r = prev.get(fn, -1) @@ -1043,6 +1045,8 @@ cols.append(change) if opts['user']: cols.append(ui.shortuser(get(r)[1])) + if opts.get('date'): + cols.append(datefunc(get(r)[2])) if opts['files_with_matches']: c = (fn, r) if c in filerevmatches: @@ -2740,8 +2744,8 @@ [('r', 'rev', '', _('annotate the specified revision')), ('f', 'follow', None, _('follow file copies and renames')), ('a', 'text', None, _('treat all files as text')), - ('u', 'user', None, _('list the author')), - ('d', 'date', None, _('list the date')), + ('u', 'user', None, _('list the author (long with -v)')), + ('d', 'date', None, _('list the date (short with -q)')), ('n', 'number', None, _('list the revision number (default)')), ('c', 'changeset', None, _('list the changeset')), ('l', 'line-number', None, @@ -2894,7 +2898,8 @@ _('print only filenames and revs that match')), ('n', 'line-number', None, _('print matching line numbers')), ('r', 'rev', [], _('search in given revision range')), - ('u', 'user', None, _('print user who committed change')), + ('u', 'user', None, _('list the author (long with -v)')), + ('d', 'date', None, _('list the date (short with -q)')), ] + walkopts, _('hg grep [OPTION]... PATTERN [FILE]...')), "heads":
--- a/mercurial/templatefilters.py Wed Feb 13 23:09:28 2008 +0100 +++ b/mercurial/templatefilters.py Sat Feb 16 13:34:11 2008 +0100 @@ -100,10 +100,6 @@ if f == -1: return util.shortuser(author) return author[:f].rstrip() -def shortdate(date): - '''turn (timestamp, tzoff) tuple into iso 8631 date.''' - return util.datestr(date, format='%Y-%m-%d', timezone=False) - def indent(text, prefix): '''indent each non-empty line of text after first with prefix.''' lines = text.splitlines() @@ -145,7 +141,7 @@ "rfc822date": lambda x: util.datestr(x, "%a, %d %b %Y %H:%M:%S"), "rfc3339date": lambda x: util.datestr(x, "%Y-%m-%dT%H:%M:%S", True, "%+03d:%02d"), "short": lambda x: x[:12], - "shortdate": shortdate, + "shortdate": util.shortdate, "stringify": templater.stringify, "strip": lambda x: x.strip(), "urlescape": lambda x: urllib.quote(x),
--- a/mercurial/util.py Wed Feb 13 23:09:28 2008 +0100 +++ b/mercurial/util.py Sat Feb 16 13:34:11 2008 +0100 @@ -1533,6 +1533,10 @@ s += timezone_format % (-tz / 3600, ((-tz % 3600) / 60)) return s +def shortdate(date=None): + """turn (timestamp, tzoff) tuple into iso 8631 date.""" + return datestr(date, format='%Y-%m-%d', timezone=False) + def strdate(string, format, defaults=[]): """parse a localized time string and return a (unixtime, offset) tuple. if the string cannot be parsed, ValueError is raised."""