Mercurial > hg-stable
changeset 37328:11d51e518808
obsutil: make obsfateprinter() less dependent on templater
joinfmt() is defined as 'lambda x: scmutil.formatchangeid(repo[x])' in
showsuccsandmarkers().
Function arguments are reordered so they look more normal.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 19 Mar 2018 20:32:06 +0900 |
parents | ebf139cbd4a1 |
children | 676664592313 |
files | mercurial/obsutil.py mercurial/templatekw.py |
diffstat | 2 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/obsutil.py Sat Mar 17 22:06:31 2018 +0900 +++ b/mercurial/obsutil.py Mon Mar 19 20:32:06 2018 +0900 @@ -832,7 +832,7 @@ return sorted(operations) -def obsfateprinter(successors, markers, ui): +def obsfateprinter(ui, repo, successors, markers, formatctx): """ Build a obsfate string for a single successorset using all obsfate related function defined in obsutil """ @@ -852,7 +852,7 @@ # Successors if successors: - fmtsuccessors = [successors.joinfmt(succ) for succ in successors] + fmtsuccessors = [formatctx(repo[succ]) for succ in successors] line.append(" as %s" % ", ".join(fmtsuccessors)) # Users
--- a/mercurial/templatekw.py Sat Mar 17 22:06:31 2018 +0900 +++ b/mercurial/templatekw.py Mon Mar 19 20:32:06 2018 +0900 @@ -498,10 +498,13 @@ succsandmarkers = showsuccsandmarkers(context, mapping) ui = context.resource(mapping, 'ui') + repo = context.resource(mapping, 'repo') values = [] for x in succsandmarkers: - values.append(obsutil.obsfateprinter(x['successors'], x['markers'], ui)) + v = obsutil.obsfateprinter(ui, repo, x['successors'], x['markers'], + scmutil.formatchangeid) + values.append(v) return compatlist(context, mapping, "fate", values)