Make "stg files" output match "quilt files" one
authorPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Fri, 16 Sep 2005 19:35:17 +0000 (21:35 +0200)
committerCatalin Marinas <catalin.marinas@gmail.com>
Sat, 17 Sep 2005 07:55:46 +0000 (08:55 +0100)
I'm used to doing vi $(quilt files), which is impossible with stgit.
Add an option (-b/--base) to request the normal behaviour, but make it
non-default as the current output is useful.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
stgit/commands/files.py
stgit/git.py

index d81bc25..4b44f72 100644 (file)
@@ -38,6 +38,10 @@ options = [make_option('-s', '--stat',
                        action = 'store_true'),
            make_option('-b', '--branch',
                        help = 'use BRANCH instead of the default one')]
+                       action = 'store_true'),
+           make_option('--bare',
+                       help = 'bare file names (useful for scripting)',
+                       action = 'store_true')]
 
 
 def func(parser, options, args):
@@ -55,5 +59,7 @@ def func(parser, options, args):
 
     if options.stat:
         print git.diffstat(rev1 = rev1, rev2 = rev2)
+    elif options.bare:
+        print git.barefiles(rev1, rev2)
     else:
         print git.files(rev1, rev2)
index ae5506b..2661622 100644 (file)
@@ -421,6 +421,16 @@ def files(rev1, rev2):
 
     return str.rstrip()
 
+def barefiles(rev1, rev2):
+    """Return the files modified between rev1 and rev2, without status info
+    """
+
+    str = ''
+    for line in _output_lines('git-diff-tree -r %s %s' % (rev1, rev2)):
+        str += '%s\n' % line.rstrip().split(' ',4)[-1].split('\t',1)[-1]
+
+    return str.rstrip()
+
 def checkout(files = [], tree_id = None, force = False):
     """Check out the given or all files
     """