Skip to content
This repository was archived by the owner on Oct 5, 2023. It is now read-only.
This repository was archived by the owner on Oct 5, 2023. It is now read-only.

git reviewrequest crashes with '422 Unprocessable entity' if PR already exists #99

@benklop

Description

@benklop

If the PR has already been created, for example by using the createpr command, scgitx will crash while trying to create the PR, instead of using the existing one.

11:41 $ git reviewrequest 
updating opv-915-reboot-check to have most recent changes from master

$ git pull origin opv-915-reboot-check
From https://github.com/socialcast/scmc
 * branch            opv-915-reboot-check -> FETCH_HEAD
Already up-to-date.

$ git pull origin master
From https://github.com/socialcast/scmc
 * branch            master     -> FETCH_HEAD
Already up-to-date.

$ git push origin HEAD
Everything up-to-date
Creating pull request for opv-915-reboot-check against master in socialcast/scmc
GitHub request failed: Validation Failed
/home/benklop/.rvm/gems/ruby-2.2.4@scmc/gems/socialcast-git-extensions-4.0.2/lib/socialcast-git-extensions/github.rb:128:in `throw': uncaught throw 422 Unprocessable Entity: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"A pull request already exists for socialcast:opv-915-reboot-check."}],"documentation_url":"https://developer.github.com/v3/pulls/#create-a-pull-request"} (UncaughtThrowError)
    from /home/benklop/.rvm/gems/ruby-2.2.4@scmc/gems/socialcast-git-extensions-4.0.2/lib/socialcast-git-extensions/github.rb:128:in `rescue in github_api_request'
    from /home/benklop/.rvm/gems/ruby-2.2.4@scmc/gems/socialcast-git-extensions-4.0.2/lib/socialcast-git-extensions/github.rb:124:in `github_api_request'
    from /home/benklop/.rvm/gems/ruby-2.2.4@scmc/gems/socialcast-git-extensions-4.0.2/lib/socialcast-git-extensions/github.rb:43:in `create_pull_request'
    from /home/benklop/.rvm/gems/ruby-2.2.4@scmc/gems/socialcast-git-extensions-4.0.2/lib/socialcast-git-extensions/cli.rb:39:in `createpr'
    from /home/benklop/.rvm/gems/ruby-2.2.4@scmc/gems/socialcast-git-extensions-4.0.2/lib/socialcast-git-extensions/cli.rb:98:in `reviewrequest'
    from /home/benklop/.rvm/gems/ruby-2.2.4@scmc/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /home/benklop/.rvm/gems/ruby-2.2.4@scmc/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /home/benklop/.rvm/gems/ruby-2.2.4@scmc/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /home/benklop/.rvm/gems/ruby-2.2.4@scmc/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /home/benklop/.rvm/gems/ruby-2.2.4@scmc/gems/socialcast-git-extensions-4.0.2/bin/git-reviewrequest:4:in `<top (required)>'
    from /home/benklop/.rvm/gems/ruby-2.2.4@scmc/bin/git-reviewrequest:23:in `load'
    from /home/benklop/.rvm/gems/ruby-2.2.4@scmc/bin/git-reviewrequest:23:in `<main>'
    from /home/benklop/.rvm/gems/ruby-2.2.4@scmc/bin/ruby_executable_hooks:15:in `eval'
    from /home/benklop/.rvm/gems/ruby-2.2.4@scmc/bin/ruby_executable_hooks:15:in `<main>'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions