~mdw
/
stgit
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
git.pretty_commit() re-implemented with "git show" (bug #10018)
[stgit]
/
stgit
/
commands
/
show.py
diff --git
a/stgit/commands/show.py
b/stgit/commands/show.py
index
2b22744
..
e6814d3
100644
(file)
--- a/
stgit/commands/show.py
+++ b/
stgit/commands/show.py
@@
-30,6
+30,7
@@
Show the commit log and the diff corresponding to the given
patches. The output is similar to that generated by the 'git show'
command."""
patches. The output is similar to that generated by the 'git show'
command."""
+directory = DirectoryHasRepository()
options = [make_option('-b', '--branch',
help = 'use BRANCH instead of the default one'),
make_option('-a', '--applied',
options = [make_option('-b', '--branch',
help = 'use BRANCH instead of the default one'),
make_option('-a', '--applied',
@@
-38,8
+39,8
@@
options = [make_option('-b', '--branch',
make_option('-u', '--unapplied',
help = 'show the unapplied patches',
action = 'store_true'),
make_option('-u', '--unapplied',
help = 'show the unapplied patches',
action = 'store_true'),
- make_option('-O', '--
diff
-opts',
- help = 'options to pass to
git-diff
')]
+ make_option('-O', '--
show
-opts',
+ help = 'options to pass to
"git show"
')]
def func(parser, options, args):
def func(parser, options, args):
@@
-55,16
+56,21
@@
def func(parser, options, args):
elif len(args) == 0:
patches = ['HEAD']
else:
elif len(args) == 0:
patches = ['HEAD']
else:
- patches = parse_patches(args, applied + unapplied +\
+ if len(args) == 1 and args[0].find('..') == -1 \
+ and not crt_series.patch_exists(args[0]):
+ # it might be just a commit id
+ patches = args
+ else:
+ patches = parse_patches(args, applied + unapplied +\
crt_series.get_hidden(), len(applied))
crt_series.get_hidden(), len(applied))
- if options.
diff
_opts:
-
diff_flags = options.diff
_opts.split()
+ if options.
show
_opts:
+
show_flags = options.show
_opts.split()
else:
else:
-
diff
_flags = []
+
show
_flags = []
- commit_ids = [git_id(patch) for patch in patches]
- commit_str = '\n'.join([git.pretty_commit(commit_id,
diff_flags=diff
_flags)
+ commit_ids = [git_id(
crt_series,
patch) for patch in patches]
+ commit_str = '\n'.join([git.pretty_commit(commit_id,
flags = show
_flags)
for commit_id in commit_ids])
if commit_str:
pager(commit_str)
for commit_id in commit_ids])
if commit_str:
pager(commit_str)