git-multirepo 1.0.0.beta42 → 1.0.0.beta43
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/Gemfile +4 -4
- data/Gemfile.lock +42 -42
- data/LICENSE +22 -22
- data/README.md +143 -143
- data/Rakefile +2 -2
- data/bin/multi +10 -10
- data/docs/bug-repros/91565510-repro.sh +20 -20
- data/git-multirepo.gemspec +31 -31
- data/lib/commands.rb +13 -13
- data/lib/git-multirepo.rb +2 -2
- data/lib/info.rb +4 -4
- data/lib/multirepo/commands/add-command.rb +50 -50
- data/lib/multirepo/commands/branch-command.rb +81 -81
- data/lib/multirepo/commands/checkout-command.rb +119 -119
- data/lib/multirepo/commands/clone-command.rb +67 -67
- data/lib/multirepo/commands/command.rb +89 -89
- data/lib/multirepo/commands/do-command.rb +100 -100
- data/lib/multirepo/commands/graph-command.rb +42 -42
- data/lib/multirepo/commands/init-command.rb +119 -119
- data/lib/multirepo/commands/install-command.rb +106 -106
- data/lib/multirepo/commands/merge-command.rb +225 -225
- data/lib/multirepo/commands/open-command.rb +55 -55
- data/lib/multirepo/commands/remove-command.rb +47 -47
- data/lib/multirepo/commands/uninit-command.rb +17 -17
- data/lib/multirepo/commands/update-command.rb +55 -55
- 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 -28
- data/lib/multirepo/files/lock-file.rb +55 -55
- 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 -31
- data/lib/multirepo/git/change.rb +10 -10
- data/lib/multirepo/git/commit.rb +6 -6
- data/lib/multirepo/git/git-runner.rb +46 -46
- data/lib/multirepo/git/git.rb +9 -9
- data/lib/multirepo/git/ref.rb +37 -37
- data/lib/multirepo/git/remote.rb +16 -16
- data/lib/multirepo/git/repo.rb +122 -122
- data/lib/multirepo/hooks/post-commit-hook.rb +22 -22
- data/lib/multirepo/hooks/pre-commit-hook.rb +34 -34
- data/lib/multirepo/logic/dependency.rb +5 -5
- data/lib/multirepo/logic/merge-descriptor.rb +94 -94
- data/lib/multirepo/logic/node.rb +71 -71
- data/lib/multirepo/logic/performer.rb +56 -56
- 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 -94
- 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 +2 -2
data/Rakefile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
|
data/bin/multi
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "claide"
|
4
|
-
require "commands"
|
5
|
-
|
6
|
-
trap("INT") do
|
7
|
-
puts "\rAbort, abort!!" # \r hides the interrupt control characters
|
8
|
-
exit
|
9
|
-
end
|
10
|
-
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "claide"
|
4
|
+
require "commands"
|
5
|
+
|
6
|
+
trap("INT") do
|
7
|
+
puts "\rAbort, abort!!" # \r hides the interrupt control characters
|
8
|
+
exit
|
9
|
+
end
|
10
|
+
|
11
11
|
MultiRepo::Command.run(ARGV)
|
@@ -1,21 +1,21 @@
|
|
1
|
-
echo "----> Setup a new test repo"
|
2
|
-
dir_name="PreCommitHookAddTest"
|
3
|
-
rm -rf $dir_name; mkdir $dir_name; cd $dir_name
|
4
|
-
git init; git commit --allow-empty -m "Initial commit"
|
5
|
-
|
6
|
-
echo "----> Add a pre-commit hook that stages a file that doesn't currently exist in the repo"
|
7
|
-
echo "touch auto-added; git add auto-added" > .git/hooks/pre-commit
|
8
|
-
chmod +x .git/hooks/pre-commit
|
9
|
-
|
10
|
-
echo "----> Try committing a new file using the '-o' flag"
|
11
|
-
touch manually-added; git add manually-added
|
12
|
-
git commit -o -m "Commit that ran the pre-commit hook and should contain file 'auto-added'" -- manually-added
|
13
|
-
|
14
|
-
echo "----> Results (expected: working copy clean; actual: auto-added is reported as both DELETED and UNTRACKED. HEAD and working copy are the same, staging area contains ‘incorrect' state)"
|
15
|
-
git status
|
16
|
-
|
17
|
-
echo "----> Stage the file after the fact"
|
18
|
-
git add auto-added
|
19
|
-
|
20
|
-
echo "----> Notice that the working copy is now clean"
|
1
|
+
echo "----> Setup a new test repo"
|
2
|
+
dir_name="PreCommitHookAddTest"
|
3
|
+
rm -rf $dir_name; mkdir $dir_name; cd $dir_name
|
4
|
+
git init; git commit --allow-empty -m "Initial commit"
|
5
|
+
|
6
|
+
echo "----> Add a pre-commit hook that stages a file that doesn't currently exist in the repo"
|
7
|
+
echo "touch auto-added; git add auto-added" > .git/hooks/pre-commit
|
8
|
+
chmod +x .git/hooks/pre-commit
|
9
|
+
|
10
|
+
echo "----> Try committing a new file using the '-o' flag"
|
11
|
+
touch manually-added; git add manually-added
|
12
|
+
git commit -o -m "Commit that ran the pre-commit hook and should contain file 'auto-added'" -- manually-added
|
13
|
+
|
14
|
+
echo "----> Results (expected: working copy clean; actual: auto-added is reported as both DELETED and UNTRACKED. HEAD and working copy are the same, staging area contains ‘incorrect' state)"
|
15
|
+
git status
|
16
|
+
|
17
|
+
echo "----> Stage the file after the fact"
|
18
|
+
git add auto-added
|
19
|
+
|
20
|
+
echo "----> Notice that the working copy is now clean"
|
21
21
|
git status
|
data/git-multirepo.gemspec
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'info'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = MultiRepo::NAME
|
8
|
-
spec.version = MultiRepo::VERSION
|
9
|
-
spec.authors = ["Michaël Fortin"]
|
10
|
-
spec.email = ["fortinmike@irradiated.net"]
|
11
|
-
spec.summary = %q{Track multiple Git repositories side-by-side}
|
12
|
-
spec.description = MultiRepo::DESCRIPTION
|
13
|
-
spec.homepage = "https://github.com/fortinmike/git-multirepo"
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
spec.required_ruby_version = '~> 2.0'
|
17
|
-
spec.files = `git ls-files -z`.split("\x0")
|
18
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
-
spec.require_paths = ["lib"]
|
21
|
-
|
22
|
-
spec.add_development_dependency "bundler", "~> 1.7"
|
23
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
-
spec.add_development_dependency "rspec", "~> 3.1.0"
|
25
|
-
|
26
|
-
spec.add_runtime_dependency "claide", "~> 0.8", ">= 0.8.0"
|
27
|
-
spec.add_runtime_dependency "colored", "~> 1.2"
|
28
|
-
spec.add_runtime_dependency "os", "~> 0.9.6"
|
29
|
-
spec.add_runtime_dependency "terminal-table", "~> 1.4.5"
|
30
|
-
spec.add_runtime_dependency "ruby-graphviz", "~> 1.2.1"
|
31
|
-
end
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'info'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = MultiRepo::NAME
|
8
|
+
spec.version = MultiRepo::VERSION
|
9
|
+
spec.authors = ["Michaël Fortin"]
|
10
|
+
spec.email = ["fortinmike@irradiated.net"]
|
11
|
+
spec.summary = %q{Track multiple Git repositories side-by-side}
|
12
|
+
spec.description = MultiRepo::DESCRIPTION
|
13
|
+
spec.homepage = "https://github.com/fortinmike/git-multirepo"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.required_ruby_version = '~> 2.0'
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "rspec", "~> 3.1.0"
|
25
|
+
|
26
|
+
spec.add_runtime_dependency "claide", "~> 0.8", ">= 0.8.0"
|
27
|
+
spec.add_runtime_dependency "colored", "~> 1.2"
|
28
|
+
spec.add_runtime_dependency "os", "~> 0.9.6"
|
29
|
+
spec.add_runtime_dependency "terminal-table", "~> 1.4.5"
|
30
|
+
spec.add_runtime_dependency "ruby-graphviz", "~> 1.2.1"
|
31
|
+
end
|
data/lib/commands.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
require_relative "multirepo/commands/command"
|
2
|
-
require_relative "multirepo/commands/add-command"
|
3
|
-
require_relative "multirepo/commands/branch-command"
|
4
|
-
require_relative "multirepo/commands/checkout-command"
|
5
|
-
require_relative "multirepo/commands/clone-command"
|
6
|
-
require_relative "multirepo/commands/do-command"
|
7
|
-
require_relative "multirepo/commands/graph-command"
|
8
|
-
require_relative "multirepo/commands/init-command"
|
9
|
-
require_relative "multirepo/commands/install-command"
|
10
|
-
require_relative "multirepo/commands/merge-command"
|
11
|
-
require_relative "multirepo/commands/open-command"
|
12
|
-
require_relative "multirepo/commands/remove-command"
|
13
|
-
require_relative "multirepo/commands/uninit-command"
|
1
|
+
require_relative "multirepo/commands/command"
|
2
|
+
require_relative "multirepo/commands/add-command"
|
3
|
+
require_relative "multirepo/commands/branch-command"
|
4
|
+
require_relative "multirepo/commands/checkout-command"
|
5
|
+
require_relative "multirepo/commands/clone-command"
|
6
|
+
require_relative "multirepo/commands/do-command"
|
7
|
+
require_relative "multirepo/commands/graph-command"
|
8
|
+
require_relative "multirepo/commands/init-command"
|
9
|
+
require_relative "multirepo/commands/install-command"
|
10
|
+
require_relative "multirepo/commands/merge-command"
|
11
|
+
require_relative "multirepo/commands/open-command"
|
12
|
+
require_relative "multirepo/commands/remove-command"
|
13
|
+
require_relative "multirepo/commands/uninit-command"
|
14
14
|
require_relative "multirepo/commands/update-command"
|
data/lib/git-multirepo.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
require "multirepo/utility/console"
|
2
|
-
require "multirepo/hooks/pre-commit-hook"
|
1
|
+
require "multirepo/utility/console"
|
2
|
+
require "multirepo/hooks/pre-commit-hook"
|
3
3
|
require "multirepo/hooks/post-commit-hook"
|
data/lib/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."
|
1
|
+
module MultiRepo
|
2
|
+
NAME = "git-multirepo"
|
3
|
+
VERSION = "1.0.0.beta43"
|
4
|
+
DESCRIPTION = "Track multiple Git repositories side-by-side."
|
5
5
|
end
|
@@ -1,51 +1,51 @@
|
|
1
|
-
require "multirepo/utility/console"
|
2
|
-
require "multirepo/files/config-file"
|
3
|
-
|
4
|
-
module MultiRepo
|
5
|
-
class AddCommand < Command
|
6
|
-
self.command = "add"
|
7
|
-
self.summary = "Track an additional dependency with multirepo."
|
8
|
-
|
9
|
-
def self.options
|
10
|
-
[['<path>', 'The relative path to the new dependency (e.g. ../MyNewDependency)']].concat(super)
|
11
|
-
end
|
12
|
-
|
13
|
-
def initialize(argv)
|
14
|
-
@path = argv.shift_argument
|
15
|
-
super
|
16
|
-
end
|
17
|
-
|
18
|
-
def validate!
|
19
|
-
super
|
20
|
-
help! "You must specify a repository to add as a dependency" unless @path
|
21
|
-
end
|
22
|
-
|
23
|
-
def run
|
24
|
-
ensure_in_work_tree
|
25
|
-
ensure_multirepo_enabled
|
26
|
-
ensure_repo_valid
|
27
|
-
|
28
|
-
config_file = ConfigFile.new(".")
|
29
|
-
entry = ConfigEntry.new(Repo.new(@path))
|
30
|
-
|
31
|
-
if config_file.entry_exists?(entry)
|
32
|
-
Console.log_info("There is already an entry for '#{@path}' in the .multirepo file")
|
33
|
-
else
|
34
|
-
config_file.add_entry(entry)
|
35
|
-
Console.log_step("Added '#{@path}' to the .multirepo file")
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def ensure_repo_valid
|
40
|
-
raise MultiRepoException, "The provided path is not a direct sibling of the main repository" unless validate_is_sibling_repo(@path)
|
41
|
-
raise MultiRepoException, "There is no folder at path '#{@path}'" unless Dir.exists?(@path)
|
42
|
-
raise MultiRepoException, "'#{@path}' is not a repository" unless Repo.new(@path).exists?
|
43
|
-
end
|
44
|
-
|
45
|
-
def validate_is_sibling_repo(path)
|
46
|
-
parent_dir = File.expand_path("..")
|
47
|
-
path = File.expand_path("..", path)
|
48
|
-
return parent_dir == path
|
49
|
-
end
|
50
|
-
end
|
1
|
+
require "multirepo/utility/console"
|
2
|
+
require "multirepo/files/config-file"
|
3
|
+
|
4
|
+
module MultiRepo
|
5
|
+
class AddCommand < Command
|
6
|
+
self.command = "add"
|
7
|
+
self.summary = "Track an additional dependency with multirepo."
|
8
|
+
|
9
|
+
def self.options
|
10
|
+
[['<path>', 'The relative path to the new dependency (e.g. ../MyNewDependency)']].concat(super)
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize(argv)
|
14
|
+
@path = argv.shift_argument
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
def validate!
|
19
|
+
super
|
20
|
+
help! "You must specify a repository to add as a dependency" unless @path
|
21
|
+
end
|
22
|
+
|
23
|
+
def run
|
24
|
+
ensure_in_work_tree
|
25
|
+
ensure_multirepo_enabled
|
26
|
+
ensure_repo_valid
|
27
|
+
|
28
|
+
config_file = ConfigFile.new(".")
|
29
|
+
entry = ConfigEntry.new(Repo.new(@path))
|
30
|
+
|
31
|
+
if config_file.entry_exists?(entry)
|
32
|
+
Console.log_info("There is already an entry for '#{@path}' in the .multirepo file")
|
33
|
+
else
|
34
|
+
config_file.add_entry(entry)
|
35
|
+
Console.log_step("Added '#{@path}' to the .multirepo file")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def ensure_repo_valid
|
40
|
+
raise MultiRepoException, "The provided path is not a direct sibling of the main repository" unless validate_is_sibling_repo(@path)
|
41
|
+
raise MultiRepoException, "There is no folder at path '#{@path}'" unless Dir.exists?(@path)
|
42
|
+
raise MultiRepoException, "'#{@path}' is not a repository" unless Repo.new(@path).exists?
|
43
|
+
end
|
44
|
+
|
45
|
+
def validate_is_sibling_repo(path)
|
46
|
+
parent_dir = File.expand_path("..")
|
47
|
+
path = File.expand_path("..", path)
|
48
|
+
return parent_dir == path
|
49
|
+
end
|
50
|
+
end
|
51
51
|
end
|
@@ -1,82 +1,82 @@
|
|
1
|
-
require "multirepo/utility/console"
|
2
|
-
require "multirepo/git/git"
|
3
|
-
require "multirepo/files/config-file"
|
4
|
-
require "multirepo/files/tracking-files"
|
5
|
-
require "multirepo/logic/performer"
|
6
|
-
|
7
|
-
module MultiRepo
|
8
|
-
class BranchCommand < Command
|
9
|
-
self.command = "branch"
|
10
|
-
self.summary = "Create and/or checkout a new branch for all repos."
|
11
|
-
|
12
|
-
def self.options
|
13
|
-
[
|
14
|
-
['<branch name>', 'The name of the branch to create and checkout.'],
|
15
|
-
['[--force]', 'Force creating the branch even if the repos contain uncommmitted changes.'],
|
16
|
-
['[--no-push]', 'Do not push the branch on creation.']
|
17
|
-
].concat(super)
|
18
|
-
end
|
19
|
-
|
20
|
-
def initialize(argv)
|
21
|
-
@branch_name = argv.shift_argument
|
22
|
-
@force = argv.flag?("force")
|
23
|
-
@remote_tracking = argv.flag?("push", true)
|
24
|
-
super
|
25
|
-
end
|
26
|
-
|
27
|
-
def validate!
|
28
|
-
super
|
29
|
-
help! "You must specify a branch name" unless @branch_name
|
30
|
-
help! "Please provide a valid branch name" unless Git.valid_branch_name?(@branch_name)
|
31
|
-
end
|
32
|
-
|
33
|
-
def run
|
34
|
-
ensure_in_work_tree
|
35
|
-
ensure_multirepo_enabled
|
36
|
-
|
37
|
-
Console.log_step("Branching...")
|
38
|
-
|
39
|
-
main_repo = Repo.new(".")
|
40
|
-
|
41
|
-
# Ensure the main repo is clean
|
42
|
-
raise MultiRepoException, "Main repo is not clean; multi branch aborted" unless main_repo.clean?
|
43
|
-
|
44
|
-
# Ensure dependencies are clean
|
45
|
-
config_entries = ConfigFile.new(".").load_entries
|
46
|
-
unless Utils.dependencies_clean?(config_entries)
|
47
|
-
raise MultiRepoException, "Dependencies are not clean; multi branch aborted"
|
48
|
-
end
|
49
|
-
|
50
|
-
# Branch dependencies
|
51
|
-
Performer.dependencies.each do |dependency|
|
52
|
-
perform_branch(dependency.config_entry.repo)
|
53
|
-
end
|
54
|
-
|
55
|
-
# Branch the main repo
|
56
|
-
perform_branch(main_repo)
|
57
|
-
|
58
|
-
Console.log_step("Done!")
|
59
|
-
end
|
60
|
-
|
61
|
-
def perform_branch(repo)
|
62
|
-
Console.log_substep("Branching '#{repo.path}' ...")
|
63
|
-
Console.log_info("Creating and checking out branch #{@branch_name} ...")
|
64
|
-
|
65
|
-
branch = repo.branch(@branch_name)
|
66
|
-
branch.create unless branch.exists?
|
67
|
-
branch.checkout
|
68
|
-
|
69
|
-
if Utils.is_multirepo_enabled(repo.path)
|
70
|
-
Console.log_info("Updating and committing tracking files")
|
71
|
-
tracking_files = TrackingFiles.new(repo.path)
|
72
|
-
tracking_files.update
|
73
|
-
tracking_files.commit("[multirepo] Post-branch tracking files update")
|
74
|
-
end
|
75
|
-
|
76
|
-
if @remote_tracking
|
77
|
-
Console.log_info("Pushing #{@branch_name} to origin/#{@branch_name}")
|
78
|
-
repo.branch(@branch_name).push
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
1
|
+
require "multirepo/utility/console"
|
2
|
+
require "multirepo/git/git"
|
3
|
+
require "multirepo/files/config-file"
|
4
|
+
require "multirepo/files/tracking-files"
|
5
|
+
require "multirepo/logic/performer"
|
6
|
+
|
7
|
+
module MultiRepo
|
8
|
+
class BranchCommand < Command
|
9
|
+
self.command = "branch"
|
10
|
+
self.summary = "Create and/or checkout a new branch for all repos."
|
11
|
+
|
12
|
+
def self.options
|
13
|
+
[
|
14
|
+
['<branch name>', 'The name of the branch to create and checkout.'],
|
15
|
+
['[--force]', 'Force creating the branch even if the repos contain uncommmitted changes.'],
|
16
|
+
['[--no-push]', 'Do not push the branch on creation.']
|
17
|
+
].concat(super)
|
18
|
+
end
|
19
|
+
|
20
|
+
def initialize(argv)
|
21
|
+
@branch_name = argv.shift_argument
|
22
|
+
@force = argv.flag?("force")
|
23
|
+
@remote_tracking = argv.flag?("push", true)
|
24
|
+
super
|
25
|
+
end
|
26
|
+
|
27
|
+
def validate!
|
28
|
+
super
|
29
|
+
help! "You must specify a branch name" unless @branch_name
|
30
|
+
help! "Please provide a valid branch name" unless Git.valid_branch_name?(@branch_name)
|
31
|
+
end
|
32
|
+
|
33
|
+
def run
|
34
|
+
ensure_in_work_tree
|
35
|
+
ensure_multirepo_enabled
|
36
|
+
|
37
|
+
Console.log_step("Branching...")
|
38
|
+
|
39
|
+
main_repo = Repo.new(".")
|
40
|
+
|
41
|
+
# Ensure the main repo is clean
|
42
|
+
raise MultiRepoException, "Main repo is not clean; multi branch aborted" unless main_repo.clean?
|
43
|
+
|
44
|
+
# Ensure dependencies are clean
|
45
|
+
config_entries = ConfigFile.new(".").load_entries
|
46
|
+
unless Utils.dependencies_clean?(config_entries)
|
47
|
+
raise MultiRepoException, "Dependencies are not clean; multi branch aborted"
|
48
|
+
end
|
49
|
+
|
50
|
+
# Branch dependencies
|
51
|
+
Performer.dependencies.each do |dependency|
|
52
|
+
perform_branch(dependency.config_entry.repo)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Branch the main repo
|
56
|
+
perform_branch(main_repo)
|
57
|
+
|
58
|
+
Console.log_step("Done!")
|
59
|
+
end
|
60
|
+
|
61
|
+
def perform_branch(repo)
|
62
|
+
Console.log_substep("Branching '#{repo.path}' ...")
|
63
|
+
Console.log_info("Creating and checking out branch #{@branch_name} ...")
|
64
|
+
|
65
|
+
branch = repo.branch(@branch_name)
|
66
|
+
branch.create unless branch.exists?
|
67
|
+
branch.checkout
|
68
|
+
|
69
|
+
if Utils.is_multirepo_enabled(repo.path)
|
70
|
+
Console.log_info("Updating and committing tracking files")
|
71
|
+
tracking_files = TrackingFiles.new(repo.path)
|
72
|
+
tracking_files.update
|
73
|
+
tracking_files.commit("[multirepo] Post-branch tracking files update")
|
74
|
+
end
|
75
|
+
|
76
|
+
if @remote_tracking
|
77
|
+
Console.log_info("Pushing #{@branch_name} to origin/#{@branch_name}")
|
78
|
+
repo.branch(@branch_name).push
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
82
|
end
|