git-multirepo 1.0.0.beta60 → 1.0.0.beta61
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.
- checksums.yaml +4 -4
- data/.gitattributes +2 -2
- data/.gitbugtraq +3 -3
- data/.gitignore +38 -38
- data/.rspec +2 -2
- data/.rubocop.yml +79 -79
- data/CHANGELOG.md +75 -71
- data/Gemfile +4 -4
- data/Gemfile.lock +49 -47
- data/LICENSE +22 -22
- data/README.md +179 -179
- data/Rakefile +1 -1
- data/bin/multi +11 -11
- data/docs/bug-repros/91565510-repro.sh +20 -20
- data/git-multirepo.gemspec +32 -32
- data/lib/git-multirepo.rb +3 -3
- data/lib/multirepo/commands/add-command.rb +51 -51
- data/lib/multirepo/commands/branch-command.rb +88 -88
- data/lib/multirepo/commands/checkout-command.rb +127 -127
- data/lib/multirepo/commands/clone-command.rb +68 -68
- data/lib/multirepo/commands/command.rb +87 -87
- data/lib/multirepo/commands/commands.rb +15 -15
- data/lib/multirepo/commands/do-command.rb +101 -101
- data/lib/multirepo/commands/graph-command.rb +43 -43
- data/lib/multirepo/commands/init-command.rb +121 -121
- data/lib/multirepo/commands/inspect-command.rb +48 -48
- data/lib/multirepo/commands/install-command.rb +170 -170
- data/lib/multirepo/commands/merge-command.rb +249 -249
- data/lib/multirepo/commands/open-command.rb +55 -55
- data/lib/multirepo/commands/remove-command.rb +48 -48
- data/lib/multirepo/commands/uninit-command.rb +18 -18
- data/lib/multirepo/commands/update-command.rb +112 -112
- data/lib/multirepo/config.rb +19 -19
- data/lib/multirepo/files/config-entry.rb +39 -39
- data/lib/multirepo/files/config-file.rb +52 -48
- data/lib/multirepo/files/lock-entry.rb +29 -29
- data/lib/multirepo/files/lock-file.rb +62 -58
- data/lib/multirepo/files/meta-file.rb +51 -47
- data/lib/multirepo/files/tracking-file.rb +9 -9
- data/lib/multirepo/files/tracking-files.rb +65 -65
- data/lib/multirepo/git/branch.rb +32 -32
- data/lib/multirepo/git/change.rb +11 -11
- data/lib/multirepo/git/commit.rb +7 -7
- data/lib/multirepo/git/git-runner.rb +56 -56
- data/lib/multirepo/git/git.rb +10 -10
- data/lib/multirepo/git/ref.rb +38 -38
- data/lib/multirepo/git/remote.rb +17 -17
- data/lib/multirepo/git/repo.rb +129 -129
- data/lib/multirepo/hooks/post-commit-hook.rb +23 -23
- data/lib/multirepo/hooks/pre-commit-hook.rb +35 -35
- data/lib/multirepo/info.rb +5 -5
- data/lib/multirepo/logic/dependency.rb +6 -6
- data/lib/multirepo/logic/merge-descriptor.rb +95 -95
- data/lib/multirepo/logic/node.rb +72 -72
- data/lib/multirepo/logic/performer.rb +55 -55
- data/lib/multirepo/logic/repo-selection.rb +25 -25
- data/lib/multirepo/logic/revision-selection.rb +15 -15
- data/lib/multirepo/logic/revision-selector.rb +23 -23
- data/lib/multirepo/logic/version-comparer.rb +10 -10
- data/lib/multirepo/multirepo-exception.rb +6 -6
- data/lib/multirepo/output/extra-output.rb +12 -12
- data/lib/multirepo/output/teamcity-extra-output.rb +11 -11
- data/lib/multirepo/utility/console.rb +52 -52
- data/lib/multirepo/utility/popen-runner.rb +27 -27
- data/lib/multirepo/utility/system-runner.rb +14 -14
- data/lib/multirepo/utility/utils.rb +99 -99
- data/lib/multirepo/utility/verbosity.rb +6 -6
- data/resources/.gitconfig +2 -2
- data/resources/post-commit +6 -6
- data/resources/pre-commit +6 -6
- data/spec/integration/init_spec.rb +19 -19
- data/spec/spec_helper.rb +89 -89
- metadata +9 -15
data/lib/multirepo/git/ref.rb
CHANGED
@@ -1,38 +1,38 @@
|
|
1
|
-
require_relative "git-runner"
|
2
|
-
|
3
|
-
module MultiRepo
|
4
|
-
class Ref
|
5
|
-
attr_accessor :name
|
6
|
-
|
7
|
-
def initialize(repo, name)
|
8
|
-
@repo = repo
|
9
|
-
@name = name
|
10
|
-
end
|
11
|
-
|
12
|
-
def exists?
|
13
|
-
output = GitRunner.run(@repo.path, "rev-parse --verify --quiet #{@name}", Verbosity::OUTPUT_NEVER).strip
|
14
|
-
return output != ""
|
15
|
-
end
|
16
|
-
|
17
|
-
def commit_id
|
18
|
-
GitRunner.run(@repo.path, "rev-parse #{@name}", Verbosity::OUTPUT_NEVER).strip
|
19
|
-
end
|
20
|
-
|
21
|
-
def short_commit_id
|
22
|
-
GitRunner.run(@repo.path, "rev-parse --short #{@name}", Verbosity::OUTPUT_NEVER).strip
|
23
|
-
end
|
24
|
-
|
25
|
-
def merge_commit?
|
26
|
-
lines = GitRunner.run(@repo.path, "cat-file -p #{@name}", Verbosity::OUTPUT_NEVER).split("\n")
|
27
|
-
parents = lines.grep(/^parent /)
|
28
|
-
return parents.count > 1
|
29
|
-
end
|
30
|
-
|
31
|
-
def can_fast_forward_to?(ref)
|
32
|
-
# http://stackoverflow.com/a/2934062/167983
|
33
|
-
rev_parse_output = GitRunner.run(@repo.path, "rev-parse #{@name}", Verbosity::OUTPUT_NEVER)
|
34
|
-
merge_base_output = GitRunner.run(@repo.path, "merge-base \"#{rev_parse_output}\" \"#{ref.name}\"", Verbosity::OUTPUT_NEVER)
|
35
|
-
return merge_base_output == rev_parse_output
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
1
|
+
require_relative "git-runner"
|
2
|
+
|
3
|
+
module MultiRepo
|
4
|
+
class Ref
|
5
|
+
attr_accessor :name
|
6
|
+
|
7
|
+
def initialize(repo, name)
|
8
|
+
@repo = repo
|
9
|
+
@name = name
|
10
|
+
end
|
11
|
+
|
12
|
+
def exists?
|
13
|
+
output = GitRunner.run(@repo.path, "rev-parse --verify --quiet #{@name}", Verbosity::OUTPUT_NEVER).strip
|
14
|
+
return output != ""
|
15
|
+
end
|
16
|
+
|
17
|
+
def commit_id
|
18
|
+
GitRunner.run(@repo.path, "rev-parse #{@name}", Verbosity::OUTPUT_NEVER).strip
|
19
|
+
end
|
20
|
+
|
21
|
+
def short_commit_id
|
22
|
+
GitRunner.run(@repo.path, "rev-parse --short #{@name}", Verbosity::OUTPUT_NEVER).strip
|
23
|
+
end
|
24
|
+
|
25
|
+
def merge_commit?
|
26
|
+
lines = GitRunner.run(@repo.path, "cat-file -p #{@name}", Verbosity::OUTPUT_NEVER).split("\n")
|
27
|
+
parents = lines.grep(/^parent /)
|
28
|
+
return parents.count > 1
|
29
|
+
end
|
30
|
+
|
31
|
+
def can_fast_forward_to?(ref)
|
32
|
+
# http://stackoverflow.com/a/2934062/167983
|
33
|
+
rev_parse_output = GitRunner.run(@repo.path, "rev-parse #{@name}", Verbosity::OUTPUT_NEVER)
|
34
|
+
merge_base_output = GitRunner.run(@repo.path, "merge-base \"#{rev_parse_output}\" \"#{ref.name}\"", Verbosity::OUTPUT_NEVER)
|
35
|
+
return merge_base_output == rev_parse_output
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/multirepo/git/remote.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
require_relative "git-runner"
|
2
|
-
|
3
|
-
module MultiRepo
|
4
|
-
class Remote
|
5
|
-
attr_accessor :name
|
6
|
-
|
7
|
-
def initialize(repo, name)
|
8
|
-
@repo = repo
|
9
|
-
@name = name
|
10
|
-
end
|
11
|
-
|
12
|
-
def url
|
13
|
-
output = GitRunner.run(@repo.path, "config --get remote.#{@name}.url", Verbosity::OUTPUT_NEVER).strip
|
14
|
-
return output == "" ? nil : output
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
1
|
+
require_relative "git-runner"
|
2
|
+
|
3
|
+
module MultiRepo
|
4
|
+
class Remote
|
5
|
+
attr_accessor :name
|
6
|
+
|
7
|
+
def initialize(repo, name)
|
8
|
+
@repo = repo
|
9
|
+
@name = name
|
10
|
+
end
|
11
|
+
|
12
|
+
def url
|
13
|
+
output = GitRunner.run(@repo.path, "config --get remote.#{@name}.url", Verbosity::OUTPUT_NEVER).strip
|
14
|
+
return output == "" ? nil : output
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/multirepo/git/repo.rb
CHANGED
@@ -1,129 +1,129 @@
|
|
1
|
-
require_relative "branch"
|
2
|
-
require_relative "remote"
|
3
|
-
require_relative "commit"
|
4
|
-
require_relative "change"
|
5
|
-
|
6
|
-
module MultiRepo
|
7
|
-
class Repo
|
8
|
-
attr_accessor :path
|
9
|
-
attr_accessor :basename
|
10
|
-
|
11
|
-
def initialize(path)
|
12
|
-
@path = path
|
13
|
-
@basename = Pathname.new(path).basename.to_s
|
14
|
-
end
|
15
|
-
|
16
|
-
# Inspection
|
17
|
-
|
18
|
-
def exists?
|
19
|
-
return false unless Dir.exist?("#{@path}/.git")
|
20
|
-
return GitRunner.run(@path, "rev-parse --is-inside-work-tree", Verbosity::OUTPUT_NEVER).strip == "true"
|
21
|
-
end
|
22
|
-
|
23
|
-
def head_born?
|
24
|
-
result = GitRunner.run(@path, "rev-parse HEAD --", Verbosity::OUTPUT_NEVER).strip
|
25
|
-
return !result.start_with?("fatal: bad revision")
|
26
|
-
end
|
27
|
-
|
28
|
-
def current_revision
|
29
|
-
(current_branch || current_commit).name
|
30
|
-
end
|
31
|
-
|
32
|
-
def clean?
|
33
|
-
changes.count == 0
|
34
|
-
end
|
35
|
-
|
36
|
-
def local_branches
|
37
|
-
branches_by_removing_prefix(%r{^refs/heads/})
|
38
|
-
end
|
39
|
-
|
40
|
-
def remote_branches
|
41
|
-
branches_by_removing_prefix(%r{^refs/remotes/})
|
42
|
-
end
|
43
|
-
|
44
|
-
def changes
|
45
|
-
output = GitRunner.run(@path, "status --porcelain", Verbosity::OUTPUT_NEVER)
|
46
|
-
lines = output.split("\n").each(&:strip).delete_if{ |f| f == "" }
|
47
|
-
lines.map { |l| Change.new(l) }
|
48
|
-
end
|
49
|
-
|
50
|
-
# Operations
|
51
|
-
|
52
|
-
def fetch
|
53
|
-
GitRunner.run_as_system(@path, "fetch --prune")
|
54
|
-
GitRunner.last_command_succeeded
|
55
|
-
end
|
56
|
-
|
57
|
-
def clone(url, options = nil)
|
58
|
-
options = {} unless options
|
59
|
-
|
60
|
-
branch = options[:branch]
|
61
|
-
|
62
|
-
command = "clone #{url} #{@path}"
|
63
|
-
command << " -q" if options[:quiet] || false
|
64
|
-
command << " -b #{branch}" if branch
|
65
|
-
command << " --depth 1" if options[:shallow] || false
|
66
|
-
|
67
|
-
GitRunner.run_as_system(".", command)
|
68
|
-
GitRunner.last_command_succeeded
|
69
|
-
end
|
70
|
-
|
71
|
-
def checkout(ref_name)
|
72
|
-
GitRunner.run(@path, "checkout #{ref_name}", Verbosity::OUTPUT_ON_ERROR)
|
73
|
-
GitRunner.last_command_succeeded
|
74
|
-
end
|
75
|
-
|
76
|
-
# Current
|
77
|
-
|
78
|
-
def head
|
79
|
-
return nil unless exists? && head_born?
|
80
|
-
Ref.new(self, "HEAD")
|
81
|
-
end
|
82
|
-
|
83
|
-
def current_commit
|
84
|
-
return nil unless exists? && head_born?
|
85
|
-
Commit.new(self, head.commit_id)
|
86
|
-
end
|
87
|
-
|
88
|
-
def current_branch
|
89
|
-
return nil unless exists? && head_born?
|
90
|
-
name = GitRunner.run(@path, "rev-parse --abbrev-ref HEAD", Verbosity::OUTPUT_NEVER).strip
|
91
|
-
return nil if name == "HEAD" # Code assumes that current_branch will be nil when we're in floating HEAD
|
92
|
-
Branch.new(self, name)
|
93
|
-
end
|
94
|
-
|
95
|
-
# Factory methods
|
96
|
-
|
97
|
-
def ref(name)
|
98
|
-
Ref.new(self, name)
|
99
|
-
end
|
100
|
-
|
101
|
-
def branch(name)
|
102
|
-
Branch.new(self, name)
|
103
|
-
end
|
104
|
-
|
105
|
-
def remote(name)
|
106
|
-
Remote.new(self, name)
|
107
|
-
end
|
108
|
-
|
109
|
-
def commit(id)
|
110
|
-
Commit.new(self, id)
|
111
|
-
end
|
112
|
-
|
113
|
-
# Private helper methods
|
114
|
-
|
115
|
-
private
|
116
|
-
|
117
|
-
def branches_by_removing_prefix(prefix_regex)
|
118
|
-
output = GitRunner.run(@path, "for-each-ref --format='%(refname)'", Verbosity::OUTPUT_NEVER)
|
119
|
-
all_refs = output.strip.split("\n")
|
120
|
-
|
121
|
-
# Remove surrounding quotes on Windows
|
122
|
-
all_refs = all_refs.map { |l| l.sub(/^\'/, "").sub(/\'$/, "") }
|
123
|
-
|
124
|
-
full_names = all_refs.select { |r| r =~ prefix_regex }
|
125
|
-
names = full_names.map{ |f| f.sub(prefix_regex, "") }.delete_if{ |n| n =~ /HEAD$/ }
|
126
|
-
names.map { |b| Branch.new(self, b) }
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
1
|
+
require_relative "branch"
|
2
|
+
require_relative "remote"
|
3
|
+
require_relative "commit"
|
4
|
+
require_relative "change"
|
5
|
+
|
6
|
+
module MultiRepo
|
7
|
+
class Repo
|
8
|
+
attr_accessor :path
|
9
|
+
attr_accessor :basename
|
10
|
+
|
11
|
+
def initialize(path)
|
12
|
+
@path = path
|
13
|
+
@basename = Pathname.new(path).basename.to_s
|
14
|
+
end
|
15
|
+
|
16
|
+
# Inspection
|
17
|
+
|
18
|
+
def exists?
|
19
|
+
return false unless Dir.exist?("#{@path}/.git")
|
20
|
+
return GitRunner.run(@path, "rev-parse --is-inside-work-tree", Verbosity::OUTPUT_NEVER).strip == "true"
|
21
|
+
end
|
22
|
+
|
23
|
+
def head_born?
|
24
|
+
result = GitRunner.run(@path, "rev-parse HEAD --", Verbosity::OUTPUT_NEVER).strip
|
25
|
+
return !result.start_with?("fatal: bad revision")
|
26
|
+
end
|
27
|
+
|
28
|
+
def current_revision
|
29
|
+
(current_branch || current_commit).name
|
30
|
+
end
|
31
|
+
|
32
|
+
def clean?
|
33
|
+
changes.count == 0
|
34
|
+
end
|
35
|
+
|
36
|
+
def local_branches
|
37
|
+
branches_by_removing_prefix(%r{^refs/heads/})
|
38
|
+
end
|
39
|
+
|
40
|
+
def remote_branches
|
41
|
+
branches_by_removing_prefix(%r{^refs/remotes/})
|
42
|
+
end
|
43
|
+
|
44
|
+
def changes
|
45
|
+
output = GitRunner.run(@path, "status --porcelain", Verbosity::OUTPUT_NEVER)
|
46
|
+
lines = output.split("\n").each(&:strip).delete_if{ |f| f == "" }
|
47
|
+
lines.map { |l| Change.new(l) }
|
48
|
+
end
|
49
|
+
|
50
|
+
# Operations
|
51
|
+
|
52
|
+
def fetch
|
53
|
+
GitRunner.run_as_system(@path, "fetch --prune")
|
54
|
+
GitRunner.last_command_succeeded
|
55
|
+
end
|
56
|
+
|
57
|
+
def clone(url, options = nil)
|
58
|
+
options = {} unless options
|
59
|
+
|
60
|
+
branch = options[:branch]
|
61
|
+
|
62
|
+
command = "clone #{url} #{@path}"
|
63
|
+
command << " -q" if options[:quiet] || false
|
64
|
+
command << " -b #{branch}" if branch
|
65
|
+
command << " --depth 1" if options[:shallow] || false
|
66
|
+
|
67
|
+
GitRunner.run_as_system(".", command)
|
68
|
+
GitRunner.last_command_succeeded
|
69
|
+
end
|
70
|
+
|
71
|
+
def checkout(ref_name)
|
72
|
+
GitRunner.run(@path, "checkout #{ref_name}", Verbosity::OUTPUT_ON_ERROR)
|
73
|
+
GitRunner.last_command_succeeded
|
74
|
+
end
|
75
|
+
|
76
|
+
# Current
|
77
|
+
|
78
|
+
def head
|
79
|
+
return nil unless exists? && head_born?
|
80
|
+
Ref.new(self, "HEAD")
|
81
|
+
end
|
82
|
+
|
83
|
+
def current_commit
|
84
|
+
return nil unless exists? && head_born?
|
85
|
+
Commit.new(self, head.commit_id)
|
86
|
+
end
|
87
|
+
|
88
|
+
def current_branch
|
89
|
+
return nil unless exists? && head_born?
|
90
|
+
name = GitRunner.run(@path, "rev-parse --abbrev-ref HEAD", Verbosity::OUTPUT_NEVER).strip
|
91
|
+
return nil if name == "HEAD" # Code assumes that current_branch will be nil when we're in floating HEAD
|
92
|
+
Branch.new(self, name)
|
93
|
+
end
|
94
|
+
|
95
|
+
# Factory methods
|
96
|
+
|
97
|
+
def ref(name)
|
98
|
+
Ref.new(self, name)
|
99
|
+
end
|
100
|
+
|
101
|
+
def branch(name)
|
102
|
+
Branch.new(self, name)
|
103
|
+
end
|
104
|
+
|
105
|
+
def remote(name)
|
106
|
+
Remote.new(self, name)
|
107
|
+
end
|
108
|
+
|
109
|
+
def commit(id)
|
110
|
+
Commit.new(self, id)
|
111
|
+
end
|
112
|
+
|
113
|
+
# Private helper methods
|
114
|
+
|
115
|
+
private
|
116
|
+
|
117
|
+
def branches_by_removing_prefix(prefix_regex)
|
118
|
+
output = GitRunner.run(@path, "for-each-ref --format='%(refname)'", Verbosity::OUTPUT_NEVER)
|
119
|
+
all_refs = output.strip.split("\n")
|
120
|
+
|
121
|
+
# Remove surrounding quotes on Windows
|
122
|
+
all_refs = all_refs.map { |l| l.sub(/^\'/, "").sub(/\'$/, "") }
|
123
|
+
|
124
|
+
full_names = all_refs.select { |r| r =~ prefix_regex }
|
125
|
+
names = full_names.map{ |f| f.sub(prefix_regex, "") }.delete_if{ |n| n =~ /HEAD$/ }
|
126
|
+
names.map { |b| Branch.new(self, b) }
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
@@ -1,23 +1,23 @@
|
|
1
|
-
require "multirepo/files/config-file"
|
2
|
-
require "multirepo/files/tracking-files"
|
3
|
-
require "multirepo/utility/utils"
|
4
|
-
require "multirepo/utility/console"
|
5
|
-
|
6
|
-
module MultiRepo
|
7
|
-
class PostCommitHook
|
8
|
-
def self.run
|
9
|
-
Config.instance.running_git_hook = true
|
10
|
-
|
11
|
-
Console.log_step("Performing post-commit operations...")
|
12
|
-
|
13
|
-
# Works around bug #91565510 (https://www.pivotaltracker.com/story/show/91565510)
|
14
|
-
TrackingFiles.new(".").stage
|
15
|
-
Console.log_info("Cleaned-up staging area")
|
16
|
-
|
17
|
-
exit 0
|
18
|
-
rescue StandardError => e
|
19
|
-
Console.log_error("Post-commit hook failed to execute! #{e.message}")
|
20
|
-
exit 1
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
1
|
+
require "multirepo/files/config-file"
|
2
|
+
require "multirepo/files/tracking-files"
|
3
|
+
require "multirepo/utility/utils"
|
4
|
+
require "multirepo/utility/console"
|
5
|
+
|
6
|
+
module MultiRepo
|
7
|
+
class PostCommitHook
|
8
|
+
def self.run
|
9
|
+
Config.instance.running_git_hook = true
|
10
|
+
|
11
|
+
Console.log_step("Performing post-commit operations...")
|
12
|
+
|
13
|
+
# Works around bug #91565510 (https://www.pivotaltracker.com/story/show/91565510)
|
14
|
+
TrackingFiles.new(".").stage
|
15
|
+
Console.log_info("Cleaned-up staging area")
|
16
|
+
|
17
|
+
exit 0
|
18
|
+
rescue StandardError => e
|
19
|
+
Console.log_error("Post-commit hook failed to execute! #{e.message}")
|
20
|
+
exit 1
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,35 +1,35 @@
|
|
1
|
-
require "multirepo/files/config-file"
|
2
|
-
require "multirepo/files/tracking-files"
|
3
|
-
require "multirepo/utility/utils"
|
4
|
-
require "multirepo/utility/console"
|
5
|
-
|
6
|
-
module MultiRepo
|
7
|
-
class PreCommitHook
|
8
|
-
def self.run
|
9
|
-
Config.instance.running_git_hook = true
|
10
|
-
|
11
|
-
Console.log_step("Performing pre-commit operations...")
|
12
|
-
|
13
|
-
dependencies_clean = Utils.dependencies_clean?(ConfigFile.new(".").load_entries)
|
14
|
-
|
15
|
-
unless dependencies_clean
|
16
|
-
Console.log_error("You must commit changes to your dependencies before you can commit this repo")
|
17
|
-
exit 1
|
18
|
-
end
|
19
|
-
|
20
|
-
tracking_files = TrackingFiles.new(".")
|
21
|
-
tracking_files.update
|
22
|
-
tracking_files.stage
|
23
|
-
|
24
|
-
Console.log_info("Updated and staged tracking files")
|
25
|
-
|
26
|
-
exit 0
|
27
|
-
rescue MultiRepoException => e
|
28
|
-
Console.log_error("Can't perform commit. #{e.message}")
|
29
|
-
exit 1
|
30
|
-
rescue StandardError => e
|
31
|
-
Console.log_error("Pre-commit hook failed to execute! #{e.message}")
|
32
|
-
exit 1
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
1
|
+
require "multirepo/files/config-file"
|
2
|
+
require "multirepo/files/tracking-files"
|
3
|
+
require "multirepo/utility/utils"
|
4
|
+
require "multirepo/utility/console"
|
5
|
+
|
6
|
+
module MultiRepo
|
7
|
+
class PreCommitHook
|
8
|
+
def self.run
|
9
|
+
Config.instance.running_git_hook = true
|
10
|
+
|
11
|
+
Console.log_step("Performing pre-commit operations...")
|
12
|
+
|
13
|
+
dependencies_clean = Utils.dependencies_clean?(ConfigFile.new(".").load_entries)
|
14
|
+
|
15
|
+
unless dependencies_clean
|
16
|
+
Console.log_error("You must commit changes to your dependencies before you can commit this repo")
|
17
|
+
exit 1
|
18
|
+
end
|
19
|
+
|
20
|
+
tracking_files = TrackingFiles.new(".")
|
21
|
+
tracking_files.update
|
22
|
+
tracking_files.stage
|
23
|
+
|
24
|
+
Console.log_info("Updated and staged tracking files")
|
25
|
+
|
26
|
+
exit 0
|
27
|
+
rescue MultiRepoException => e
|
28
|
+
Console.log_error("Can't perform commit. #{e.message}")
|
29
|
+
exit 1
|
30
|
+
rescue StandardError => e
|
31
|
+
Console.log_error("Pre-commit hook failed to execute! #{e.message}")
|
32
|
+
exit 1
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/multirepo/info.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
module MultiRepo
|
2
|
-
NAME = "git-multirepo"
|
3
|
-
VERSION = "1.0.0.
|
4
|
-
DESCRIPTION = "Track multiple Git repositories side-by-side."
|
5
|
-
end
|
1
|
+
module MultiRepo
|
2
|
+
NAME = "git-multirepo"
|
3
|
+
VERSION = "1.0.0.beta61"
|
4
|
+
DESCRIPTION = "Track multiple Git repositories side-by-side."
|
5
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
module MultiRepo
|
2
|
-
class Dependency
|
3
|
-
attr_accessor :config_entry
|
4
|
-
attr_accessor :lock_entry
|
5
|
-
end
|
6
|
-
end
|
1
|
+
module MultiRepo
|
2
|
+
class Dependency
|
3
|
+
attr_accessor :config_entry
|
4
|
+
attr_accessor :lock_entry
|
5
|
+
end
|
6
|
+
end
|