From nobody Thu Apr 25 08:37:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552668787486223.5271778379779; Fri, 15 Mar 2019 09:53:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 01BD63082B56; Fri, 15 Mar 2019 16:53:06 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ECE6A5D9D3; Fri, 15 Mar 2019 16:53:05 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E47C641F3D; Fri, 15 Mar 2019 16:53:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2FGpTEj018347 for ; Fri, 15 Mar 2019 12:51:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id F366517995; Fri, 15 Mar 2019 16:51:28 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-50.ams2.redhat.com [10.36.112.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48B72183DB for ; Fri, 15 Mar 2019 16:51:22 +0000 (UTC) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Fri, 15 Mar 2019 17:51:21 +0100 Message-Id: <20190315165121.6689-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH] importer: fix handling of missing commits X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 15 Mar 2019 16:53:06 +0000 (UTC) Content-Type: text/plain; charset="utf-8" If the master branch is force-pushed and the old HEAD is not present in the repository, patchew-cli is currently overwriting the old_head in an attempt to make the subsequent "git log" command work. However, this caused a "wrong old head" exception in the project update command. Instead, leave the old_head unchanged and use the new commits to build a "git show" command line. This works because the new commits are initialized to a sane value if the master branch is force-pushed. Signed-off-by: Paolo Bonzini Reviewed-by: Fam Zheng --- patchew-cli | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/patchew-cli b/patchew-cli index 73b8ccf..7fa7d49 100755 --- a/patchew-cli +++ b/patchew-cli @@ -308,15 +308,14 @@ class ProjectCommand(SubCommand): "%s..%s" % (old_head, ne= w_head)], cwd=3Dclone).decode().sp= litlines() except: - old_head =3D new_head new_commits =3D [new_head] logging.debug("old head: %s", old_head) logging.debug("new commits: \n%s" % \ "\n".join([" " + x for x in new_commits])) - output =3D subprocess.check_output("""git log --format=3D%%b %s..%= s | + output =3D subprocess.check_output("""git show --format=3D%%b %s | awk 'BEGIN{IGNORECASE=3D1} /^message-id:/{print}' """% \ - (old_head, new_head), shell=3DTrue, cwd=3Dclone).decode() + ' '.join(new_commits), shell=3DTrue, cwd=3Dclone).decode() msgids =3D [x[len("message-id:"):].strip() for x in output.splitli= nes()] logging.debug("message ids: \n%s" % \ "\n".join([" " + x for x in msgids])) --=20 2.20.1 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel