-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathgit-to-master
More file actions
executable file
·44 lines (32 loc) · 1.06 KB
/
git-to-master
File metadata and controls
executable file
·44 lines (32 loc) · 1.06 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
#!/usr/bin/env ruby
#require "rubygems"
#require "bundler/setup"
#$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '../lib')
require 'git-process/git_process_options'
require 'git-process/rebase_to_master'
require 'git-process/git_lib'
class ToMasterOptions
include GitProc::GitProcessOptions
def usage(filename)
"Usage: #{filename} [ options ] [server/pull_request_number | pull_request_number]"
end
def extend_opts(parser)
parser.opt :keep, "Don't do any \"cleanup.\" It keeps the current local "+
"and remote branches, and does not close any "+
"outstanding pull requests.", :short => :k, :default => false
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
# "normal" to-master
end
end
end
opts = ToMasterOptions.new.parse_cli(File.basename(__FILE__), ARGV)
GitProc::RebaseToMaster.new(GitProc::GitLib.new('.', opts), opts).run