-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathgit-pull-req
More file actions
executable file
·63 lines (48 loc) · 1.92 KB
/
git-pull-req
File metadata and controls
executable file
·63 lines (48 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env ruby
#require "rubygems"
#require "bundler/setup"
#$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '../lib')
require 'git-process/git_lib'
require 'git-process/pull_request'
require 'git-process/git_process_options'
include GitProc
class PullRequestOptions
include GitProcessOptions
def description
<<DESC
DESCRIPTION
DESC
end
def usage(filename)
"Usage: #{filename} [ options ] [pull_request_title | server/pull_request_number | pull_request_number]"
end
def extend_opts(parser)
parser.opt :base_branch, "The branch on the server that you want this \"pulled\" into. "+
"Defaults to the integration branch.", :type => :string
parser.opt :head_branch, "The branch that you want reviewed before being \"pulled\" "+
"into the base branch. Defaults to the current branch.", :type => :string
parser.opt :repo_name, "The name of the repository to \"pull\" into. Defaults to "+
"the current repository.", :type => :string
parser.opt :description, "The description of the Pull Request. Usually includes a "+
"nice description of what was changed to make things easier "+
"for the reviewer.", :short => :d, :type => :string
parser.opt :user, "Your GitHub username. Only needed the first time you connect, "+
"and you will be prompted for it if needed.", :type => :string
parser.opt :password, "Your GitHub password. Only needed the first time you connect, "+
"and you will be prompted for it if needed.", :type => :string
end
def post_parse(opts, argv)
arg = argv.shift
if /^\d+$/ =~ arg
opts[:prNumber] = arg
elsif /^(.*)\/(\d+)$/ =~ arg
m = /^(.*)\/(\d+)$/.match(arg)
opts[:server] = m[1]
opts[:prNumber] = m[2]
else
opts[:title] = arg
end
end
end
opts = PullRequestOptions.new.parse_cli(File.basename(__FILE__), ARGV)
GitProc::PullRequest.new(GitProc::GitLib.new('.', opts), opts).run