chiark
/
gitweb
/
~mdw
/
stgit
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Refactoring: move shared options to their own module
[stgit]
/
stgit
/
commands
/
files.py
diff --git
a/stgit/commands/files.py
b/stgit/commands/files.py
index b43b12f87457411b7082250ec9346489213089b8..cdb0b526f9bdafb739b3894930a257f05e975de0 100644
(file)
--- a/
stgit/commands/files.py
+++ b/
stgit/commands/files.py
@@
-22,11
+22,10
@@
from optparse import OptionParser, make_option
from stgit.commands.common import *
from stgit.utils import *
from stgit.out import *
from stgit.commands.common import *
from stgit.utils import *
from stgit.out import *
-from stgit import stack, git
-
+from stgit import argparse, stack, git
help = 'show the files modified by a patch (or the current patch)'
help = 'show the files modified by a patch (or the current patch)'
-usage = """%prog [options] [<patch>]
+usage = """%prog [options] [
[<branch>:]
<patch>]
List the files modified by the given patch (defaulting to the current
one). Passing the '--stat' option shows the diff statistics for the
List the files modified by the given patch (defaulting to the current
one). Passing the '--stat' option shows the diff statistics for the
@@
-38,26
+37,23
@@
directory = DirectoryHasRepository()
options = [make_option('-s', '--stat',
help = 'show the diff stat',
action = 'store_true'),
options = [make_option('-s', '--stat',
help = 'show the diff stat',
action = 'store_true'),
- make_option('-b', '--branch',
- help = 'use BRANCH instead of the default one'),
make_option('--bare',
help = 'bare file names (useful for scripting)',
action = 'store_true')
make_option('--bare',
help = 'bare file names (useful for scripting)',
action = 'store_true')
- ] + make_diff_opts_option()
-
+ ] + argparse.diff_opts_option()
def func(parser, options, args):
"""Show the files modified by a patch (or the current patch)
"""
if len(args) == 0:
def func(parser, options, args):
"""Show the files modified by a patch (or the current patch)
"""
if len(args) == 0:
- patch = ''
+ patch = '
HEAD
'
elif len(args) == 1:
patch = args[0]
else:
parser.error('incorrect number of arguments')
elif len(args) == 1:
patch = args[0]
else:
parser.error('incorrect number of arguments')
- rev1 = git_id(crt_series, '%s
//bottom
' % patch)
- rev2 = git_id(crt_series, '%s
//top
' % patch)
+ rev1 = git_id(crt_series, '%s
^
' % patch)
+ rev2 = git_id(crt_series, '%s' % patch)
if options.stat:
out.stdout_raw(git.diffstat(git.diff(rev1 = rev1, rev2 = rev2)) + '\n')
if options.stat:
out.stdout_raw(git.diffstat(git.diff(rev1 = rev1, rev2 = rev2)) + '\n')