diff hgext/extdiff.py @ 37604:daafaff4e5be

export: enable formatter support (API) This change is basically the same as "hg cat". A formatter object is created by caller. .. api:: ``cmdutil.export()`` takes a formatter as an argument.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 12 Apr 2018 23:13:55 +0900
parents 6089ef933ab5
children 2ce60954b1b7
line wrap: on
line diff
--- a/hgext/extdiff.py	Thu Apr 12 22:59:49 2018 +0900
+++ b/hgext/extdiff.py	Thu Apr 12 23:13:55 2018 +0900
@@ -82,6 +82,7 @@
     cmdutil,
     error,
     filemerge,
+    formatter,
     pycompat,
     registrar,
     scmutil,
@@ -267,9 +268,11 @@
                 label2 = common_file + rev2
         else:
             template = 'hg-%h.patch'
-            cmdutil.export(repo, [repo[node1a].rev(), repo[node2].rev()],
-                           fntemplate=repo.vfs.reljoin(tmproot, template),
-                           match=matcher)
+            with formatter.nullformatter(ui, 'extdiff', {}) as fm:
+                cmdutil.export(repo, [repo[node1a].rev(), repo[node2].rev()],
+                               fm,
+                               fntemplate=repo.vfs.reljoin(tmproot, template),
+                               match=matcher)
             label1a = cmdutil.makefilename(repo[node1a], template)
             label2 = cmdutil.makefilename(repo[node2], template)
             dir1a = repo.vfs.reljoin(tmproot, label1a)