git-multirepo 1.0.0.beta6 → 1.0.0.beta7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/git-multirepo.gemspec +1 -1
- data/lib/commands.rb +11 -10
- data/lib/info.rb +1 -1
- data/lib/multirepo/commands/{add.rb → add-command.rb} +1 -1
- data/lib/multirepo/commands/branch-command.rb +51 -0
- data/lib/multirepo/commands/{checkout.rb → checkout-command.rb} +1 -1
- data/lib/multirepo/commands/{edit.rb → edit-command.rb} +1 -1
- data/lib/multirepo/commands/{fetch.rb → fetch-command.rb} +1 -1
- data/lib/multirepo/commands/{init.rb → init-command.rb} +1 -1
- data/lib/multirepo/commands/{install.rb → install-command.rb} +1 -1
- data/lib/multirepo/commands/{open.rb → open-command.rb} +1 -1
- data/lib/multirepo/commands/{remove.rb → remove-command.rb} +1 -1
- data/lib/multirepo/commands/{uninit.rb → uninit-command.rb} +1 -1
- data/lib/multirepo/commands/{update.rb → update-command.rb} +1 -1
- data/lib/multirepo/git/branch.rb +11 -0
- metadata +14 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2127f8584295f5fa8191a05f5a60db185c66cd3
|
4
|
+
data.tar.gz: 1c20bf8d7f7cb56f1f63cec417483f3c5187f51a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd00c15d670129ee71c31fc85e2505ddcd803110714d5497baccfdb027e852e46d53b1249cacb40c339dce2e2569396894209fa0bedbc5b7f36b57c5ad6b77d7
|
7
|
+
data.tar.gz: 451904537126a065e54b4bad41c80b419992ae2ae6bccc6d75dba6b70bf4ac75d718c666817f960a674b157bc37545e7d5ec1d54dc94669b9bf2ea07d5e786e5
|
data/README.md
CHANGED
@@ -102,7 +102,7 @@ If you want to stop using git-multirepo, run `multi uninit`. This will remove al
|
|
102
102
|
|
103
103
|
## Limitations
|
104
104
|
|
105
|
-
- git-multirepo should be considered
|
105
|
+
- git-multirepo should be considered beta at the moment. All of the core features work as described, though. Suggestions and contributions are welcome.
|
106
106
|
- The project and its dependencies must live beside each other on disk (for now).
|
107
107
|
- There are currently no features to facilitate branch-heavy workflows.
|
108
108
|
- You must (ideally) install the tool on your CI server: `gem install git-multirepo`
|
data/git-multirepo.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'info'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = MultiRepo::NAME
|
8
8
|
spec.version = MultiRepo::VERSION
|
9
|
-
spec.authors = ["
|
9
|
+
spec.authors = ["Michaël Fortin"]
|
10
10
|
spec.email = ["fortinmike@irradiated.net"]
|
11
11
|
spec.summary = %q{Track multiple Git repositories side-by-side}
|
12
12
|
spec.description = MultiRepo::DESCRIPTION
|
data/lib/commands.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
require_relative "multirepo/commands/command"
|
2
|
-
require_relative "multirepo/commands/add"
|
3
|
-
require_relative "multirepo/commands/
|
4
|
-
require_relative "multirepo/commands/
|
5
|
-
require_relative "multirepo/commands/
|
6
|
-
require_relative "multirepo/commands/
|
7
|
-
require_relative "multirepo/commands/
|
8
|
-
require_relative "multirepo/commands/
|
9
|
-
require_relative "multirepo/commands/
|
10
|
-
require_relative "multirepo/commands/
|
11
|
-
require_relative "multirepo/commands/
|
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/edit-command"
|
6
|
+
require_relative "multirepo/commands/fetch-command"
|
7
|
+
require_relative "multirepo/commands/init-command"
|
8
|
+
require_relative "multirepo/commands/install-command"
|
9
|
+
require_relative "multirepo/commands/open-command"
|
10
|
+
require_relative "multirepo/commands/remove-command"
|
11
|
+
require_relative "multirepo/commands/uninit-command"
|
12
|
+
require_relative "multirepo/commands/update-command"
|
data/lib/info.rb
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
require "multirepo/utility/console"
|
2
|
+
require "multirepo/files/config-file"
|
3
|
+
|
4
|
+
module MultiRepo
|
5
|
+
class BranchCommand < Command
|
6
|
+
self.command = "branch"
|
7
|
+
self.summary = "Create and/or checkout a new branch for each dependency."
|
8
|
+
|
9
|
+
def initialize(argv)
|
10
|
+
@branch_name = argv.shift_argument
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
def validate!
|
15
|
+
super
|
16
|
+
help! "You must specify a branch name" unless @branch_name
|
17
|
+
end
|
18
|
+
|
19
|
+
def run
|
20
|
+
super
|
21
|
+
ensure_multirepo_initialized
|
22
|
+
|
23
|
+
Console.log_step("Branching (\"#{@branch_name}\")...")
|
24
|
+
|
25
|
+
main_repo = main_repo = Repo.new(".")
|
26
|
+
repos = ConfigFile.load.map{ |entry| entry.repo }.push(main_repo)
|
27
|
+
|
28
|
+
unless ensure_working_copies_clean(repos)
|
29
|
+
raise MultiRepoException, "Can't branch because not all repos are clean"
|
30
|
+
end
|
31
|
+
|
32
|
+
repos.each do |repo|
|
33
|
+
branch = repo.branch(@branch_name)
|
34
|
+
branch.create unless branch.exists?
|
35
|
+
branch.checkout
|
36
|
+
end
|
37
|
+
|
38
|
+
Console.log_step("Done!")
|
39
|
+
rescue MultiRepoException => e
|
40
|
+
Console.log_error(e.message)
|
41
|
+
end
|
42
|
+
|
43
|
+
def ensure_working_copies_clean(repos)
|
44
|
+
repos.all? do |repo|
|
45
|
+
clean = repo.is_clean?
|
46
|
+
Console.log_warning("Repo #{entry.path} has uncommitted changes") unless clean
|
47
|
+
return clean
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "multirepo/utility/console"
|
2
2
|
|
3
3
|
module MultiRepo
|
4
|
-
class
|
4
|
+
class CheckoutCommand < Command
|
5
5
|
self.command = "checkout"
|
6
6
|
self.summary = "Checks out the specified commit or branch of the main repo and checks out matching versions of all dependencies."
|
7
7
|
|
@@ -3,7 +3,7 @@ require "multirepo/utility/utils"
|
|
3
3
|
require "multirepo/git/repo"
|
4
4
|
|
5
5
|
module MultiRepo
|
6
|
-
class
|
6
|
+
class InstallCommand < Command
|
7
7
|
self.command = "install"
|
8
8
|
self.summary = "Clones and checks out dependencies as defined in the .multirepo file, and installs git-multirepo's local pre-commit hook."
|
9
9
|
|
data/lib/multirepo/git/branch.rb
CHANGED
@@ -8,6 +8,17 @@ module MultiRepo
|
|
8
8
|
@repo = repo
|
9
9
|
@name = name
|
10
10
|
end
|
11
|
+
|
12
|
+
def exists?
|
13
|
+
lines = Git.run_in_working_dir(@repo.path, "branch", false).split("\n")
|
14
|
+
branch_names = lines.map { |line| line.tr("* ", "")}
|
15
|
+
branch_names.include?(@name)
|
16
|
+
end
|
17
|
+
|
18
|
+
def create(remote_tracking = false)
|
19
|
+
Git.run_in_working_dir(@repo.path, "branch #{@name}", false)
|
20
|
+
Git.run_in_working_dir(@repo.path, "push -u origin #{name}", false) if remote_tracking
|
21
|
+
end
|
11
22
|
|
12
23
|
def checkout
|
13
24
|
Git.run_in_working_dir(@repo.path, "checkout #{@name}", false)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-multirepo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.beta7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Michaël Fortin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -123,17 +123,18 @@ files:
|
|
123
123
|
- lib/commands.rb
|
124
124
|
- lib/git-multirepo.rb
|
125
125
|
- lib/info.rb
|
126
|
-
- lib/multirepo/commands/add.rb
|
127
|
-
- lib/multirepo/commands/
|
126
|
+
- lib/multirepo/commands/add-command.rb
|
127
|
+
- lib/multirepo/commands/branch-command.rb
|
128
|
+
- lib/multirepo/commands/checkout-command.rb
|
128
129
|
- lib/multirepo/commands/command.rb
|
129
|
-
- lib/multirepo/commands/edit.rb
|
130
|
-
- lib/multirepo/commands/fetch.rb
|
131
|
-
- lib/multirepo/commands/init.rb
|
132
|
-
- lib/multirepo/commands/install.rb
|
133
|
-
- lib/multirepo/commands/open.rb
|
134
|
-
- lib/multirepo/commands/remove.rb
|
135
|
-
- lib/multirepo/commands/uninit.rb
|
136
|
-
- lib/multirepo/commands/update.rb
|
130
|
+
- lib/multirepo/commands/edit-command.rb
|
131
|
+
- lib/multirepo/commands/fetch-command.rb
|
132
|
+
- lib/multirepo/commands/init-command.rb
|
133
|
+
- lib/multirepo/commands/install-command.rb
|
134
|
+
- lib/multirepo/commands/open-command.rb
|
135
|
+
- lib/multirepo/commands/remove-command.rb
|
136
|
+
- lib/multirepo/commands/uninit-command.rb
|
137
|
+
- lib/multirepo/commands/update-command.rb
|
137
138
|
- lib/multirepo/config.rb
|
138
139
|
- lib/multirepo/files/config-entry.rb
|
139
140
|
- lib/multirepo/files/config-file.rb
|