X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/64354a2d7d5f11f2592f72b74b48d750cf00c6f7..eff17c6baeb62c32a79ec6720c3c873f6ba778be:/stgit/commands/log.py diff --git a/stgit/commands/log.py b/stgit/commands/log.py index 033c797..ebd8cab 100644 --- a/stgit/commands/log.py +++ b/stgit/commands/log.py @@ -36,39 +36,61 @@ can be one of the following: push(f) - the patch was fast-forwarded undo - the patch boundaries were restored to the old values -Note that only the diffs shown in the 'refresh' and 'undo' actions are -meaningful for the patch changes. The 'push' actions represent the -changes to the entire base of the current patch. Conflicts reset the -patch content and a subsequent 'refresh' will show the entire patch.""" +Note that only the diffs shown in the 'refresh', 'undo' and 'sync' +actions are meaningful for the patch changes. The 'push' actions +represent the changes to the entire base of the current +patch. Conflicts reset the patch content and a subsequent 'refresh' +will show the entire patch.""" options = [make_option('-b', '--branch', help = 'use BRANCH instead of the default one'), make_option('-p', '--patch', help = 'show the refresh diffs', action = 'store_true'), + make_option('-f', '--full', + help = 'show the full commit ids', + action = 'store_true'), make_option('-g', '--graphical', help = 'run gitk instead of printing', action = 'store_true')] -def show_log(log, show_patch): +def show_log(log, options): """List the patch changelog """ commit = git.get_commit(log) diff_str = '' while commit: - descr = commit.get_log().rstrip() + log = commit.get_log().split('\n') + + cmd_rev = log[0].split() + if len(cmd_rev) >= 2: + cmd = cmd_rev[0] + rev = cmd_rev[1] + elif len(cmd_rev) == 1: + cmd = cmd_rev[0] + rev = '' + else: + cmd = rev = '' - if show_patch: - if descr.startswith('refresh') or descr.startswith('undo'): + if options.patch: + if cmd in ['refresh', 'undo', 'sync']: diff_str = '%s%s\n' % (diff_str, git.pretty_commit(commit.get_id_hash())) else: + if len(log) >= 3: + notes = log[2] + else: + notes = '' author_name, author_email, author_date = \ name_email_date(commit.get_author()) secs, tz = author_date.split() date = '%s %s' % (time.ctime(int(secs)), tz) - print descr, date + if options.full: + out.stdout('%-7s %-40s %s' % (cmd[:7], rev[:40], date)) + else: + out.stdout('%-8s [%-7s] %-28s %s' % \ + (rev[:8], cmd[:7], notes[:28], date)) parent = commit.get_parent() if parent: @@ -76,7 +98,7 @@ def show_log(log, show_patch): else: commit = None - if show_patch and diff_str: + if options.patch and diff_str: pager(diff_str.rstrip()) def func(parser, options, args): @@ -88,7 +110,8 @@ def func(parser, options, args): raise CmdException, 'No patches applied' elif len(args) == 1: name = args[0] - if not name in crt_series.get_applied() + crt_series.get_unapplied(): + if not name in crt_series.get_applied() + crt_series.get_unapplied() + \ + crt_series.get_hidden(): raise CmdException, 'Unknown patch "%s"' % name else: parser.error('incorrect number of arguments') @@ -103,4 +126,4 @@ def func(parser, options, args): if os.system('gitk %s' % log) != 0: raise CmdException, 'gitk execution failed' else: - show_log(log, options.patch) + show_log(log, options)