git-multirepo 1.0.0.beta40 → 1.0.0.beta42
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/.multirepo.meta +2 -2
- data/.rspec +2 -2
- data/Gemfile +4 -4
- data/Gemfile.lock +42 -42
- data/LICENSE +22 -22
- data/README.md +143 -146
- data/Rakefile +2 -2
- data/bin/multi +10 -10
- data/docs/bug-repros/91565510-repro.sh +20 -20
- data/docs/git-multirepo-cheatsheet.docx +0 -0
- data/git-multirepo.gemspec +31 -31
- data/lib/commands.rb +13 -15
- data/lib/git-multirepo.rb +2 -2
- data/lib/info.rb +4 -4
- data/lib/multirepo/commands/add-command.rb +50 -53
- data/lib/multirepo/commands/branch-command.rb +81 -82
- data/lib/multirepo/commands/checkout-command.rb +119 -122
- data/lib/multirepo/commands/clone-command.rb +67 -70
- data/lib/multirepo/commands/command.rb +89 -75
- data/lib/multirepo/commands/do-command.rb +100 -75
- data/lib/multirepo/commands/graph-command.rb +42 -45
- data/lib/multirepo/commands/init-command.rb +119 -119
- data/lib/multirepo/commands/install-command.rb +106 -103
- data/lib/multirepo/commands/merge-command.rb +225 -167
- data/lib/multirepo/commands/open-command.rb +55 -57
- data/lib/multirepo/commands/remove-command.rb +47 -50
- data/lib/multirepo/commands/uninit-command.rb +17 -20
- data/lib/multirepo/commands/update-command.rb +55 -60
- data/lib/multirepo/config.rb +15 -15
- data/lib/multirepo/files/config-entry.rb +38 -38
- data/lib/multirepo/files/config-file.rb +45 -45
- data/lib/multirepo/files/lock-entry.rb +28 -24
- data/lib/multirepo/files/lock-file.rb +55 -38
- data/lib/multirepo/files/meta-file.rb +40 -40
- data/lib/multirepo/files/tracking-file.rb +8 -8
- data/lib/multirepo/files/tracking-files.rb +46 -46
- data/lib/multirepo/git/branch.rb +31 -30
- data/lib/multirepo/git/change.rb +10 -10
- data/lib/multirepo/git/commit.rb +6 -17
- data/lib/multirepo/git/git-runner.rb +46 -46
- data/lib/multirepo/git/git.rb +10 -0
- data/lib/multirepo/git/ref.rb +38 -0
- data/lib/multirepo/git/remote.rb +16 -16
- data/lib/multirepo/git/repo.rb +122 -77
- data/lib/multirepo/hooks/post-commit-hook.rb +22 -22
- data/lib/multirepo/hooks/pre-commit-hook.rb +34 -31
- data/lib/multirepo/logic/dependency.rb +6 -0
- data/lib/multirepo/logic/merge-descriptor.rb +94 -12
- data/lib/multirepo/logic/node.rb +71 -44
- data/lib/multirepo/logic/performer.rb +56 -62
- data/lib/multirepo/logic/revision-selector.rb +34 -34
- data/lib/multirepo/multirepo-exception.rb +5 -5
- data/lib/multirepo/utility/console.rb +51 -51
- data/lib/multirepo/utility/runner.rb +34 -34
- data/lib/multirepo/utility/utils.rb +94 -81
- data/resources/.gitconfig +2 -2
- data/resources/post-commit +5 -5
- data/resources/pre-commit +5 -5
- data/spec/integration/init_spec.rb +18 -18
- data/spec/spec_helper.rb +89 -89
- metadata +6 -5
- data/lib/multirepo/commands/clean-command.rb +0 -32
- data/lib/multirepo/commands/fetch-command.rb +0 -31
@@ -1,58 +1,56 @@
|
|
1
|
-
require "os"
|
2
|
-
|
3
|
-
require "multirepo/utility/console"
|
4
|
-
require "multirepo/utility/utils"
|
5
|
-
|
6
|
-
module MultiRepo
|
7
|
-
class OpenCommand < Command
|
8
|
-
self.command = "open"
|
9
|
-
self.summary = "Opens repositories in the OS's file explorer."
|
10
|
-
|
11
|
-
def self.options
|
12
|
-
[
|
13
|
-
['[--main]', 'Open the main repository.'],
|
14
|
-
['[--all]', 'Open the main repository and all dependencies.'],
|
15
|
-
].concat(super)
|
16
|
-
end
|
17
|
-
|
18
|
-
def initialize(argv)
|
19
|
-
@
|
20
|
-
@
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
ensure_in_work_tree
|
34
|
-
ensure_multirepo_enabled
|
35
|
-
|
36
|
-
if @
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
open_main
|
41
|
-
else
|
42
|
-
open_dependencies
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
end
|
57
|
-
end
|
1
|
+
require "os"
|
2
|
+
|
3
|
+
require "multirepo/utility/console"
|
4
|
+
require "multirepo/utility/utils"
|
5
|
+
|
6
|
+
module MultiRepo
|
7
|
+
class OpenCommand < Command
|
8
|
+
self.command = "open"
|
9
|
+
self.summary = "Opens repositories in the OS's file explorer."
|
10
|
+
|
11
|
+
def self.options
|
12
|
+
[
|
13
|
+
['[--main]', 'Open the main repository.'],
|
14
|
+
['[--all]', 'Open the main repository and all dependencies.'],
|
15
|
+
].concat(super)
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize(argv)
|
19
|
+
@all = argv.flag?("all")
|
20
|
+
@main_only = argv.flag?("main")
|
21
|
+
@deps_only = argv.flag?("deps")
|
22
|
+
super
|
23
|
+
end
|
24
|
+
|
25
|
+
def validate!
|
26
|
+
super
|
27
|
+
unless validate_only_one_flag(@all, @main_only, @deps_only)
|
28
|
+
help! "You can't provide more than one operation modifier (--deps, --main, etc.)"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def run
|
33
|
+
ensure_in_work_tree
|
34
|
+
ensure_multirepo_enabled
|
35
|
+
|
36
|
+
if @all
|
37
|
+
open_dependencies
|
38
|
+
open_main
|
39
|
+
elsif @main_only
|
40
|
+
open_main
|
41
|
+
else
|
42
|
+
open_dependencies
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def open_main
|
47
|
+
Utils.reveal_in_default_file_browser(".")
|
48
|
+
end
|
49
|
+
|
50
|
+
def open_dependencies
|
51
|
+
ConfigFile.new(".").load_entries.each do |entry|
|
52
|
+
Utils.reveal_in_default_file_browser(entry.repo.path)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
58
56
|
end
|
@@ -1,51 +1,48 @@
|
|
1
|
-
require "multirepo/utility/console"
|
2
|
-
require "multirepo/files/config-file"
|
3
|
-
|
4
|
-
module MultiRepo
|
5
|
-
class RemoveCommand < Command
|
6
|
-
self.command = "remove"
|
7
|
-
self.summary = "Removes the specified dependency from multirepo."
|
8
|
-
|
9
|
-
def self.options
|
10
|
-
[
|
11
|
-
['<path>', 'The relative path to the dependency to remove (e.g. ../MyOldDependency).'],
|
12
|
-
['[--delete]', 'Delete the dependency on disk in addition to removing it from the multirepo config.']
|
13
|
-
].concat(super)
|
14
|
-
end
|
15
|
-
|
16
|
-
def initialize(argv)
|
17
|
-
@path = argv.shift_argument
|
18
|
-
@delete = argv.flag?("delete")
|
19
|
-
super
|
20
|
-
end
|
21
|
-
|
22
|
-
def validate!
|
23
|
-
super
|
24
|
-
help! "You must specify a dependency repository to remove" unless @path
|
25
|
-
end
|
26
|
-
|
27
|
-
def run
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
config_file
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
Console.log_error(e.message)
|
49
|
-
end
|
50
|
-
end
|
1
|
+
require "multirepo/utility/console"
|
2
|
+
require "multirepo/files/config-file"
|
3
|
+
|
4
|
+
module MultiRepo
|
5
|
+
class RemoveCommand < Command
|
6
|
+
self.command = "remove"
|
7
|
+
self.summary = "Removes the specified dependency from multirepo."
|
8
|
+
|
9
|
+
def self.options
|
10
|
+
[
|
11
|
+
['<path>', 'The relative path to the dependency to remove (e.g. ../MyOldDependency).'],
|
12
|
+
['[--delete]', 'Delete the dependency on disk in addition to removing it from the multirepo config.']
|
13
|
+
].concat(super)
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(argv)
|
17
|
+
@path = argv.shift_argument
|
18
|
+
@delete = argv.flag?("delete")
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
def validate!
|
23
|
+
super
|
24
|
+
help! "You must specify a dependency repository to remove" unless @path
|
25
|
+
end
|
26
|
+
|
27
|
+
def run
|
28
|
+
ensure_in_work_tree
|
29
|
+
ensure_multirepo_enabled
|
30
|
+
|
31
|
+
repo = Repo.new(@path)
|
32
|
+
entry = ConfigEntry.new(repo)
|
33
|
+
|
34
|
+
config_file = ConfigFile.new(".")
|
35
|
+
if config_file.entry_exists?(entry)
|
36
|
+
config_file.remove_entry(entry)
|
37
|
+
Console.log_step("Removed '#{@path}' from the .multirepo file")
|
38
|
+
|
39
|
+
if @delete
|
40
|
+
FileUtils.rm_rf(@path)
|
41
|
+
Console.log_step("Deleted '#{@path}' from disk")
|
42
|
+
end
|
43
|
+
else
|
44
|
+
raise MultiRepoException, "'#{@path}' isn't tracked by multirepo"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
51
48
|
end
|
@@ -1,21 +1,18 @@
|
|
1
|
-
require "multirepo/utility/console"
|
2
|
-
|
3
|
-
module MultiRepo
|
4
|
-
class UninitCommand < Command
|
5
|
-
self.command = "uninit"
|
6
|
-
self.summary = "Removes all traces of multirepo in the current multirepo repository."
|
7
|
-
|
8
|
-
def run
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
Console.log_error(e.message)
|
19
|
-
end
|
20
|
-
end
|
1
|
+
require "multirepo/utility/console"
|
2
|
+
|
3
|
+
module MultiRepo
|
4
|
+
class UninitCommand < Command
|
5
|
+
self.command = "uninit"
|
6
|
+
self.summary = "Removes all traces of multirepo in the current multirepo repository."
|
7
|
+
|
8
|
+
def run
|
9
|
+
ensure_in_work_tree
|
10
|
+
|
11
|
+
FileUtils.rm_f(".multirepo")
|
12
|
+
TrackingFiles.new(".").delete
|
13
|
+
uninstall_hooks
|
14
|
+
|
15
|
+
Console.log_step("All traces of multirepo have been removed from this repository")
|
16
|
+
end
|
17
|
+
end
|
21
18
|
end
|
@@ -1,61 +1,56 @@
|
|
1
|
-
require "multirepo/utility/console"
|
2
|
-
require "multirepo/files/tracking-files"
|
3
|
-
|
4
|
-
module MultiRepo
|
5
|
-
class UpdateCommand < Command
|
6
|
-
self.command = "update"
|
7
|
-
self.summary = "Force-updates the multirepo tracking files."
|
8
|
-
|
9
|
-
def self.options
|
10
|
-
[
|
11
|
-
['[--force]', 'Update the tracking files even if dependencies contain uncommitted changes.'],
|
12
|
-
['[--commit]', 'Commit the tracking files after updating them.']
|
13
|
-
].concat(super)
|
14
|
-
end
|
15
|
-
|
16
|
-
def initialize(argv)
|
17
|
-
@commit = argv.flag?("commit")
|
18
|
-
@force = argv.flag?("force")
|
19
|
-
super
|
20
|
-
end
|
21
|
-
|
22
|
-
def run
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
dependencies_clean
|
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
|
-
elsif changed
|
57
|
-
Console.log_substep(log_message)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
1
|
+
require "multirepo/utility/console"
|
2
|
+
require "multirepo/files/tracking-files"
|
3
|
+
|
4
|
+
module MultiRepo
|
5
|
+
class UpdateCommand < Command
|
6
|
+
self.command = "update"
|
7
|
+
self.summary = "Force-updates the multirepo tracking files."
|
8
|
+
|
9
|
+
def self.options
|
10
|
+
[
|
11
|
+
['[--force]', 'Update the tracking files even if dependencies contain uncommitted changes.'],
|
12
|
+
['[--commit]', 'Commit the tracking files after updating them.']
|
13
|
+
].concat(super)
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(argv)
|
17
|
+
@commit = argv.flag?("commit")
|
18
|
+
@force = argv.flag?("force")
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
def run
|
23
|
+
ensure_in_work_tree
|
24
|
+
ensure_multirepo_enabled
|
25
|
+
|
26
|
+
Console.log_step("Updating...")
|
27
|
+
|
28
|
+
dependencies_clean = Utils.dependencies_clean?(ConfigFile.new(".").load_entries)
|
29
|
+
if dependencies_clean
|
30
|
+
update_lock_file_step("Updated tracking files")
|
31
|
+
elsif !dependencies_clean && @force
|
32
|
+
update_lock_file_step("Force-updated tracking files (ignoring uncommitted changes)")
|
33
|
+
else
|
34
|
+
raise MultiRepoException, "Can't update because not all dependencies are clean"
|
35
|
+
end
|
36
|
+
|
37
|
+
Console.log_step("Done!")
|
38
|
+
end
|
39
|
+
|
40
|
+
def update_lock_file_step(log_message)
|
41
|
+
tracking_files = TrackingFiles.new(".")
|
42
|
+
changed = tracking_files.update
|
43
|
+
|
44
|
+
if changed
|
45
|
+
Console.log_substep("Updated tracking files")
|
46
|
+
else
|
47
|
+
Console.log_substep("Tracking files are already up-to-date")
|
48
|
+
end
|
49
|
+
|
50
|
+
if @commit
|
51
|
+
committed = tracking_files.commit("[multirepo] Updated tracking files manually")
|
52
|
+
Console.log_substep("Committed tracking files") if committed
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
61
56
|
end
|
data/lib/multirepo/config.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
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
|
-
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
|
+
end
|
16
16
|
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 ==(entry)
|
26
|
-
entry_path = Pathname.new(entry.path)
|
27
|
-
self_path = Pathname.new(self.path)
|
28
|
-
entry_path.exist? && self_path.exist? && entry_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
|
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 ==(entry)
|
26
|
+
entry_path = Pathname.new(entry.path)
|
27
|
+
self_path = Pathname.new(self.path)
|
28
|
+
entry_path.exist? && self_path.exist? && entry_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
39
|
end
|