# HG changeset patch
# User Yuya Nishihara <y...@tcha.org>
# Date 1518013373 -32400
#      Wed Feb 07 23:22:53 2018 +0900
# Node ID 3e64e5f4d038708b258cec15c17a78d9d49adad3
# Parent  9ba1d0c724e21a17204224963bf1fa771a37a354
diff: remove fp.write() wrapper which drops label argument

It's no longer needed since we've split labeled write() from file-like
write().

diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py
--- a/mercurial/logcmdutil.py
+++ b/mercurial/logcmdutil.py
@@ -54,12 +54,6 @@ def diffordiffstat(ui, repo, diffopts, n
                    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 @@ def diffordiffstat(ui, repo, diffopts, n
                         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 @@ def diffordiffstat(ui, repo, diffopts, n
                 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]
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to