git-multirepo 1.0.0.beta59 → 1.0.0.beta60
Sign up to get free protection for your applications and to get access to all the features.
- 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 +71 -65
- data/Gemfile +4 -4
- data/Gemfile.lock +47 -42
- 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 -31
- data/lib/git-multirepo.rb +3 -3
- data/lib/multirepo/commands/add-command.rb +51 -51
- data/lib/multirepo/commands/branch-command.rb +88 -82
- 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 +48 -46
- data/lib/multirepo/files/lock-entry.rb +29 -29
- data/lib/multirepo/files/lock-file.rb +58 -56
- data/lib/multirepo/files/meta-file.rb +47 -41
- data/lib/multirepo/files/tracking-file.rb +9 -9
- data/lib/multirepo/files/tracking-files.rb +65 -47
- 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 -0
- 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 +18 -6
- data/.multirepo.meta +0 -2
data/lib/multirepo/config.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
require "singleton"
|
2
|
-
|
3
|
-
module MultiRepo
|
4
|
-
class Config
|
5
|
-
include Singleton
|
6
|
-
|
7
|
-
attr_accessor :verbose
|
8
|
-
@verbose = false
|
9
|
-
|
10
|
-
attr_accessor :running_git_hook
|
11
|
-
@running_git_hook = false
|
12
|
-
|
13
|
-
attr_accessor :git_executable
|
14
|
-
@git_executable = nil
|
15
|
-
|
16
|
-
attr_accessor :extra_output
|
17
|
-
@extra_output = nil
|
18
|
-
end
|
19
|
-
end
|
1
|
+
require "singleton"
|
2
|
+
|
3
|
+
module MultiRepo
|
4
|
+
class Config
|
5
|
+
include Singleton
|
6
|
+
|
7
|
+
attr_accessor :verbose
|
8
|
+
@verbose = false
|
9
|
+
|
10
|
+
attr_accessor :running_git_hook
|
11
|
+
@running_git_hook = false
|
12
|
+
|
13
|
+
attr_accessor :git_executable
|
14
|
+
@git_executable = nil
|
15
|
+
|
16
|
+
attr_accessor :extra_output
|
17
|
+
@extra_output = nil
|
18
|
+
end
|
19
|
+
end
|
@@ -1,39 +1,39 @@
|
|
1
|
-
require "securerandom"
|
2
|
-
|
3
|
-
require "multirepo/utility/console"
|
4
|
-
require "multirepo/git/repo"
|
5
|
-
|
6
|
-
module MultiRepo
|
7
|
-
class ConfigEntry
|
8
|
-
attr_accessor :id
|
9
|
-
attr_accessor :path
|
10
|
-
attr_accessor :url
|
11
|
-
attr_accessor :repo
|
12
|
-
|
13
|
-
def encode_with(coder)
|
14
|
-
coder["id"] = @id
|
15
|
-
coder["path"] = @path
|
16
|
-
coder["url"] = @url
|
17
|
-
end
|
18
|
-
|
19
|
-
def initialize(repo)
|
20
|
-
@id = SecureRandom.uuid
|
21
|
-
@path = repo.path
|
22
|
-
@url = repo.exists? ? repo.remote('origin').url : nil
|
23
|
-
end
|
24
|
-
|
25
|
-
def ==(other)
|
26
|
-
other_path = Pathname.new(other.path)
|
27
|
-
self_path = Pathname.new(path)
|
28
|
-
other_path.exist? && self_path.exist? && other_path.realpath == self_path.realpath
|
29
|
-
end
|
30
|
-
|
31
|
-
def repo
|
32
|
-
Repo.new(path)
|
33
|
-
end
|
34
|
-
|
35
|
-
def name
|
36
|
-
repo.basename
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
1
|
+
require "securerandom"
|
2
|
+
|
3
|
+
require "multirepo/utility/console"
|
4
|
+
require "multirepo/git/repo"
|
5
|
+
|
6
|
+
module MultiRepo
|
7
|
+
class ConfigEntry
|
8
|
+
attr_accessor :id
|
9
|
+
attr_accessor :path
|
10
|
+
attr_accessor :url
|
11
|
+
attr_accessor :repo
|
12
|
+
|
13
|
+
def encode_with(coder)
|
14
|
+
coder["id"] = @id
|
15
|
+
coder["path"] = @path
|
16
|
+
coder["url"] = @url
|
17
|
+
end
|
18
|
+
|
19
|
+
def initialize(repo)
|
20
|
+
@id = SecureRandom.uuid
|
21
|
+
@path = repo.path
|
22
|
+
@url = repo.exists? ? repo.remote('origin').url : nil
|
23
|
+
end
|
24
|
+
|
25
|
+
def ==(other)
|
26
|
+
other_path = Pathname.new(other.path)
|
27
|
+
self_path = Pathname.new(path)
|
28
|
+
other_path.exist? && self_path.exist? && other_path.realpath == self_path.realpath
|
29
|
+
end
|
30
|
+
|
31
|
+
def repo
|
32
|
+
Repo.new(path)
|
33
|
+
end
|
34
|
+
|
35
|
+
def name
|
36
|
+
repo.basename
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -1,46 +1,48 @@
|
|
1
|
-
require "fileutils"
|
2
|
-
require "pathname"
|
3
|
-
|
4
|
-
require_relative "config-entry"
|
5
|
-
|
6
|
-
module MultiRepo
|
7
|
-
class ConfigFile
|
8
|
-
FILENAME = ".multirepo"
|
9
|
-
|
10
|
-
def initialize(path)
|
11
|
-
@path = path
|
12
|
-
end
|
13
|
-
|
14
|
-
def file
|
15
|
-
File.join(@path, FILENAME)
|
16
|
-
end
|
17
|
-
|
18
|
-
def filename
|
19
|
-
FILENAME
|
20
|
-
end
|
21
|
-
|
22
|
-
def exists?
|
23
|
-
File.exist?(file)
|
24
|
-
end
|
25
|
-
|
26
|
-
def load_entries
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
1
|
+
require "fileutils"
|
2
|
+
require "pathname"
|
3
|
+
|
4
|
+
require_relative "config-entry"
|
5
|
+
|
6
|
+
module MultiRepo
|
7
|
+
class ConfigFile
|
8
|
+
FILENAME = ".multirepo"
|
9
|
+
|
10
|
+
def initialize(path)
|
11
|
+
@path = path
|
12
|
+
end
|
13
|
+
|
14
|
+
def file
|
15
|
+
File.join(@path, FILENAME)
|
16
|
+
end
|
17
|
+
|
18
|
+
def filename
|
19
|
+
FILENAME
|
20
|
+
end
|
21
|
+
|
22
|
+
def exists?
|
23
|
+
File.exist?(file)
|
24
|
+
end
|
25
|
+
|
26
|
+
def load_entries
|
27
|
+
fail MultiRepoException, "Can't read config file (no permission)" if !File.stat(file).readable?
|
28
|
+
Psych.load(File.read(file))
|
29
|
+
end
|
30
|
+
|
31
|
+
def save_entries(entries)
|
32
|
+
fail MultiRepoException, "Can't write config file (no permission)" if !File.stat(file).writable?
|
33
|
+
File.write(file, Psych.dump(entries))
|
34
|
+
end
|
35
|
+
|
36
|
+
def entry_exists?(entry)
|
37
|
+
load_entries.any? { |e| e == entry }
|
38
|
+
end
|
39
|
+
|
40
|
+
def add_entry(entry)
|
41
|
+
save_entries(load_entries.push(entry))
|
42
|
+
end
|
43
|
+
|
44
|
+
def remove_entry(entry)
|
45
|
+
save_entries(load_entries.delete_if { |e| e == entry })
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -1,29 +1,29 @@
|
|
1
|
-
require "multirepo/utility/console"
|
2
|
-
require "multirepo/git/repo"
|
3
|
-
|
4
|
-
module MultiRepo
|
5
|
-
class LockEntry
|
6
|
-
attr_accessor :name
|
7
|
-
attr_accessor :id
|
8
|
-
attr_accessor :head
|
9
|
-
attr_accessor :branch
|
10
|
-
|
11
|
-
def encode_with(coder)
|
12
|
-
coder["name"] = @name
|
13
|
-
coder["id"] = @id
|
14
|
-
coder["head"] = @head
|
15
|
-
coder["branch"] = @branch
|
16
|
-
end
|
17
|
-
|
18
|
-
def initialize(config_entry)
|
19
|
-
@name = config_entry.name
|
20
|
-
@id = config_entry.id
|
21
|
-
|
22
|
-
head = config_entry.repo.head
|
23
|
-
@head = head.commit_id
|
24
|
-
|
25
|
-
current_branch = config_entry.repo.current_branch
|
26
|
-
@branch = current_branch ? current_branch.name : nil
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
1
|
+
require "multirepo/utility/console"
|
2
|
+
require "multirepo/git/repo"
|
3
|
+
|
4
|
+
module MultiRepo
|
5
|
+
class LockEntry
|
6
|
+
attr_accessor :name
|
7
|
+
attr_accessor :id
|
8
|
+
attr_accessor :head
|
9
|
+
attr_accessor :branch
|
10
|
+
|
11
|
+
def encode_with(coder)
|
12
|
+
coder["name"] = @name
|
13
|
+
coder["id"] = @id
|
14
|
+
coder["head"] = @head
|
15
|
+
coder["branch"] = @branch
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize(config_entry)
|
19
|
+
@name = config_entry.name
|
20
|
+
@id = config_entry.id
|
21
|
+
|
22
|
+
head = config_entry.repo.head
|
23
|
+
@head = head.commit_id
|
24
|
+
|
25
|
+
current_branch = config_entry.repo.current_branch
|
26
|
+
@branch = current_branch ? current_branch.name : nil
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -1,56 +1,58 @@
|
|
1
|
-
require "pathname"
|
2
|
-
require "psych"
|
3
|
-
|
4
|
-
require_relative "tracking-file"
|
5
|
-
require_relative "lock-entry"
|
6
|
-
require_relative "config-file"
|
7
|
-
|
8
|
-
module MultiRepo
|
9
|
-
class LockFile < TrackingFile
|
10
|
-
FILENAME = ".multirepo.lock"
|
11
|
-
|
12
|
-
def initialize(path)
|
13
|
-
@path = path
|
14
|
-
end
|
15
|
-
|
16
|
-
def file
|
17
|
-
File.join(@path, FILENAME)
|
18
|
-
end
|
19
|
-
|
20
|
-
def filename
|
21
|
-
FILENAME
|
22
|
-
end
|
23
|
-
|
24
|
-
def exists?
|
25
|
-
File.exist?(file)
|
26
|
-
end
|
27
|
-
|
28
|
-
def load_entries
|
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
|
-
end
|
1
|
+
require "pathname"
|
2
|
+
require "psych"
|
3
|
+
|
4
|
+
require_relative "tracking-file"
|
5
|
+
require_relative "lock-entry"
|
6
|
+
require_relative "config-file"
|
7
|
+
|
8
|
+
module MultiRepo
|
9
|
+
class LockFile < TrackingFile
|
10
|
+
FILENAME = ".multirepo.lock"
|
11
|
+
|
12
|
+
def initialize(path)
|
13
|
+
@path = path
|
14
|
+
end
|
15
|
+
|
16
|
+
def file
|
17
|
+
File.join(@path, FILENAME)
|
18
|
+
end
|
19
|
+
|
20
|
+
def filename
|
21
|
+
FILENAME
|
22
|
+
end
|
23
|
+
|
24
|
+
def exists?
|
25
|
+
File.exist?(file)
|
26
|
+
end
|
27
|
+
|
28
|
+
def load_entries
|
29
|
+
fail MultiRepoException, "Can't read lock file (no permission)" if !File.stat(file).readable?
|
30
|
+
Psych.load(File.read(file))
|
31
|
+
end
|
32
|
+
|
33
|
+
def update
|
34
|
+
fail MultiRepoException, "Can't write lock file (no permission)" if !File.stat(file).writable?
|
35
|
+
config_entries = ConfigFile.new(@path).load_entries
|
36
|
+
lock_entries = config_entries.map { |c| LockEntry.new(c) }
|
37
|
+
content = Psych.dump(lock_entries)
|
38
|
+
return update_internal(file, content)
|
39
|
+
end
|
40
|
+
|
41
|
+
def validate!
|
42
|
+
load_entries.all? { |e| validate_entry! e }
|
43
|
+
end
|
44
|
+
|
45
|
+
def validate_entry!(entry)
|
46
|
+
valid = true
|
47
|
+
|
48
|
+
# head
|
49
|
+
valid &= /\b([a-f0-9]{40})\b/ =~ entry.head.to_s
|
50
|
+
|
51
|
+
# branch
|
52
|
+
GitRunner.run(@path, "check-ref-format --branch #{entry.branch}", Verbosity::OUTPUT_NEVER)
|
53
|
+
valid &= (entry.branch == "" || GitRunner.last_command_succeeded)
|
54
|
+
|
55
|
+
return valid
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -1,41 +1,47 @@
|
|
1
|
-
require "pathname"
|
2
|
-
require "psych"
|
3
|
-
|
4
|
-
require "multirepo/info"
|
5
|
-
require_relative "tracking-file"
|
6
|
-
require_relative "lock-entry"
|
7
|
-
require_relative "config-file"
|
8
|
-
|
9
|
-
module MultiRepo
|
10
|
-
class MetaFile < TrackingFile
|
11
|
-
FILENAME = ".multirepo.meta"
|
12
|
-
|
13
|
-
attr_accessor :version
|
14
|
-
|
15
|
-
def initialize(path)
|
16
|
-
@path = path
|
17
|
-
@version = MultiRepo::VERSION
|
18
|
-
end
|
19
|
-
|
20
|
-
def file
|
21
|
-
File.join(@path, FILENAME)
|
22
|
-
end
|
23
|
-
|
24
|
-
def filename
|
25
|
-
FILENAME
|
26
|
-
end
|
27
|
-
|
28
|
-
def
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
def
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
def
|
37
|
-
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
|
1
|
+
require "pathname"
|
2
|
+
require "psych"
|
3
|
+
|
4
|
+
require "multirepo/info"
|
5
|
+
require_relative "tracking-file"
|
6
|
+
require_relative "lock-entry"
|
7
|
+
require_relative "config-file"
|
8
|
+
|
9
|
+
module MultiRepo
|
10
|
+
class MetaFile < TrackingFile
|
11
|
+
FILENAME = ".multirepo.meta"
|
12
|
+
|
13
|
+
attr_accessor :version
|
14
|
+
|
15
|
+
def initialize(path)
|
16
|
+
@path = path
|
17
|
+
@version = MultiRepo::VERSION
|
18
|
+
end
|
19
|
+
|
20
|
+
def file
|
21
|
+
File.join(@path, FILENAME)
|
22
|
+
end
|
23
|
+
|
24
|
+
def filename
|
25
|
+
FILENAME
|
26
|
+
end
|
27
|
+
|
28
|
+
def exists?
|
29
|
+
File.exist?(file)
|
30
|
+
end
|
31
|
+
|
32
|
+
def encode_with(coder)
|
33
|
+
coder["version"] = @version
|
34
|
+
end
|
35
|
+
|
36
|
+
def load
|
37
|
+
fail MultiRepoException, "Can't read meta file (no permission)" if !File.stat(file).readable?
|
38
|
+
Psych.load(File.read(file))
|
39
|
+
end
|
40
|
+
|
41
|
+
def update
|
42
|
+
fail MultiRepoException, "Can't write meta file (no permission)" if !File.stat(file).writable?
|
43
|
+
content = Psych.dump(self)
|
44
|
+
return update_internal(file, content)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|