diff mercurial/subrepo.py @ 32584:746e12a767b3

cat: add formatter support This is an example showing how formatter can handle the --output option. git subrepo isn't supported for now.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 25 May 2017 21:53:44 +0900
parents f4cd4c49e302
children bf2daeddd42b
line wrap: on
line diff
--- a/mercurial/subrepo.py	Sat May 27 17:58:36 2017 +0900
+++ b/mercurial/subrepo.py	Thu May 25 21:53:44 2017 +0900
@@ -538,7 +538,7 @@
         self.ui.warn("%s: %s" % (prefix, _("addremove is not supported")))
         return 1
 
-    def cat(self, match, fntemplate, prefix, **opts):
+    def cat(self, match, fm, fntemplate, prefix, **opts):
         return 1
 
     def status(self, rev2, **opts):
@@ -767,11 +767,11 @@
                                  dry_run, similarity)
 
     @annotatesubrepoerror
-    def cat(self, match, fntemplate, prefix, **opts):
+    def cat(self, match, fm, fntemplate, prefix, **opts):
         rev = self._state[1]
         ctx = self._repo[rev]
-        return cmdutil.cat(self.ui, self._repo, ctx, match, fntemplate, prefix,
-                           **opts)
+        return cmdutil.cat(self.ui, self._repo, ctx, match, fm, fntemplate,
+                           prefix, **opts)
 
     @annotatesubrepoerror
     def status(self, rev2, **opts):
@@ -1833,7 +1833,7 @@
 
 
     @annotatesubrepoerror
-    def cat(self, match, fntemplate, prefix, **opts):
+    def cat(self, match, fm, fntemplate, prefix, **opts):
         rev = self._state[1]
         if match.anypats():
             return 1 #No support for include/exclude yet
@@ -1841,6 +1841,7 @@
         if not match.files():
             return 1
 
+        # TODO: add support for non-plain formatter (see cmdutil.cat())
         for f in match.files():
             output = self._gitcommand(["show", "%s:%s" % (rev, f)])
             fp = cmdutil.makefileobj(self._subparent, fntemplate,