400 error when merge proposal already registered

Bug #2018971 reported by Bryce Harrington
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
git-ubuntu
Triaged
Medium
Unassigned

Bug Description

Steps to reproduce:

  1. File an MP via the submit subcommand, e.g.:

     git ubuntu submit \
        --reviewer canonical-server \
        --reviewer canonical-server-reporter \
        --reviewer canonical-server-core-reviewers \
        --reviewer canonical-server-packageset-reviewers \
        --target-branch "debian/sid"

  2. Repeat same command as in step #1

  3. Full HTTP 400 error response is printed:

05/09/2023 00:17:20 - ERROR:Unable to create merge proposal: HTTP Error 400: Bad Request
Response headers:
---
-content-encoding: gzip
connection: close
content-length: 177
content-security-policy: frame-ancestors 'self';
content-type: text/plain;charset=utf-8
date: Tue, 09 May 2023 07:17:20 GMT
server: gunicorn
status: 400
strict-transport-security: max-age=15552000
vary: Accept,Accept-Encoding
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-launchpad-revision: 90e2150bef31b411d7bae5c4032c7e320fcaaec8
x-lazr-notifications: []
x-powered-by: Zope (www.zope.org), Python (www.python.org)
x-request-id: 6b878a91-70d3-4c25-9c35-4e76f5cd475b
x-vcs-revision: 90e2150bef31b411d7bae5c4032c7e320fcaaec8
x-xss-protection: 1; mode=block
---
Response body:
---
b'There is already a branch merge proposal registered for branch ~bryce/ubuntu/+source/chrony:merge-v4.3-2-mantic to land on ubuntu/+source/chrony:debian/sid that is still active.'
---

  4. Try again with the --force option, but it just prints the same.

I'm guessing this is failing in the createMergeProposal() call, however that appears to be handling the BadRequest exception already:

    # create MP
    try:
        mp = source_git_ref.createMergeProposal(merge_target=target_git_ref)
    except BadRequest as e:
        logging.error("Unable to create merge proposal: %s", e)
        return 1

This looks to me like it *should* handle the 400 error exception and only print the error message itself.

An obvious improvement would be to have it suggest using --force to overwrite the old MP, and then when --force is specified, to detect and remove any existing MP before creating this one.

Tags: submit
Robie Basak (racb)
tags: added: submit
Changed in git-ubuntu:
status: New → Triaged
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.