#28 pag pull-request doesn't work
Opened by vashirov. Modified

$ pag pull-request -b master
  $ git branch --contains
* test-pag
  $ git log master..test-pag
Traceback (most recent call last):
  File "/usr/bin/pag", line 11, in <module>
    load_entry_point('pag==0.7', 'console_scripts', 'pag')()
  File "/usr/lib/python3.6/site-packages/click/core.py", line 721, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.6/site-packages/click/core.py", line 1065, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3.6/site-packages/click/core.py", line 894, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.6/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/pag/utils.py", line 50, in inner
    return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/pag/utils.py", line 136, in inner
    return func(config, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/pag/commands/pullrequest.py", line 91, in pullrequest
    url = client.submit_pull_request(name, base, head, title, comment)
  File "/usr/lib/python3.6/site-packages/pag/client.py", line 152, in submit_pull_request
    "csrf token %r" % response)
pag.client.PagureException: Couldn't get form to get csrf token <Response [400]>

There are a couple issues with the current pull-request command.

  • It does not automatically push the branch.
  • It does not work for opening PRs from forks.
  • If PR branch is not explicitly specified and current commit is reachable from multiple branches, it does silly things. This is addressed in #29.

Once Pagure 4 is out, the command should be modified to use API instead of filling in a form on a web page. The first two issues should still be fixed though. I'll try to get it done soon.

Apparently I'm wrong about the forks. It is possible to open a pull request from a fork by specifying --head vashirov:test-pag as a branch to open the PR from. The part before : is simply just your username.

Was this fixed or should I use API call instead?

There was one commit that was trying to improve pull requests a bit, but it was not yet released.

Using the API is probably a good idea. Pag predates parts of the API and uses scraping to submit the forms of the website. It's prone to breaking with no active maintainers.

There was one commit that was trying to improve pull requests a bit, but it was not yet released.
Using the API is probably a good idea. Pag predates parts of the API and uses scraping to submit the forms of the website. It's prone to breaking with no active maintainers.

Right, I see. I know, that may break like every other day... So thanks for your response. We'll use ogr instead.

Metadata