git-mr-comment-list: add --new-only option
authorFrantisek Hrbata <frantisek@hrbata.com>
Tue, 15 Dec 2020 09:52:59 +0000 (10:52 +0100)
committerFrantisek Hrbata <frantisek@hrbata.com>
Tue, 15 Dec 2020 09:52:59 +0000 (10:52 +0100)
Signed-off-by: Frantisek Hrbata <frantisek@hrbata.com>
git-mr-comment-list

index 6cf01ad7dda422b75b8c31ee558358ab681910a8..36366aca6ce709519f65538539745e32e6045718 100755 (executable)
@@ -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)