git_wrapper 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +74 -74
- data/git_wrapper.gemspec +21 -21
- data/lib/git_wrapper/commands/add.rb +20 -20
- data/lib/git_wrapper/commands/branch.rb +72 -72
- data/lib/git_wrapper/commands/checkout.rb +20 -20
- data/lib/git_wrapper/commands/commit.rb +20 -20
- data/lib/git_wrapper/commands/config.rb +25 -25
- data/lib/git_wrapper/commands/diff.rb +27 -27
- data/lib/git_wrapper/commands/fetch.rb +20 -20
- data/lib/git_wrapper/commands/git.rb +43 -43
- data/lib/git_wrapper/commands/init.rb +15 -15
- data/lib/git_wrapper/commands/log.rb +81 -81
- data/lib/git_wrapper/commands/merge.rb +15 -15
- data/lib/git_wrapper/commands/pull.rb +20 -20
- data/lib/git_wrapper/commands/push.rb +26 -26
- data/lib/git_wrapper/commands/remote.rb +48 -48
- data/lib/git_wrapper/commands/remove.rb +15 -15
- data/lib/git_wrapper/commands/reset.rb +35 -35
- data/lib/git_wrapper/commands/revert.rb +22 -22
- data/lib/git_wrapper/commands/shell.rb +66 -66
- data/lib/git_wrapper/commands/show.rb +39 -39
- data/lib/git_wrapper/commands/status.rb +16 -16
- data/lib/git_wrapper/commands/tag.rb +53 -53
- data/lib/git_wrapper/repository.rb +208 -208
- data/lib/git_wrapper/results/diff_name_status.rb +27 -27
- data/lib/git_wrapper/results/file_status.rb +21 -21
- data/lib/git_wrapper/results/log_info.rb +22 -22
- data/lib/git_wrapper/results/status_porcelain.rb +39 -39
- data/lib/git_wrapper/version.rb +3 -3
- data/lib/git_wrapper.rb +46 -44
- data/spec/repository_spec.rb +888 -888
- data/spec/spec_helper.rb +9 -9
- data/spec/status_porcelain_parser_spec.rb +86 -86
- data/spec/support/helpers/file_helper.rb +40 -36
- data/spec/support/matchers/git_status_matchers.rb +39 -39
- metadata +17 -7
@@ -1,44 +1,44 @@
|
|
1
|
-
module GitWrapper
|
2
|
-
module Commands
|
3
|
-
class Git
|
4
|
-
attr_reader :location_folder
|
5
|
-
attr_reader :output
|
6
|
-
attr_reader :error
|
7
|
-
|
8
|
-
def initialize(location_folder)
|
9
|
-
@location_folder = location_folder
|
10
|
-
end
|
11
|
-
|
12
|
-
def execute
|
13
|
-
begin
|
14
|
-
@output, @error, status = Shell.execute("git #{command}", :chdir => @location_folder)
|
15
|
-
@success = status.success?
|
16
|
-
|
17
|
-
log = {
|
18
|
-
:command => command,
|
19
|
-
:location_folder => @location_folder,
|
20
|
-
:output => @output,
|
21
|
-
:error => @error
|
22
|
-
}
|
23
|
-
GitWrapper.logger.debug "[GitWrapper] #{log}"
|
24
|
-
|
25
|
-
return result
|
26
|
-
rescue Exception => e
|
27
|
-
GitWrapper.logger.error "[GitWrapper] #{e.message}"
|
28
|
-
@error = e.message
|
29
|
-
return false
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def result
|
34
|
-
@success
|
35
|
-
end
|
36
|
-
|
37
|
-
def to_relative_path(file_name)
|
38
|
-
base_folder = location_folder.gsub("\\", "/")
|
39
|
-
file_name.gsub("\\", "/").gsub(base_folder + "/", "")
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
end
|
1
|
+
module GitWrapper
|
2
|
+
module Commands
|
3
|
+
class Git
|
4
|
+
attr_reader :location_folder
|
5
|
+
attr_reader :output
|
6
|
+
attr_reader :error
|
7
|
+
|
8
|
+
def initialize(location_folder)
|
9
|
+
@location_folder = location_folder
|
10
|
+
end
|
11
|
+
|
12
|
+
def execute
|
13
|
+
begin
|
14
|
+
@output, @error, status = Shell.execute("git #{command}", :chdir => @location_folder)
|
15
|
+
@success = status.success?
|
16
|
+
|
17
|
+
log = {
|
18
|
+
:command => command,
|
19
|
+
:location_folder => @location_folder,
|
20
|
+
:output => @output,
|
21
|
+
:error => @error
|
22
|
+
}
|
23
|
+
GitWrapper.logger.debug "[GitWrapper] #{log}"
|
24
|
+
|
25
|
+
return result
|
26
|
+
rescue Exception => e
|
27
|
+
GitWrapper.logger.error "[GitWrapper] #{e.message}"
|
28
|
+
@error = e.message
|
29
|
+
return false
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def result
|
34
|
+
@success
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_relative_path(file_name)
|
38
|
+
base_folder = location_folder.gsub("\\", "/")
|
39
|
+
file_name.gsub("\\", "/").gsub(base_folder + "/", "")
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
44
|
end
|
@@ -1,16 +1,16 @@
|
|
1
|
-
module GitWrapper
|
2
|
-
module Commands
|
3
|
-
class Init < Git
|
4
|
-
|
5
|
-
def bare
|
6
|
-
@bare = true
|
7
|
-
self
|
8
|
-
end
|
9
|
-
|
10
|
-
def command
|
11
|
-
"init#{@bare ? ' --bare' : ''}"
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
end
|
1
|
+
module GitWrapper
|
2
|
+
module Commands
|
3
|
+
class Init < Git
|
4
|
+
|
5
|
+
def bare
|
6
|
+
@bare = true
|
7
|
+
self
|
8
|
+
end
|
9
|
+
|
10
|
+
def command
|
11
|
+
"init#{@bare ? ' --bare' : ''}"
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
16
|
end
|
@@ -1,82 +1,82 @@
|
|
1
|
-
module GitWrapper
|
2
|
-
module Commands
|
3
|
-
class Log < Git
|
4
|
-
ATTRIBUTES = {
|
5
|
-
:commit_hash => 'H',
|
6
|
-
:abbreviated_commit_hash => 'h',
|
7
|
-
:tree_hash => 'T',
|
8
|
-
:abbreviated_tree_hash => 't',
|
9
|
-
:parent_hashes => 'P',
|
10
|
-
:abbreviated_parent_hashes => 'p',
|
11
|
-
:author_name => 'an',
|
12
|
-
:author_name_mailmap => 'aN',
|
13
|
-
:author_email => 'ae',
|
14
|
-
:author_email_mailmap => 'aE',
|
15
|
-
:author_date => 'ad',
|
16
|
-
:author_date_rfc2822 => 'aD',
|
17
|
-
:author_date_relative => 'aR',
|
18
|
-
:author_date_unix => 'at',
|
19
|
-
:author_date_iso => 'ai',
|
20
|
-
:commiter_name => 'cn',
|
21
|
-
:commiter_name_mailmap => 'cN',
|
22
|
-
:commiter_email => 'ce',
|
23
|
-
:commiter_email_mailmap => 'cE',
|
24
|
-
:commiter_date => 'cd',
|
25
|
-
:commiter_date_rfc2822 => 'cD',
|
26
|
-
:commiter_date_relative => 'cR',
|
27
|
-
:commiter_date_unix => 'ct',
|
28
|
-
:commiter_date_iso => 'ci',
|
29
|
-
:ref_names => 'd',
|
30
|
-
:encoding => 'e',
|
31
|
-
:subject => 's',
|
32
|
-
:sanitized_subject_line => 'f',
|
33
|
-
:body => 'b',
|
34
|
-
:raw_body => 'B',
|
35
|
-
:commit_notes => 'N',
|
36
|
-
:reflog_selector => 'gD',
|
37
|
-
:shortened_reflog_selector => 'gd',
|
38
|
-
:reflog_subject => 'gs'
|
39
|
-
}
|
40
|
-
|
41
|
-
def file(file_name)
|
42
|
-
@file = to_relative_path(file_name)
|
43
|
-
self
|
44
|
-
end
|
45
|
-
|
46
|
-
def commit(commit)
|
47
|
-
@commit = commit
|
48
|
-
self
|
49
|
-
end
|
50
|
-
|
51
|
-
def command
|
52
|
-
command = "log --format=\"<log>#{xml_structure}</log>\""
|
53
|
-
command += " #{@commit}" if @commit
|
54
|
-
command += " \"#{@file}\"" if @file
|
55
|
-
command
|
56
|
-
end
|
57
|
-
|
58
|
-
def result
|
59
|
-
if output.nil?
|
60
|
-
return nil if @commit
|
61
|
-
return []
|
62
|
-
end
|
63
|
-
|
64
|
-
results = Nokogiri::XML("<logs>#{output}</logs>").xpath('logs/log').map do |element|
|
65
|
-
Results::LogInfo.new(Hash[*element.children.map { |node| [node.name.to_sym, node.text] }.flatten])
|
66
|
-
end
|
67
|
-
|
68
|
-
return results.first if @commit
|
69
|
-
results
|
70
|
-
end
|
71
|
-
|
72
|
-
private
|
73
|
-
|
74
|
-
def xml_structure
|
75
|
-
ATTRIBUTES.map { |attribute, placeholder|
|
76
|
-
"<#{attribute}>%#{placeholder}</#{attribute}>"
|
77
|
-
}.join
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
81
|
-
end
|
1
|
+
module GitWrapper
|
2
|
+
module Commands
|
3
|
+
class Log < Git
|
4
|
+
ATTRIBUTES = {
|
5
|
+
:commit_hash => 'H',
|
6
|
+
:abbreviated_commit_hash => 'h',
|
7
|
+
:tree_hash => 'T',
|
8
|
+
:abbreviated_tree_hash => 't',
|
9
|
+
:parent_hashes => 'P',
|
10
|
+
:abbreviated_parent_hashes => 'p',
|
11
|
+
:author_name => 'an',
|
12
|
+
:author_name_mailmap => 'aN',
|
13
|
+
:author_email => 'ae',
|
14
|
+
:author_email_mailmap => 'aE',
|
15
|
+
:author_date => 'ad',
|
16
|
+
:author_date_rfc2822 => 'aD',
|
17
|
+
:author_date_relative => 'aR',
|
18
|
+
:author_date_unix => 'at',
|
19
|
+
:author_date_iso => 'ai',
|
20
|
+
:commiter_name => 'cn',
|
21
|
+
:commiter_name_mailmap => 'cN',
|
22
|
+
:commiter_email => 'ce',
|
23
|
+
:commiter_email_mailmap => 'cE',
|
24
|
+
:commiter_date => 'cd',
|
25
|
+
:commiter_date_rfc2822 => 'cD',
|
26
|
+
:commiter_date_relative => 'cR',
|
27
|
+
:commiter_date_unix => 'ct',
|
28
|
+
:commiter_date_iso => 'ci',
|
29
|
+
:ref_names => 'd',
|
30
|
+
:encoding => 'e',
|
31
|
+
:subject => 's',
|
32
|
+
:sanitized_subject_line => 'f',
|
33
|
+
:body => 'b',
|
34
|
+
:raw_body => 'B',
|
35
|
+
:commit_notes => 'N',
|
36
|
+
:reflog_selector => 'gD',
|
37
|
+
:shortened_reflog_selector => 'gd',
|
38
|
+
:reflog_subject => 'gs'
|
39
|
+
}
|
40
|
+
|
41
|
+
def file(file_name)
|
42
|
+
@file = to_relative_path(file_name)
|
43
|
+
self
|
44
|
+
end
|
45
|
+
|
46
|
+
def commit(commit)
|
47
|
+
@commit = commit
|
48
|
+
self
|
49
|
+
end
|
50
|
+
|
51
|
+
def command
|
52
|
+
command = "log --format=\"<log>#{xml_structure}</log>\""
|
53
|
+
command += " #{@commit}" if @commit
|
54
|
+
command += " \"#{@file}\"" if @file
|
55
|
+
command
|
56
|
+
end
|
57
|
+
|
58
|
+
def result
|
59
|
+
if output.nil?
|
60
|
+
return nil if @commit
|
61
|
+
return []
|
62
|
+
end
|
63
|
+
|
64
|
+
results = Nokogiri::XML("<logs>#{output}</logs>").xpath('logs/log').map do |element|
|
65
|
+
Results::LogInfo.new(Hash[*element.children.map { |node| [node.name.to_sym, node.text] }.flatten])
|
66
|
+
end
|
67
|
+
|
68
|
+
return results.first if @commit
|
69
|
+
results
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
def xml_structure
|
75
|
+
ATTRIBUTES.map { |attribute, placeholder|
|
76
|
+
"<#{attribute}>%#{placeholder}</#{attribute}>"
|
77
|
+
}.join
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
82
82
|
end
|
@@ -1,16 +1,16 @@
|
|
1
|
-
module GitWrapper
|
2
|
-
module Commands
|
3
|
-
class Merge < Git
|
4
|
-
|
5
|
-
def commit(commit)
|
6
|
-
@commit = commit
|
7
|
-
self
|
8
|
-
end
|
9
|
-
|
10
|
-
def command
|
11
|
-
"merge #{@commit}"
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
end
|
1
|
+
module GitWrapper
|
2
|
+
module Commands
|
3
|
+
class Merge < Git
|
4
|
+
|
5
|
+
def commit(commit)
|
6
|
+
@commit = commit
|
7
|
+
self
|
8
|
+
end
|
9
|
+
|
10
|
+
def command
|
11
|
+
"merge #{@commit}"
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
16
|
end
|
@@ -1,21 +1,21 @@
|
|
1
|
-
module GitWrapper
|
2
|
-
module Commands
|
3
|
-
class Pull < Git
|
4
|
-
|
5
|
-
def remote(remote)
|
6
|
-
@remote = remote
|
7
|
-
self
|
8
|
-
end
|
9
|
-
|
10
|
-
def branch(branch)
|
11
|
-
@branch = branch
|
12
|
-
self
|
13
|
-
end
|
14
|
-
|
15
|
-
def command
|
16
|
-
"pull #{@remote} #{@branch}"
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
1
|
+
module GitWrapper
|
2
|
+
module Commands
|
3
|
+
class Pull < Git
|
4
|
+
|
5
|
+
def remote(remote)
|
6
|
+
@remote = remote
|
7
|
+
self
|
8
|
+
end
|
9
|
+
|
10
|
+
def branch(branch)
|
11
|
+
@branch = branch
|
12
|
+
self
|
13
|
+
end
|
14
|
+
|
15
|
+
def command
|
16
|
+
"pull #{@remote} #{@branch}"
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
21
|
end
|
@@ -1,27 +1,27 @@
|
|
1
|
-
module GitWrapper
|
2
|
-
module Commands
|
3
|
-
class Push < Git
|
4
|
-
|
5
|
-
def remote(remote)
|
6
|
-
@remote = remote
|
7
|
-
self
|
8
|
-
end
|
9
|
-
|
10
|
-
def branch(branch)
|
11
|
-
@branch = branch
|
12
|
-
@mode = :branch
|
13
|
-
self
|
14
|
-
end
|
15
|
-
|
16
|
-
def tags
|
17
|
-
@mode = :tags
|
18
|
-
self
|
19
|
-
end
|
20
|
-
|
21
|
-
def command
|
22
|
-
"push #{@remote} #{@mode == :branch ? @branch : '--tags'}"
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
1
|
+
module GitWrapper
|
2
|
+
module Commands
|
3
|
+
class Push < Git
|
4
|
+
|
5
|
+
def remote(remote)
|
6
|
+
@remote = remote
|
7
|
+
self
|
8
|
+
end
|
9
|
+
|
10
|
+
def branch(branch)
|
11
|
+
@branch = branch
|
12
|
+
@mode = :branch
|
13
|
+
self
|
14
|
+
end
|
15
|
+
|
16
|
+
def tags
|
17
|
+
@mode = :tags
|
18
|
+
self
|
19
|
+
end
|
20
|
+
|
21
|
+
def command
|
22
|
+
"push #{@remote} #{@mode == :branch ? @branch : '--tags'}"
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
27
|
end
|
@@ -1,49 +1,49 @@
|
|
1
|
-
module GitWrapper
|
2
|
-
module Commands
|
3
|
-
class Remote < Git
|
4
|
-
|
5
|
-
def name(name)
|
6
|
-
@name = name
|
7
|
-
self
|
8
|
-
end
|
9
|
-
|
10
|
-
def add(url)
|
11
|
-
@url = url
|
12
|
-
@mode = :add
|
13
|
-
self
|
14
|
-
end
|
15
|
-
|
16
|
-
def remove
|
17
|
-
@mode = :remove
|
18
|
-
self
|
19
|
-
end
|
20
|
-
|
21
|
-
def list
|
22
|
-
@mode = :list
|
23
|
-
self
|
24
|
-
end
|
25
|
-
|
26
|
-
def command
|
27
|
-
command = "remote "
|
28
|
-
|
29
|
-
if @mode == :add
|
30
|
-
command += "add #{@name} \"#{@url}\""
|
31
|
-
elsif @mode == :remove
|
32
|
-
command += "rm #{@name}"
|
33
|
-
elsif @mode == :list
|
34
|
-
command += "show"
|
35
|
-
else
|
36
|
-
raise "Unespecified remote mode"
|
37
|
-
end
|
38
|
-
|
39
|
-
command
|
40
|
-
end
|
41
|
-
|
42
|
-
def result
|
43
|
-
return @output.split(/\n/) if @mode == :list
|
44
|
-
super
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
end
|
1
|
+
module GitWrapper
|
2
|
+
module Commands
|
3
|
+
class Remote < Git
|
4
|
+
|
5
|
+
def name(name)
|
6
|
+
@name = name
|
7
|
+
self
|
8
|
+
end
|
9
|
+
|
10
|
+
def add(url)
|
11
|
+
@url = url
|
12
|
+
@mode = :add
|
13
|
+
self
|
14
|
+
end
|
15
|
+
|
16
|
+
def remove
|
17
|
+
@mode = :remove
|
18
|
+
self
|
19
|
+
end
|
20
|
+
|
21
|
+
def list
|
22
|
+
@mode = :list
|
23
|
+
self
|
24
|
+
end
|
25
|
+
|
26
|
+
def command
|
27
|
+
command = "remote "
|
28
|
+
|
29
|
+
if @mode == :add
|
30
|
+
command += "add #{@name} \"#{@url}\""
|
31
|
+
elsif @mode == :remove
|
32
|
+
command += "rm #{@name}"
|
33
|
+
elsif @mode == :list
|
34
|
+
command += "show"
|
35
|
+
else
|
36
|
+
raise "Unespecified remote mode"
|
37
|
+
end
|
38
|
+
|
39
|
+
command
|
40
|
+
end
|
41
|
+
|
42
|
+
def result
|
43
|
+
return @output.split(/\n/) if @mode == :list
|
44
|
+
super
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
49
49
|
end
|
@@ -1,16 +1,16 @@
|
|
1
|
-
module GitWrapper
|
2
|
-
module Commands
|
3
|
-
class Remove < Git
|
4
|
-
|
5
|
-
def file(file_name)
|
6
|
-
@file = to_relative_path(file_name)
|
7
|
-
self
|
8
|
-
end
|
9
|
-
|
10
|
-
def command
|
11
|
-
"rm \"#{@file}\""
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
end
|
1
|
+
module GitWrapper
|
2
|
+
module Commands
|
3
|
+
class Remove < Git
|
4
|
+
|
5
|
+
def file(file_name)
|
6
|
+
@file = to_relative_path(file_name)
|
7
|
+
self
|
8
|
+
end
|
9
|
+
|
10
|
+
def command
|
11
|
+
"rm \"#{@file}\""
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
16
|
end
|
@@ -1,36 +1,36 @@
|
|
1
|
-
module GitWrapper
|
2
|
-
module Commands
|
3
|
-
class Reset < Git
|
4
|
-
|
5
|
-
def commit(commit)
|
6
|
-
@commit = commit
|
7
|
-
self
|
8
|
-
end
|
9
|
-
|
10
|
-
def soft
|
11
|
-
@mode = :soft
|
12
|
-
self
|
13
|
-
end
|
14
|
-
|
15
|
-
def hard
|
16
|
-
@mode = :hard
|
17
|
-
self
|
18
|
-
end
|
19
|
-
|
20
|
-
def merge
|
21
|
-
@mode = :merge
|
22
|
-
self
|
23
|
-
end
|
24
|
-
|
25
|
-
def keep
|
26
|
-
@mode = :keep
|
27
|
-
self
|
28
|
-
end
|
29
|
-
|
30
|
-
def command
|
31
|
-
"reset #{@mode ? "--#{@mode}" : ''} #{@commit}"
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
end
|
1
|
+
module GitWrapper
|
2
|
+
module Commands
|
3
|
+
class Reset < Git
|
4
|
+
|
5
|
+
def commit(commit)
|
6
|
+
@commit = commit
|
7
|
+
self
|
8
|
+
end
|
9
|
+
|
10
|
+
def soft
|
11
|
+
@mode = :soft
|
12
|
+
self
|
13
|
+
end
|
14
|
+
|
15
|
+
def hard
|
16
|
+
@mode = :hard
|
17
|
+
self
|
18
|
+
end
|
19
|
+
|
20
|
+
def merge
|
21
|
+
@mode = :merge
|
22
|
+
self
|
23
|
+
end
|
24
|
+
|
25
|
+
def keep
|
26
|
+
@mode = :keep
|
27
|
+
self
|
28
|
+
end
|
29
|
+
|
30
|
+
def command
|
31
|
+
"reset #{@mode ? "--#{@mode}" : ''} #{@commit}"
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
36
|
end
|
@@ -1,23 +1,23 @@
|
|
1
|
-
module GitWrapper
|
2
|
-
module Commands
|
3
|
-
class Revert < Git
|
4
|
-
|
5
|
-
def commit(commit)
|
6
|
-
@commit = commit
|
7
|
-
@merge = false
|
8
|
-
self
|
9
|
-
end
|
10
|
-
|
11
|
-
def merge(commit)
|
12
|
-
@commit = commit
|
13
|
-
@merge = true
|
14
|
-
self
|
15
|
-
end
|
16
|
-
|
17
|
-
def command
|
18
|
-
"revert#{@merge ? ' -m 1' : ''} --no-edit #{@commit}"
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
1
|
+
module GitWrapper
|
2
|
+
module Commands
|
3
|
+
class Revert < Git
|
4
|
+
|
5
|
+
def commit(commit)
|
6
|
+
@commit = commit
|
7
|
+
@merge = false
|
8
|
+
self
|
9
|
+
end
|
10
|
+
|
11
|
+
def merge(commit)
|
12
|
+
@commit = commit
|
13
|
+
@merge = true
|
14
|
+
self
|
15
|
+
end
|
16
|
+
|
17
|
+
def command
|
18
|
+
"revert#{@merge ? ' -m 1' : ''} --no-edit #{@commit}"
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
23
|
end
|