#15 Add a command for checking out pull requests locally
Merged by ralph. Opened by lsedlar.
lsedlar/pag review-cmd  into  develop

Download 15.patch

The idea is shamelessly stolen from git-review (which works with Gerrit). It allows listing opened pull requests and checking them out locally. When the same pull request is rebased/commits are added, another local checkout should create a new branch, so it should even be possible to compare different revisions of the same PR.

Works like this:

$ pag review --list
 2328 clime       optimize view_commits for case when there is no parent repo
 2325 mprahl      Remove ProjectLock entries of a project when deleting the
                  project
 2310 zhsj        Remove unused jdenticon js library
$ pag review  2310
  $ git fetch https://pagure.io/forks/zhsj/pagure.git cleanup-unused-js
From https://pagure.io/forks/zhsj/pagure
 * branch            cleanup-unused-js -> FETCH_HEAD
  $ git rev-parse FETCH_HEAD
  $ git branch --contains c9d61795e7e6383c1ee966b217ae798f4fa21506 review/2310/*
  $ git branch --list review/2310/*
  $ git checkout -b review/2310/1 FETCH_HEAD
Switched to a new branch 'review/2310/1'
$ pag review --open
  $ git rev-parse --abbrev-ref HEAD
  $ xdg-open https://pagure.io/pagure/pull-request/2310

When colorama is installed, the output is nicely colorized.

It would be good to add a docblock here and to document the name parameter and its type. It would also be good to document the return value and its type.

It would be good to document the type of the response argument, and also the type of the return value.

It would be good to document the argument's type, and the return value type.

Let's give this a docblocl and document the ctx parameter.

Let's give this a docblock too.

Look good (and useful!). In addition to more docblock detail, I also highly recommend writing tests for this change.

Awesome idea!

3 new commits added

  • Add basic tests for review subcommand
  • Add review command
  • Dim output of subprocess

Docstrings updated, and I added a few tests. They should be runnable with python setup.py test. Incidentally looking at the responses from Pagure more, I found a way to simplify the code a little bit.

3 new commits added

  • Add basic tests for review subcommand
  • Add review command
  • Dim output of subprocess

I recommend dropping these print statements to keep the test output cleaner.

I recommend dropping the print statements.

LGTM!

3 new commits added

  • Add basic tests for review subcommand
  • Add review command
  • Dim output of subprocess

Hey, sorry this sat idle for so long. Merging straight away.

Pull-Request has been merged by ralph

Metadata