From: Frantisek Hrbata Date: Tue, 15 Dec 2020 09:52:59 +0000 (+0100) Subject: git-mr-comment-list: add --new-only option X-Git-Tag: v0.2~49 X-Git-Url: http://www.hrbata.com/gitweb/?a=commitdiff_plain;h=25cddcf4f92f4141f0764693f23b8f56940cac8d;p=gimrr.git git-mr-comment-list: add --new-only option Signed-off-by: Frantisek Hrbata --- diff --git a/git-mr-comment-list b/git-mr-comment-list index 6cf01ad..36366ac 100755 --- a/git-mr-comment-list +++ b/git-mr-comment-list @@ -37,6 +37,8 @@ parser.add_argument("-i", "--regexp-ignore-case", action="store_true", help="Match the regular expression limiting patterns without regard to letter case.") parser.add_argument("-r", "--read-revs", metavar="FILE", help="Read revs for previously read comments from FILE (default: $HOME/.gimrr/comment.revs).") +parser.add_argument("-n", "--new-only", action="store_true", + help="List only new comments.") class CFormatter(string.Formatter): def __init__(self): @@ -107,16 +109,21 @@ cargs = dict() for line in reversed(out.split("\n")): if not line: continue + sha, subj, name, email, date = line.split("\t") + + if sha in revs: + if args.new_only: + continue + cargs["f"] = "" + else: + cargs["f"] = "N" + cargs["c"] = sha cargs["s"] = subj cargs["n"] = name cargs["e"] = email cargs["d"] = date cargs["m"] = c2m[sha] - if sha in revs: - cargs["f"] = "" - else: - cargs["f"] = "N" printc(args.fmt, cargs)