git-multirepo 1.0.0.beta49 → 1.0.0.beta50
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/.multirepo.meta +2 -2
- data/.rspec +2 -2
- data/.rubocop.yml +79 -79
- data/CHANGELOG.md +29 -25
- data/Gemfile +4 -4
- data/Gemfile.lock +42 -42
- data/LICENSE +22 -22
- data/README.md +154 -154
- data/Rakefile +1 -1
- data/bin/multi +11 -11
- data/docs/bug-repros/91565510-repro.sh +20 -20
- data/git-multirepo.gemspec +31 -31
- data/lib/git-multirepo.rb +3 -3
- data/lib/multirepo/commands/add-command.rb +51 -51
- data/lib/multirepo/commands/branch-command.rb +82 -82
- data/lib/multirepo/commands/checkout-command.rb +120 -120
- data/lib/multirepo/commands/clone-command.rb +68 -68
- data/lib/multirepo/commands/command.rb +90 -90
- data/lib/multirepo/commands/commands.rb +15 -0
- data/lib/multirepo/commands/do-command.rb +103 -103
- 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 +39 -39
- data/lib/multirepo/commands/install-command.rb +153 -153
- data/lib/multirepo/commands/merge-command.rb +249 -225
- data/lib/multirepo/commands/open-command.rb +57 -57
- 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 +106 -94
- data/lib/multirepo/config.rb +16 -16
- data/lib/multirepo/files/config-entry.rb +39 -39
- data/lib/multirepo/files/config-file.rb +46 -46
- data/lib/multirepo/files/lock-entry.rb +29 -29
- data/lib/multirepo/files/lock-file.rb +56 -56
- data/lib/multirepo/files/meta-file.rb +41 -41
- data/lib/multirepo/files/tracking-file.rb +9 -9
- data/lib/multirepo/files/tracking-files.rb +47 -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 +124 -124
- data/lib/multirepo/hooks/post-commit-hook.rb +23 -23
- data/lib/multirepo/hooks/pre-commit-hook.rb +35 -35
- data/lib/{info.rb → 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/revision-selector.rb +35 -35
- data/lib/multirepo/multirepo-exception.rb +6 -6
- 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 +95 -95
- 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 +33 -33
- data/lib/commands.rb +0 -15
@@ -1,57 +1,57 @@
|
|
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
|
-
['[--all]', 'Open the main repository and all dependencies.'],
|
14
|
-
['[--main]', 'Open the main repository.'],
|
15
|
-
['[--deps]', 'Open dependencies.']
|
16
|
-
].concat(super)
|
17
|
-
end
|
18
|
-
|
19
|
-
def initialize(argv)
|
20
|
-
@all = argv.flag?("all")
|
21
|
-
@main_only = argv.flag?("main")
|
22
|
-
@deps_only = argv.flag?("deps")
|
23
|
-
super
|
24
|
-
end
|
25
|
-
|
26
|
-
def validate!
|
27
|
-
super
|
28
|
-
unless validate_only_one_flag(@all, @main_only, @deps_only)
|
29
|
-
help! "You can't provide more than one operation modifier (--deps, --main, etc.)"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def run
|
34
|
-
ensure_in_work_tree
|
35
|
-
ensure_multirepo_enabled
|
36
|
-
|
37
|
-
if @main_only
|
38
|
-
open_main
|
39
|
-
elsif @deps_only
|
40
|
-
open_dependencies
|
41
|
-
else
|
42
|
-
open_dependencies
|
43
|
-
open_main
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def open_main
|
48
|
-
Utils.reveal_in_default_file_browser(".")
|
49
|
-
end
|
50
|
-
|
51
|
-
def open_dependencies
|
52
|
-
ConfigFile.new(".").load_entries.each do |entry|
|
53
|
-
Utils.reveal_in_default_file_browser(entry.repo.path)
|
54
|
-
end
|
55
|
-
end
|
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
|
+
['[--all]', 'Open the main repository and all dependencies.'],
|
14
|
+
['[--main]', 'Open the main repository.'],
|
15
|
+
['[--deps]', 'Open dependencies.']
|
16
|
+
].concat(super)
|
17
|
+
end
|
18
|
+
|
19
|
+
def initialize(argv)
|
20
|
+
@all = argv.flag?("all")
|
21
|
+
@main_only = argv.flag?("main")
|
22
|
+
@deps_only = argv.flag?("deps")
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
26
|
+
def validate!
|
27
|
+
super
|
28
|
+
unless validate_only_one_flag(@all, @main_only, @deps_only)
|
29
|
+
help! "You can't provide more than one operation modifier (--deps, --main, etc.)"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def run
|
34
|
+
ensure_in_work_tree
|
35
|
+
ensure_multirepo_enabled
|
36
|
+
|
37
|
+
if @main_only
|
38
|
+
open_main
|
39
|
+
elsif @deps_only
|
40
|
+
open_dependencies
|
41
|
+
else
|
42
|
+
open_dependencies
|
43
|
+
open_main
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def open_main
|
48
|
+
Utils.reveal_in_default_file_browser(".")
|
49
|
+
end
|
50
|
+
|
51
|
+
def open_dependencies
|
52
|
+
ConfigFile.new(".").load_entries.each do |entry|
|
53
|
+
Utils.reveal_in_default_file_browser(entry.repo.path)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -1,48 +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
|
-
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
|
-
fail MultiRepoException, "'#{@path}' isn't tracked by multirepo"
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
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
|
+
fail MultiRepoException, "'#{@path}' isn't tracked by multirepo"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -1,18 +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
|
-
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
|
18
|
-
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
|
18
|
+
end
|
@@ -1,94 +1,106 @@
|
|
1
|
-
require "multirepo/utility/console"
|
2
|
-
require "multirepo/logic/performer"
|
3
|
-
require "multirepo/files/tracking-files"
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
self.
|
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
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
if
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
1
|
+
require "multirepo/utility/console"
|
2
|
+
require "multirepo/logic/performer"
|
3
|
+
require "multirepo/files/tracking-files"
|
4
|
+
require "multirepo/git/git-runner"
|
5
|
+
|
6
|
+
module MultiRepo
|
7
|
+
class UpdateCommand < Command
|
8
|
+
self.command = "update"
|
9
|
+
self.summary = "Force-updates the multirepo tracking files."
|
10
|
+
|
11
|
+
def self.options
|
12
|
+
[
|
13
|
+
['[--all]', 'Update the main repository and all dependencies.'],
|
14
|
+
['[--main]', 'Update the main repository.'],
|
15
|
+
['[--deps]', 'Update dependencies.'],
|
16
|
+
['[--force]', 'Update the tracking files even if dependencies contain uncommitted changes.'],
|
17
|
+
['[--commit]', 'Commit the tracking files after updating them.']
|
18
|
+
].concat(super)
|
19
|
+
end
|
20
|
+
|
21
|
+
def initialize(argv)
|
22
|
+
@all = argv.flag?("all")
|
23
|
+
@main_only = argv.flag?("main")
|
24
|
+
@deps_only = argv.flag?("deps")
|
25
|
+
@commit = argv.flag?("commit")
|
26
|
+
@force = argv.flag?("force")
|
27
|
+
super
|
28
|
+
end
|
29
|
+
|
30
|
+
def validate!
|
31
|
+
super
|
32
|
+
unless validate_only_one_flag(@all, @main_only, @deps_only)
|
33
|
+
help! "You can't provide more than one operation modifier (--deps, --main, etc.)"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def run
|
38
|
+
ensure_in_work_tree
|
39
|
+
ensure_multirepo_enabled
|
40
|
+
|
41
|
+
dependencies_clean = Utils.dependencies_clean?(ConfigFile.new(".").load_entries)
|
42
|
+
if dependencies_clean || @force
|
43
|
+
update_tracking_files_step
|
44
|
+
else
|
45
|
+
fail MultiRepoException, "Can't update because not all dependencies are clean"
|
46
|
+
end
|
47
|
+
|
48
|
+
Console.log_step("Done!")
|
49
|
+
end
|
50
|
+
|
51
|
+
def update_tracking_files_step
|
52
|
+
main_changed = false
|
53
|
+
if @main_only
|
54
|
+
Console.log_step("Updating main repo...")
|
55
|
+
main_changed = update_main
|
56
|
+
elsif @deps_only
|
57
|
+
Console.log_step("Updating dependencies...")
|
58
|
+
update_dependencies
|
59
|
+
else
|
60
|
+
Console.log_step("Updating main repo and dependencies...")
|
61
|
+
update_dependencies
|
62
|
+
main_changed = update_main
|
63
|
+
end
|
64
|
+
|
65
|
+
show_diff(".") if main_changed && Console.ask("Show diff?")
|
66
|
+
end
|
67
|
+
|
68
|
+
def update_dependencies
|
69
|
+
any_changed = false
|
70
|
+
Performer.dependencies.each do |dependency|
|
71
|
+
path = dependency.config_entry.path
|
72
|
+
name = dependency.config_entry.name
|
73
|
+
any_changed |= update_tracking_files(path, name) if Utils.multirepo_enabled?(path)
|
74
|
+
end
|
75
|
+
return any_changed
|
76
|
+
end
|
77
|
+
|
78
|
+
def update_main
|
79
|
+
return update_tracking_files(".", "main repo")
|
80
|
+
end
|
81
|
+
|
82
|
+
def update_tracking_files(path, name)
|
83
|
+
Console.log_substep("Updating tracking files in #{name}")
|
84
|
+
|
85
|
+
tracking_files = TrackingFiles.new(path)
|
86
|
+
changed = tracking_files.update
|
87
|
+
|
88
|
+
if changed
|
89
|
+
Console.log_info("Updated tracking files")
|
90
|
+
else
|
91
|
+
Console.log_info("Tracking files are already up-to-date")
|
92
|
+
end
|
93
|
+
|
94
|
+
if @commit
|
95
|
+
committed = tracking_files.commit("[multirepo] Updated tracking files manually")
|
96
|
+
Console.log_info("Committed tracking files") if committed
|
97
|
+
end
|
98
|
+
|
99
|
+
return changed
|
100
|
+
end
|
101
|
+
|
102
|
+
def show_diff(path)
|
103
|
+
GitRunner.run_as_system(path, "diff .multirepo.lock")
|
104
|
+
end
|
105
|
+
end
|
106
|
+
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
|
16
|
-
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
|
+
end
|