Mercurial > hg
changeset 39702:a7b91509776d
journal: inline formatted nodes and date into expression
The variable name "str" was misleading since these values aren't always
strings.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 03 Sep 2018 07:52:24 +0900 |
parents | dea771e63c3c |
children | 2fb88fa2b337 |
files | hgext/journal.py |
diffstat | 1 files changed, 7 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/journal.py Mon Sep 03 07:48:43 2018 +0900 +++ b/hgext/journal.py Mon Sep 03 07:52:24 2018 +0900 @@ -477,6 +477,8 @@ name = args[0] fm = ui.formatter('journal', opts) + def formatnodes(nodes): + return fm.formatlist(map(fm.hexfunc, nodes), name='node', sep=',') if opts.get("template") != "json": if name is None: @@ -491,21 +493,18 @@ for count, entry in enumerate(repo.journal.filtered(name=name)): if count == limit: break - newhashesstr = fm.formatlist(map(fm.hexfunc, entry.newhashes), - name='node', sep=',') - oldhashesstr = fm.formatlist(map(fm.hexfunc, entry.oldhashes), - name='node', sep=',') fm.startitem() - fm.condwrite(ui.verbose, 'oldnodes', '%s -> ', oldhashesstr) - fm.write('newnodes', '%s', newhashesstr) + fm.condwrite(ui.verbose, 'oldnodes', '%s -> ', + formatnodes(entry.oldhashes)) + fm.write('newnodes', '%s', formatnodes(entry.newhashes)) fm.condwrite(ui.verbose, 'user', ' %-8s', entry.user) fm.condwrite( opts.get('all') or name.startswith('re:'), 'name', ' %-8s', entry.name) - timestring = fm.formatdate(entry.timestamp, '%Y-%m-%d %H:%M %1%2') - fm.condwrite(ui.verbose, 'date', ' %s', timestring) + fm.condwrite(ui.verbose, 'date', ' %s', + fm.formatdate(entry.timestamp, '%Y-%m-%d %H:%M %1%2')) fm.write('command', ' %s\n', entry.command) if opts.get("commits"):