[patch 05/11] Make "stg files" output match "quilt files" one
From: Paolo 'Blaisorblade' Giarrusso <hidden>
Date: 2016-06-15 22:42:06
Subsystem:
the rest · Maintainer:
Linus Torvalds
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 <redacted> --- stgit/commands/files.py | 5 +++++ stgit/git.py | 10 ++++++++++ 2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/stgit/commands/files.py b/stgit/commands/files.py
--- a/stgit/commands/files.py
+++ b/stgit/commands/files.py@@ -35,6 +35,9 @@ command. Use the 'diff' or 'status' comm options = [make_option('-s', '--stat', help = 'show the diff stat', + action = 'store_true'), + make_option('-b', '--bare', + help = 'bare file names (useful for scripting)', action = 'store_true')]
@@ -53,5 +56,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)
diff --git a/stgit/git.py b/stgit/git.py
--- a/stgit/git.py
+++ b/stgit/git.py@@ -410,6 +410,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 """