git-multirepo 1.0.0.beta6 → 1.0.0.beta7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f67417664ab6be98eeaa6008e1e964970a1c3cf7
4
- data.tar.gz: 5d02a6929a3817a8f7fae72836a3b7a15122045b
3
+ metadata.gz: d2127f8584295f5fa8191a05f5a60db185c66cd3
4
+ data.tar.gz: 1c20bf8d7f7cb56f1f63cec417483f3c5187f51a
5
5
  SHA512:
6
- metadata.gz: af1a7d3bff1461e9723f37af08c69caf031c66bea48d85ea8c064620ebd808095947be5b5d8108a19763806b650831d262720ad426d79aedb30a2742673a99b0
7
- data.tar.gz: 8c9f17361401306e3f0f8b4ae81c8ca2f8e88c1e09aaf805773a85d31a071bed3aa6f8c019426a8f73060017f6fc44aa999a540d4985975e37582643e638a51e
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 alpha at the moment. All of the core features work as described, though. Suggestions and contributions are welcome.
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`
@@ -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 = ["Michaël Fortin"]
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
@@ -1,11 +1,12 @@
1
1
  require_relative "multirepo/commands/command"
2
- require_relative "multirepo/commands/add"
3
- require_relative "multirepo/commands/checkout"
4
- require_relative "multirepo/commands/edit"
5
- require_relative "multirepo/commands/fetch"
6
- require_relative "multirepo/commands/init"
7
- require_relative "multirepo/commands/install"
8
- require_relative "multirepo/commands/open"
9
- require_relative "multirepo/commands/remove"
10
- require_relative "multirepo/commands/uninit"
11
- require_relative "multirepo/commands/update"
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"
@@ -1,5 +1,5 @@
1
1
  module MultiRepo
2
2
  NAME = "git-multirepo"
3
- VERSION = "1.0.0.beta6"
3
+ VERSION = "1.0.0.beta7"
4
4
  DESCRIPTION = "Track multiple Git repositories side-by-side."
5
5
  end
@@ -2,7 +2,7 @@ require "multirepo/utility/console"
2
2
  require "multirepo/files/config-file"
3
3
 
4
4
  module MultiRepo
5
- class Add < Command
5
+ class AddCommand < Command
6
6
  self.command = "add"
7
7
  self.summary = "Track an additional dependency with multirepo."
8
8
 
@@ -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 Checkout < Command
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
 
@@ -1,7 +1,7 @@
1
1
  require "os"
2
2
 
3
3
  module MultiRepo
4
- class Edit < Command
4
+ class EditCommand < Command
5
5
  self.command = "edit"
6
6
  self.summary = "Opens the .multirepo file in the default text editor."
7
7
 
@@ -1,7 +1,7 @@
1
1
  require "multirepo/utility/console"
2
2
 
3
3
  module MultiRepo
4
- class Fetch < Command
4
+ class FetchCommand < Command
5
5
  self.command = "fetch"
6
6
  self.summary = "Performs a git fetch on all dependencies."
7
7
 
@@ -5,7 +5,7 @@ require "multirepo/files/lock-file"
5
5
  require "multirepo/commands/command"
6
6
 
7
7
  module MultiRepo
8
- class Init < Command
8
+ class InitCommand < Command
9
9
  self.command = "init"
10
10
  self.summary = "Initialize the current repository as a multirepo project."
11
11
 
@@ -3,7 +3,7 @@ require "multirepo/utility/utils"
3
3
  require "multirepo/git/repo"
4
4
 
5
5
  module MultiRepo
6
- class Setup < Command
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
 
@@ -4,7 +4,7 @@ require "multirepo/utility/console"
4
4
  require "multirepo/utility/utils"
5
5
 
6
6
  module MultiRepo
7
- class Open < Command
7
+ class OpenCommand < Command
8
8
  self.command = "open"
9
9
  self.summary = "Opens all dependencies in the current OS's file explorer."
10
10
 
@@ -2,7 +2,7 @@ require "multirepo/utility/console"
2
2
  require "multirepo/files/config-file"
3
3
 
4
4
  module MultiRepo
5
- class Remove < Command
5
+ class RemoveCommand < Command
6
6
  self.command = "remove"
7
7
  self.summary = "Removes the specified dependency from multirepo."
8
8
 
@@ -1,7 +1,7 @@
1
1
  require "multirepo/utility/console"
2
2
 
3
3
  module MultiRepo
4
- class Uninit < Command
4
+ class UninitCommand < Command
5
5
  self.command = "uninit"
6
6
  self.summary = "Removes all traces of multirepo in the current multirepo repository."
7
7
 
@@ -1,7 +1,7 @@
1
1
  require "multirepo/utility/console"
2
2
 
3
3
  module MultiRepo
4
- class Update < Command
4
+ class UpdateCommand < Command
5
5
  self.command = "update"
6
6
  self.summary = "Force-updates the multirepo lock file."
7
7
 
@@ -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.beta6
4
+ version: 1.0.0.beta7
5
5
  platform: ruby
6
6
  authors:
7
- - Michaël Fortin
7
+ - Michaël Fortin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-03 00:00:00.000000000 Z
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/checkout.rb
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