git-multirepo 1.0.0.beta18 → 1.0.0.beta19

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: d88cc72e2ecea7331cc379e0d48f771302960e0c
4
- data.tar.gz: 3778236c3c5e1cfe17ba4c16b5e26d3fd54186ab
3
+ metadata.gz: 0f47b8911b32d25d5daa1fe087296860ff278b04
4
+ data.tar.gz: 2a9aea7aadbfa5e2ba7ebd20f41048eae806180a
5
5
  SHA512:
6
- metadata.gz: 7bdbdeff71220ce72b005dc66ac91cd45e0afddf227c0732b84e102d587192a29db3522b97eff8a988b53761b7b301664aeacfd3a5e0af9ec217fb183b4dde2f
7
- data.tar.gz: e9f0f748cbd0d2385fee936886eb759f09f5e17898af4510920e51930b7dac92fdb1975dbc148207a73eadd4c401634cd7870f036cf695b7a98131323a99ca40
6
+ metadata.gz: dc2f4849e897410cda0164e1d3e14dbaf1c821a3777f599e6569c24e43492a1dca53f6260ea5623d64a8f1b561b868db940d17b26650b51eb4b7a16cb244f692
7
+ data.tar.gz: b8d457f08acceb627267ac30d6c33efa454989457d7e69d337735016a1619d050684c2dc448afe367a5dfee13083b41a147bbafd2fb9c01272f30b1b6faf4a6d
data/README.md CHANGED
@@ -1,5 +1,3 @@
1
- ![git-multirepo](images/logo.png)
2
-
3
1
  # git-multirepo
4
2
 
