New user registration is currently disabled due to spam abuse / Регистрация новых пользователей в настоящее время приостановлена из-за злоупотреблений спаммерами

Pull requests for GitHub

Report bugs here

Pull requests for GitHub

Postby Tvangeste » Fri Jun 10, 2011 9:53 am

Since some of the GoldenDict contributors don't speak Russian, I decided to post it here.

This post is about how to create pull requests with your fixes for GoldenDict easily.

1. Here's the generic description of the process from GitHub's own help pages: How to send pull requests.

Essentially, it boils down to:
* Fork the main GoldenDict repository on GitHub: https://github.com/goldendict/goldendict
* Create a feature branch in your forked repository, fix things, commit, push changes to your branch
* Go to your branch in your repository, and click "Pull request" button.

For every pull request, a new issue will be automatically generated, so the pull requests can be properly discussed and reviewed.

2. There is one interesting limitation of the current github way of dealing with pull requests. There is no way in the UI (on the web site) to attach the pull request to some previously existing bug/issue.

I checked with github support and they informed me that it *can* be done, but only via their API, not from the web site.

Not a big deal, I wrote a script to simplify this. You can take a look at it here: https://github.com/VVSiz/github-helpers

The script is called create_pull.rb, written in Ruby and requires that curl is installed and in the path (curl.exe for Windows).

The script can speed up and simplify pull request creation. Here's the list of arguments the script understands:

Code: Select all
Usage: ruby create_pull.rb [options]

Mandatory:
    -f, --from BRANCH_NAME           Source Branch
    -n, --name SUBJECT               Short name of the pull request
    -i, --issue ISSUE_NO             Existing Issue Number

Optional:
    -d, --description TEXT           Description of the pull request
    -r, --tr REPO_NAME               Target Repo [Default: goldendict/goldendict]
    -t, --to BRANCH_NAME             Target Branch [Default: master]
    -u, --user LOGIN                 Github login [Default: _YOUR_GITHUB_LOGIN_]
    -p, --pass PASS                  Github pass
    -v, --verbose                    Only show the command
    -h                               Help

Here's the simplest command line to create a pull request from script, without going to the web site:

Code: Select all
ruby create_pull.rb --from FEATURE_BRANCH --name PULL_REQUEST_SHORT_NAME --user YOUR_USER_NAME

That's it, very simple. *And*, we can attach the pull requests to the existing issue too!
Code: Select all
ruby create_pull.rb --issue 27 --from FEATURE_BRANCH --user YOUR_USER_NAME

This example will create a pull request, and attach it to issue 27.

Here's a typical example, with script output (before executing things, the script will ask for confirmation, for the extra safety):
Code: Select all
ruby create_pull.rb --user VVSiz --pass YYY --from feature6 --name feature_6

User: VVSiz
Pass: *********

Target Repo: goldendict/goldendict
Pull request: VVSiz:feature6 --> master
Pull request's title: feature_6

Create pull request? (y/N) y

HTTP/1.1 201 Created


P.S. You could adjust the script you our own needs, setting DEFAULT_USER, DEFAULT_PASS, DEFAULT_TARGET_REPO values to your particular situation, so that there will be no need to provide them via command line parameters.

P.P.S. Direct link to the latest version of the script: https://raw.github.com/VVSiz/github-hel ... te_pull.rb
Tvangeste
 
Posts: 893
Joined: Thu Jun 02, 2011 11:42 am

Re: Pull requests for GitHub

Postby chulai » Thu Jun 16, 2011 10:50 am

Is it possible to pin this topic? Like a post announcement.
chulai
 
Posts: 464
Joined: Sat Jan 08, 2011 10:11 pm


Return to Bugs

Who is online

Users browsing this forum: Google [Bot] and 2 guests