Some clean-up to only access the current series object if needed.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
"""
if not rev:
return None
"""
if not rev:
return None
+
+ # try a GIT revision first
+ try:
+ return git.rev_parse(rev + '^{commit}')
+ except git.GitException:
+ pass
+
+ # try an StGIT patch name
try:
patch, branch, patch_id = parse_rev(rev)
if branch == None:
try:
patch, branch, patch_id = parse_rev(rev)
if branch == None:
return series.get_base()
except RevParseException:
pass
return series.get_base()
except RevParseException:
pass
- return git.rev_parse(rev + '^{commit}')
+ except stack.StackException:
+ pass
+
+ raise CmdException, 'Unknown patch or revision: %s' % rev
def check_local_changes():
if git.local_changes():
def check_local_changes():
if git.local_changes():
def func(parser, options, args):
"""Show commit log and diff
"""
def func(parser, options, args):
"""Show commit log and diff
"""
- applied = crt_series.get_applied()
- unapplied = crt_series.get_unapplied()
-
+ patches = crt_series.get_applied()
+ patches = crt_series.get_unapplied()
elif len(args) == 0:
patches = ['HEAD']
else:
elif len(args) == 0:
patches = ['HEAD']
else:
- if len(args) == 1 and args[0].find('..') == -1 \
- and not crt_series.patch_exists(args[0]):
- # it might be just a commit id
+ if len(args) == 1 and args[0].find('..') == -1:
+ # single patch or commit id
- patches = parse_patches(args, applied + unapplied +\
- crt_series.get_hidden(), len(applied))
+ applied = crt_series.get_applied()
+ unapplied = crt_series.get_unapplied()
+ patches = parse_patches(args, applied + unapplied + \
+ crt_series.get_hidden(), len(applied))
if options.show_opts:
show_flags = options.show_opts.split()
if options.show_opts:
show_flags = options.show_opts.split()
-test_expect_failure 'Diff with no StGit data' '
+test_expect_success 'Diff with no StGit data' '
-test_expect_failure 'Diff with some local changes' '
+test_expect_success 'Diff with some local changes' '