#4424 API: Fix the parent repo check for PR create
Closed 5 years ago by lenkaseg. Opened 5 years ago by lenkaseg.

file modified
+5 -6
@@ -1340,9 +1340,12 @@

      """

  

      repo = _get_repo(repo, username, namespace)

-     _check_pull_request(repo)

-     _check_token(repo)

+     parent = repo

+     if repo.parent:

+         parent = repo.parent

  

+     _check_pull_request(parent)

+     _check_token(repo)

      form = pagure.forms.RequestPullForm(csrf_enabled=False)

      if not form.validate_on_submit():

          raise pagure.exceptions.APIError(
@@ -1363,10 +1366,6 @@

              errors={"branch_from": ["This field is required."]},

          )

  

-     parent = repo

-     if repo.parent:

-         parent = repo.parent

- 

      if not parent.settings.get("pull_requests", True):

          raise pagure.exceptions.APIError(

              404, error_code=APIERROR.EPULLREQUESTSDISABLED

The detection of parent repo in api_pull_request_create was broken - was trying to open pull request on fork.
Now the pull request is opened on the parent.

Fixes #4416

Signed-off-by: Lenka Segura lenka@sepu.cz

1 new commit added

  • black style fixes
5 years ago

pretty please pagure-ci rebuild

5 years ago

Is it ok that I added a commit with the 4 fixed files, which were failing the test_style.py?

Is it ok that I added a commit with the 4 fixed files, which were failing the test_style.py?

Yes but it surprises me since they do not fail for me :(

The detection of parent repo in api_pull_request_create was broken - was trying to open pull request on fork.

I think this would work but it only supports opening a PR against a parent repo, not against, for example another fork.
So I wonder if we shouldn't just have a new argument: repo_from.
You would then open the PR on the API of the project you want to open the PR to (so that'd be project_to) and specify in your request from which project the changes should be pulled.

What do you think?

Yes but it surprises me since they do not fail for me :(

I think the pr #4423 had the test_style failed, but I didn't check which files exactly.

What do you think?

Ok, I will try to do that!

pretty please pagure-ci rebuild

5 years ago

1 new commit added

  • Revert "black style fixes"
5 years ago

1 new commit added

  • API: Fix the parent repo check for PR create
5 years ago

pretty please pagure-ci rebuild

5 years ago

rebased onto 79d6797

5 years ago

pretty please pagure-ci rebuild

5 years ago

Thanks @ngompa, but this will be re-done completely. Just when I have conditions (long story, no computer).

Pull-Request has been closed by lenkaseg

5 years ago