[Patchew-devel] [PATCH] tweak how the importer limits itself to 100 commits only

Paolo Bonzini posted 1 patch 1 week, 5 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/patchew next tags/patchew/20201120140803.153272-1-pbonzini@redhat.com
patchew-cli | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

[Patchew-devel] [PATCH] tweak how the importer limits itself to 100 commits only

Posted by Paolo Bonzini 1 week, 5 days ago
Use "old_head..new_head ^new_head~100" to go back 100 commits on the first
parent only.  This way, merge commits are counted as one.
---
 patchew-cli | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/patchew-cli b/patchew-cli
index 9cfdf36..0b53516 100755
--- a/patchew-cli
+++ b/patchew-cli
@@ -361,14 +361,14 @@ class ProjectCommand(SubCommand):
             if old_head == new_head:
                 logging.info("no change since last update")
                 return
-        except:
-            old_head = "%s~100" % new_head
 
         try:
             # TODO: relax this 100 limit, which probably need an API change.
+            # using -100 would count all commits, while "^HEAD~100" counts merge
+            # commits as one
             new_commits = (
                 subprocess.check_output(
-                    ["git", "rev-list", "-n", "100", "%s..%s" % (old_head, new_head)], cwd=clone
+                    ["git", "rev-list", "%s..%s" % (old_head, new_head), "^%s~100" % new_head], cwd=clone
                 )
                 .decode()
                 .splitlines()
-- 
2.28.0

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel