[Patchew-devel] [PATCH] importer: fix handling of missing commits

Fam Zheng fam at euphon.net
Sun Mar 17 02:56:11 UTC 2019


On Fri, 03/15 17:51, Paolo Bonzini wrote:
> 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 <pbonzini at redhat.com>
> ---
>  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, new_head)],
>                                                    cwd=clone).decode().splitlines()
>          except:
> -            old_head = new_head
>              new_commits = [new_head]
>          logging.debug("old head: %s", old_head)
>          logging.debug("new commits: \n%s" % \
>                  "\n".join(["  " + x for x in new_commits]))
> -        output = subprocess.check_output("""git log --format=%%b %s..%s |
> +        output = subprocess.check_output("""git show --format=%%b %s |
>                  awk 'BEGIN{IGNORECASE=1} /^message-id:/{print}'
>                  """% \
> -                (old_head, new_head), shell=True, cwd=clone).decode()
> +                ' '.join(new_commits), shell=True, cwd=clone).decode()

How does this make sure all message-ids in each commits between old_head and
new_head are collected? That list is used by the server to mark multiple series
merged.

Fam

>          msgids = [x[len("message-id:"):].strip() for x in output.splitlines()]
>          logging.debug("message ids: \n%s" % \
>                  "\n".join(["  " + x for x in msgids]))
> -- 
> 2.20.1
> 
> _______________________________________________
> Patchew-devel mailing list
> Patchew-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/patchew-devel




More information about the Patchew-devel mailing list