[Patchew-devel] [PATCH v2] 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/20201120141039.153568-1-pbonzini@redhat.com
patchew-cli | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

[Patchew-devel] [PATCH v2] 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 | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/patchew-cli b/patchew-cli
index 9cfdf36..f872c1d 100755
--- a/patchew-cli
+++ b/patchew-cli
@@ -361,14 +361,17 @@ class ProjectCommand(SubCommand):
             if old_head == new_head:
                 logging.info("no change since last update")
                 return
+            commit_range = "%s..%s" % (old_head, new_head)
         except:
-            old_head = "%s~100" % new_head
+            commit_range = 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", commit_range, "^%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