5
3
  [![Gem Version](https://badge.fury.io/rb/git-multirepo.svg)](http://badge.fury.io/rb/git-multirepo)
data/lib/info.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module MultiRepo
2
2
  NAME = "git-multirepo"
3
- VERSION = "1.0.0.beta18"
3
+ VERSION = "1.0.0.beta19"
4
4
  DESCRIPTION = "Track multiple Git repositories side-by-side."
5
5
  end
@@ -85,7 +85,7 @@ module MultiRepo
85
85
  # First, make sure the repo exists on disk, and clone it if it doesn't
86
86
  # (in case the checked-out revision had an additional dependency)
87
87
  unless config_entry.repo.exists?
88
- Console.log_substep("Cloning missing dependency #{config_entry.path} from #{config_entry.url}")
88
+ Console.log_substep("Cloning missing dependency '#{config_entry.path}' from #{config_entry.url}")
89
89
  config_entry.repo.clone(config_entry.url)
90
90
  end
91
91
 
@@ -39,7 +39,7 @@ module MultiRepo
39
39
  FileUtils.mkpath(main_repo_path)
40
40
 
41
41
  main_repo = Repo.new(main_repo_path)
42
- main_repo.clone(@url)
42
+ raise MultiRepoException, "Could not clone repo from #{@url}" unless main_repo.clone(@url)
43
43
 
44
44
  original_path = Dir.pwd
45
45
  Dir.chdir(main_repo_path)
@@ -20,14 +20,25 @@ module MultiRepo
20
20
  raise MultiRepoException, "Not a git repository" unless Git.is_inside_git_repo(".")
21
21
  end
22
22
 
23
- def install_hooks
24
- Utils.install_hook("pre-commit")
25
- Utils.install_hook("post-merge")
26
- Console.log_substep("Installed git hooks")
23
+ def install_hooks_in_multirepo_enabled_dependencies
24
+ # Install the local git hooks in dependency repos
25
+ # if they are themselves tracked with multirepo
26
+ ConfigFile.load.each do |entry|
27
+ if Utils.is_multirepo_enabled(entry.repo.path)
28
+ install_hooks(entry.repo.path)
29
+ Console.log_substep("Installed hooks in multirepo-enabled dependency '#{entry.repo.path}'")
30
+ end
31
+ end
32
+ end
33
+
34
+ def install_hooks(path = nil)
35
+ actual_path = path || "."
36
+ Utils.install_hook("pre-commit", actual_path)
37
+ Utils.install_hook("post-merge", actual_path)
27
38
  end
28
39
 
29
40
  def ensure_multirepo_initialized
30
- raise MultiRepoException, "multirepo is not initialized in this repository." unless ConfigFile.exists?
41
+ raise MultiRepoException, "multirepo is not initialized in this repository." unless Utils.is_multirepo_enabled(".")
31
42
  end
32
43
  end
33
44
  end
@@ -22,7 +22,9 @@ module MultiRepo
22
22
  if sibling_repos.any?
23
23
  entries = []
24
24
  sibling_repos.each do |repo|
25
- if Console.ask_yes_no("Do you want to add '#{repo.path}' (#{repo.remote('origin').url} #{repo.current_branch}) as a dependency?")
25
+ origin_desc = repo.remote('origin').url || "[none]"
26
+ current_branch = repo.current_branch
27
+ if Console.ask_yes_no("Do you want to add '#{repo.path}' as a dependency?\n [origin: '#{origin_desc}', branch: #{current_branch}]")
26
28
  entries.push(ConfigEntry.new(repo))
27
29
  Console.log_substep("Added the repository '#{repo.path}' to the .multirepo file")
28
30
  end
@@ -30,16 +32,12 @@ module MultiRepo
30
32
 
31
33
  ConfigFile.save(entries)
32
34
  ConfigFile.stage
33
-
34
- dependencies_clean = Utils.ensure_dependencies_clean(entries)
35
- raise MultiRepoException, "Can't finish initialization!" unless dependencies_clean
36
-
37
- LockFile.update
38
35
  else
39
36
  Console.log_info("There are no sibling repositories to add")
40
37
  end
41
38
 
42
39
  install_hooks
40
+ Console.log_substep("Installed git hooks")
43
41
 
44
42
  Console.log_step("Done!")
45
43
  rescue MultiRepoException => e
@@ -35,14 +35,17 @@ module MultiRepo
35
35
 
36
36
  Console.log_substep("Installing #{config_entries.count} dependencies...");
37
37
 
38
- # Clone or fetch configured repos
39
- config_entries.each { |e| clone_or_fetch(e) }
38
+ # Clone or fetch all configured dependencies
39
+ config_entries.each { |entry| clone_or_fetch(entry) }
40
40
 
41
- # Checkout the repos as specified in the lock file
41
+ # Checkout the appropriate branches as specified in the lock file
42
42
  checkout_command = CheckoutCommand.new(CLAide::ARGV.new([]))
43
43
  checkout_command.checkout_core(ref || "master", CheckoutCommand::CheckoutMode::LATEST)
44
44
 
45
45
  install_hooks
46
+ Console.log_substep("Installed git hooks in main repo")
47
+
48
+ install_hooks_in_multirepo_enabled_dependencies
46
49
  end
47
50
 
48
51
  def clone_or_fetch(entry)
@@ -62,7 +65,7 @@ module MultiRepo
62
65
  end
63
66
 
64
67
  def clone_repo(entry)
65
- Console.log_substep("Cloning '#{entry.url} to #{entry.repo.path}'")
68
+ Console.log_substep("Cloning #{entry.url} into '#{entry.repo.path}'")
66
69
  raise MultiRepoException, "Could not clone remote #{entry.url}" unless entry.repo.clone(entry.url)
67
70
  end
68
71
 
@@ -24,8 +24,12 @@ module MultiRepo
24
24
 
25
25
  Console.log_step("Updating...")
26
26
 
27
- dependencies_clean = Utils.ensure_dependencies_clean(ConfigFile.load)
27
+ install_hooks
28
+ Console.log_substep("Installed git hooks in main repo")
29
+
30
+ install_hooks_in_multirepo_enabled_dependencies
28
31
 
32
+ dependencies_clean = Utils.ensure_dependencies_clean(ConfigFile.load)
29
33
  if dependencies_clean
30
34
  LockFile.update
31
35
  Console.log_substep("Updated lock file with latest dependency commits")
@@ -36,8 +40,6 @@ module MultiRepo
36
40
  raise MultiRepoException, "Can't update because not all dependencies are clean"
37
41
  end
38
42
 
39
- install_hooks
40
-
41
43
  if @commit
42
44
  Console.log_substep("Committing updated lock file")
43
45
  LockFile.commit
@@ -7,10 +7,10 @@ module MultiRepo
7
7
  Config.instance.running_git_hook = true
8
8
 
9
9
  LockFile.update
10
- Console.log_info("Updated the lock file with current HEAD revisions for all dependencies")
10
+ Console.log_info("multirepo: Updated the lock file with current HEAD revisions for all dependencies")
11
11
 
12
12
  LockFile.commit("Automatic post-merge multirepo lock file update")
13
- Console.log_info("Committed the updated lock file")
13
+ Console.log_info("multirepo: Committed the updated lock file")
14
14
 
15
15
  exit 0 # Success!
16
16
  end
@@ -11,12 +11,12 @@ module MultiRepo
11
11
  dependencies_clean = Utils.ensure_dependencies_clean(ConfigFile.load)
12
12
 
13
13
  if !dependencies_clean
14
- Console.log_error("You must commit changes to your dependencies before you can commit the main repo")
14
+ Console.log_error("multirepo: You must commit changes to your dependencies before you can commit the main repo")
15
15
  exit 1
16
16
  end
17
17
 
18
18
  LockFile.update
19
- Console.log_info("Updated and staged lock file with current HEAD revisions for all dependencies")
19
+ Console.log_info("multirepo: Updated and staged lock file with current HEAD revisions for all dependencies")
20
20
 
21
21
  exit 0 # Success!
22
22
  end
@@ -7,8 +7,12 @@ module MultiRepo
7
7
  File.join(gem_path, "resources/#{resource_name}")
8
8
  end
9
9
 
10
- def self.install_hook(name)
11
- FileUtils.cp(path_for_resource(name), ".git/hooks")
10
+ def self.is_multirepo_enabled(path)
11
+ File.exists?(File.join(path, ".multirepo"))
12
+ end
13
+
14
+ def self.install_hook(name, path)
15
+ FileUtils.cp(path_for_resource(name), File.join(path, ".git/hooks"))
12
16
  end
13
17
 
14
18
  def self.sibling_repos
@@ -19,18 +23,19 @@ module MultiRepo
19
23
 
20
24
  def self.ensure_dependencies_clean(config_entries)
21
25
  config_entries.all? do |e|
22
- return true unless e.repo.exists?
26
+ next true unless e.repo.exists?
23
27
  clean = e.repo.is_clean?
28
+ Console.log_info("Dependency '#{e.repo.path}' is clean") if clean
24
29
  Console.log_warning("Dependency '#{e.repo.path}' contains uncommitted changes") unless clean
25
- return clean
30
+ next clean
26
31
  end
27
32
  end
28
33
 
29
34
  def self.ensure_working_copies_clean(repos)
30
35
  repos.all? do |repo|
31
36
  clean = repo.is_clean?
32
- Console.log_warning("Repo #{repo.path} contains uncommitted changes") unless clean
33
- return clean
37
+ Console.log_warning("Repo '#{repo.path}' contains uncommitted changes") unless clean
38
+ next clean
34
39
  end
35
40
  end
36
41
 
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.beta18
4
+ version: 1.0.0.beta19
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-31 00:00:00.000000000 Z
11
+ date: 2015-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -119,7 +119,6 @@ files:
119
119
  - Rakefile
120
120
  - bin/multi
121
121
  - git-multirepo.gemspec
122
- - images/logo.png
123
122
  - lib/commands.rb
124
123
  - lib/git-multirepo.rb
125
124
  - lib/info.rb
data/images/logo.png DELETED
Binary file