Merge branch 'stable'
[stgit] / stgit / commands / files.py
index a7576e9..a2ed6a2 100644 (file)
@@ -22,6 +22,7 @@ from stgit.commands.common import *
 from stgit.utils import *
 from stgit.out import *
 from stgit import argparse, stack, git
+from stgit.lib import git as gitlib
 
 help = 'Show the files modified by a patch (or the current patch)'
 kind = 'patch'
@@ -33,6 +34,8 @@ given patch. Note that this command doesn't show the files modified in
 the working tree and not yet included in the patch by a 'refresh'
 command. Use the 'diff' or 'status' commands for these files."""
 
+args = [argparse.applied_patches, argparse.unapplied_patches,
+        argparse.hidden_patches]
 options = [
     opt('-s', '--stat', action = 'store_true',
         short = 'Show the diffstat'),
@@ -56,9 +59,13 @@ def func(parser, options, args):
     rev2 = git_id(crt_series, '%s' % patch)
 
     if options.stat:
-        out.stdout_raw(git.diffstat(git.diff(rev1 = rev1, rev2 = rev2)) + '\n')
+        output = gitlib.diffstat(git.diff(rev1 = rev1, rev2 = rev2,
+                                          diff_flags = options.diff_flags))
     elif options.bare:
-        out.stdout_raw(git.barefiles(rev1, rev2) + '\n')
+        output = git.barefiles(rev1, rev2)
     else:
-        out.stdout_raw(git.files(rev1, rev2, diff_flags = options.diff_flags)
-                       + '\n')
+        output = git.files(rev1, rev2, diff_flags = options.diff_flags)
+    if output:
+        if not output.endswith('\n'):
+            output += '\n'
+        out.stdout_raw(output)