Mercurial > hg-stable
diff mercurial/logcmdutil.py @ 36046:006ff7268c5c
diff: remove fp.write() wrapper which drops label argument
It's no longer needed since we've split labeled write() from file-like
write().
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 07 Feb 2018 23:22:53 +0900 |
parents | 29b83c08afe0 |
children | c1104fe76e69 |
line wrap: on
line diff
--- a/mercurial/logcmdutil.py Sun Jan 21 15:54:18 2018 +0900 +++ b/mercurial/logcmdutil.py Wed Feb 07 23:22:53 2018 +0900 @@ -54,12 +54,6 @@ changes=None, stat=False, fp=None, prefix='', root='', listsubrepos=False, hunksfilterfn=None): '''show diff or diffstat.''' - if fp is None: - write = ui.write - else: - def write(s, **kw): - fp.write(s) - if root: relroot = pathutil.canonpath(repo.root, repo.getcwd(), root) else: @@ -85,10 +79,11 @@ hunksfilterfn=hunksfilterfn) if fp is not None or ui.canwritewithoutlabels(): + out = fp or ui if stat: chunks = patch.diffstat(util.iterlines(chunks), width=width) for chunk in util.filechunkiter(util.chunkbuffer(chunks)): - write(chunk) + out.write(chunk) else: if stat: chunks = patch.diffstatui(util.iterlines(chunks), width=width) @@ -100,10 +95,10 @@ for chunk, label in chunks: yield ui.label(chunk, label=label) for chunk in util.filechunkiter(util.chunkbuffer(gen())): - write(chunk) + ui.write(chunk) else: for chunk, label in chunks: - write(chunk, label=label) + ui.write(chunk, label=label) if listsubrepos: ctx1 = repo[node1]