git-multirepo 1.0.0.beta59 → 1.0.0.beta60
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/.rspec +2 -2
- data/.rubocop.yml +79 -79
- data/CHANGELOG.md +71 -65
- data/Gemfile +4 -4
- data/Gemfile.lock +47 -42
- data/LICENSE +22 -22
- data/README.md +179 -179
- data/Rakefile +1 -1
- data/bin/multi +11 -11
- data/docs/bug-repros/91565510-repro.sh +20 -20
- data/git-multirepo.gemspec +32 -31
- data/lib/git-multirepo.rb +3 -3
- data/lib/multirepo/commands/add-command.rb +51 -51
- data/lib/multirepo/commands/branch-command.rb +88 -82
- data/lib/multirepo/commands/checkout-command.rb +127 -127
- data/lib/multirepo/commands/clone-command.rb +68 -68
- data/lib/multirepo/commands/command.rb +87 -87
- data/lib/multirepo/commands/commands.rb +15 -15
- data/lib/multirepo/commands/do-command.rb +101 -101
- 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 +48 -48
- data/lib/multirepo/commands/install-command.rb +170 -170
- data/lib/multirepo/commands/merge-command.rb +249 -249
- data/lib/multirepo/commands/open-command.rb +55 -55
- 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 +112 -112
- data/lib/multirepo/config.rb +19 -19
- data/lib/multirepo/files/config-entry.rb +39 -39
- data/lib/multirepo/files/config-file.rb +48 -46
- data/lib/multirepo/files/lock-entry.rb +29 -29
- data/lib/multirepo/files/lock-file.rb +58 -56
- data/lib/multirepo/files/meta-file.rb +47 -41
- data/lib/multirepo/files/tracking-file.rb +9 -9
- data/lib/multirepo/files/tracking-files.rb +65 -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 +129 -129
- data/lib/multirepo/hooks/post-commit-hook.rb +23 -23
- data/lib/multirepo/hooks/pre-commit-hook.rb +35 -35
- data/lib/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/repo-selection.rb +25 -25
- data/lib/multirepo/logic/revision-selection.rb +15 -15
- data/lib/multirepo/logic/revision-selector.rb +23 -23
- data/lib/multirepo/logic/version-comparer.rb +10 -0
- data/lib/multirepo/multirepo-exception.rb +6 -6
- data/lib/multirepo/output/extra-output.rb +12 -12
- data/lib/multirepo/output/teamcity-extra-output.rb +11 -11
- 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 +99 -99
- 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 +18 -6
- data/.multirepo.meta +0 -2
| @@ -1,52 +1,52 @@ | |
| 1 | 
            -
            require "colored"
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module MultiRepo
         | 
| 4 | 
            -
              class Console
         | 
| 5 | 
            -
                def self.log_step(message)
         | 
| 6 | 
            -
                  print_prefix
         | 
| 7 | 
            -
                  puts $stdout.isatty ? message.bold.green : message
         | 
| 8 | 
            -
                end
         | 
| 9 | 
            -
                
         | 
| 10 | 
            -
                def self.log_substep(message)
         | 
| 11 | 
            -
                  print_prefix
         | 
| 12 | 
            -
                  puts $stdout.isatty ? message.blue : message
         | 
| 13 | 
            -
                end
         | 
| 14 | 
            -
                
         | 
| 15 | 
            -
                def self.log_info(message)
         | 
| 16 | 
            -
                  print_prefix
         | 
| 17 | 
            -
                  puts $stdout.isatty ? message.white : message
         | 
| 18 | 
            -
                end
         | 
| 19 | 
            -
                
         | 
| 20 | 
            -
                def self.log_warning(message)
         | 
| 21 | 
            -
                  print_prefix
         | 
| 22 | 
            -
                  puts $stdout.isatty ? message.yellow : message
         | 
| 23 | 
            -
                end
         | 
| 24 | 
            -
                
         | 
| 25 | 
            -
                def self.log_error(message)
         | 
| 26 | 
            -
                  print_prefix
         | 
| 27 | 
            -
                  puts $stdout.isatty ? message.red : message
         | 
| 28 | 
            -
                end
         | 
| 29 | 
            -
                
         | 
| 30 | 
            -
                def self.ask(message)
         | 
| 31 | 
            -
                  answered = false
         | 
| 32 | 
            -
                  until answered
         | 
| 33 | 
            -
                    print_prefix
         | 
| 34 | 
            -
                    print message
         | 
| 35 | 
            -
                    print " (y/n) "
         | 
| 36 | 
            -
                    
         | 
| 37 | 
            -
                    case $stdin.gets.strip.downcase
         | 
| 38 | 
            -
                    when "y", "yes"
         | 
| 39 | 
            -
                      answered = true
         | 
| 40 | 
            -
                      return true
         | 
| 41 | 
            -
                    when "n", "no"
         | 
| 42 | 
            -
                      answered = true
         | 
| 43 | 
            -
                      return false
         | 
| 44 | 
            -
                    end
         | 
| 45 | 
            -
                  end
         | 
| 46 | 
            -
                end
         | 
| 47 | 
            -
                
         | 
| 48 | 
            -
                def self.print_prefix
         | 
| 49 | 
            -
                  print $stdout.isatty ? "> ".white : "[multirepo] "
         | 
| 50 | 
            -
                end
         | 
| 51 | 
            -
              end
         | 
| 52 | 
            -
            end
         | 
| 1 | 
            +
            require "colored"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module MultiRepo
         | 
| 4 | 
            +
              class Console
         | 
| 5 | 
            +
                def self.log_step(message)
         | 
| 6 | 
            +
                  print_prefix
         | 
| 7 | 
            +
                  puts $stdout.isatty ? message.bold.green : message
         | 
| 8 | 
            +
                end
         | 
| 9 | 
            +
                
         | 
| 10 | 
            +
                def self.log_substep(message)
         | 
| 11 | 
            +
                  print_prefix
         | 
| 12 | 
            +
                  puts $stdout.isatty ? message.blue : message
         | 
| 13 | 
            +
                end
         | 
| 14 | 
            +
                
         | 
| 15 | 
            +
                def self.log_info(message)
         | 
| 16 | 
            +
                  print_prefix
         | 
| 17 | 
            +
                  puts $stdout.isatty ? message.white : message
         | 
| 18 | 
            +
                end
         | 
| 19 | 
            +
                
         | 
| 20 | 
            +
                def self.log_warning(message)
         | 
| 21 | 
            +
                  print_prefix
         | 
| 22 | 
            +
                  puts $stdout.isatty ? message.yellow : message
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
                
         | 
| 25 | 
            +
                def self.log_error(message)
         | 
| 26 | 
            +
                  print_prefix
         | 
| 27 | 
            +
                  puts $stdout.isatty ? message.red : message
         | 
| 28 | 
            +
                end
         | 
| 29 | 
            +
                
         | 
| 30 | 
            +
                def self.ask(message)
         | 
| 31 | 
            +
                  answered = false
         | 
| 32 | 
            +
                  until answered
         | 
| 33 | 
            +
                    print_prefix
         | 
| 34 | 
            +
                    print message
         | 
| 35 | 
            +
                    print " (y/n) "
         | 
| 36 | 
            +
                    
         | 
| 37 | 
            +
                    case $stdin.gets.strip.downcase
         | 
| 38 | 
            +
                    when "y", "yes"
         | 
| 39 | 
            +
                      answered = true
         | 
| 40 | 
            +
                      return true
         | 
| 41 | 
            +
                    when "n", "no"
         | 
| 42 | 
            +
                      answered = true
         | 
| 43 | 
            +
                      return false
         | 
| 44 | 
            +
                    end
         | 
| 45 | 
            +
                  end
         | 
| 46 | 
            +
                end
         | 
| 47 | 
            +
                
         | 
| 48 | 
            +
                def self.print_prefix
         | 
| 49 | 
            +
                  print $stdout.isatty ? "> ".white : "[multirepo] "
         | 
| 50 | 
            +
                end
         | 
| 51 | 
            +
              end
         | 
| 52 | 
            +
            end
         | 
| @@ -1,27 +1,27 @@ | |
| 1 | 
            -
            require "open3"
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            require "multirepo/utility/console"
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            module MultiRepo
         | 
| 6 | 
            -
              class PopenRunner
         | 
| 7 | 
            -
                def self.run(cmd, verbosity)
         | 
| 8 | 
            -
                  Console.log_info("Command: #{cmd}") if Config.instance.verbose
         | 
| 9 | 
            -
                  
         | 
| 10 | 
            -
                  lines = []
         | 
| 11 | 
            -
                  last_command_succeeded = false
         | 
| 12 | 
            -
                  Open3.popen2e(cmd) do |_stdin, stdout_and_stderr, thread|
         | 
| 13 | 
            -
                    stdout_and_stderr.each do |line|
         | 
| 14 | 
            -
                      print line if Config.instance.verbose
         | 
| 15 | 
            -
                      lines << line
         | 
| 16 | 
            -
                    end
         | 
| 17 | 
            -
                    last_command_succeeded = thread.value.success?
         | 
| 18 | 
            -
                  end
         | 
| 19 | 
            -
                  
         | 
| 20 | 
            -
                  output = lines.join("").rstrip
         | 
| 21 | 
            -
                  
         | 
| 22 | 
            -
                  Console.log_error(output) if !last_command_succeeded && verbosity == Verbosity::OUTPUT_ON_ERROR
         | 
| 23 | 
            -
                  
         | 
| 24 | 
            -
                  return output, last_command_succeeded
         | 
| 25 | 
            -
                end
         | 
| 26 | 
            -
              end
         | 
| 27 | 
            -
            end
         | 
| 1 | 
            +
            require "open3"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require "multirepo/utility/console"
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            module MultiRepo
         | 
| 6 | 
            +
              class PopenRunner
         | 
| 7 | 
            +
                def self.run(cmd, verbosity)
         | 
| 8 | 
            +
                  Console.log_info("Command: #{cmd}") if Config.instance.verbose
         | 
| 9 | 
            +
                  
         | 
| 10 | 
            +
                  lines = []
         | 
| 11 | 
            +
                  last_command_succeeded = false
         | 
| 12 | 
            +
                  Open3.popen2e(cmd) do |_stdin, stdout_and_stderr, thread|
         | 
| 13 | 
            +
                    stdout_and_stderr.each do |line|
         | 
| 14 | 
            +
                      print line if Config.instance.verbose
         | 
| 15 | 
            +
                      lines << line
         | 
| 16 | 
            +
                    end
         | 
| 17 | 
            +
                    last_command_succeeded = thread.value.success?
         | 
| 18 | 
            +
                  end
         | 
| 19 | 
            +
                  
         | 
| 20 | 
            +
                  output = lines.join("").rstrip
         | 
| 21 | 
            +
                  
         | 
| 22 | 
            +
                  Console.log_error(output) if !last_command_succeeded && verbosity == Verbosity::OUTPUT_ON_ERROR
         | 
| 23 | 
            +
                  
         | 
| 24 | 
            +
                  return output, last_command_succeeded
         | 
| 25 | 
            +
                end
         | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
            end
         | 
| @@ -1,14 +1,14 @@ | |
| 1 | 
            -
            require "multirepo/utility/console"
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module MultiRepo
         | 
| 4 | 
            -
              class SystemRunner
         | 
| 5 | 
            -
                def self.run(cmd)
         | 
| 6 | 
            -
                  Console.log_info("Command: #{cmd}") if Config.instance.verbose
         | 
| 7 | 
            -
                  
         | 
| 8 | 
            -
                  output = system(cmd)
         | 
| 9 | 
            -
                  last_command_succeeded = ($?.exitstatus == 0)
         | 
| 10 | 
            -
                  
         | 
| 11 | 
            -
                  return output, last_command_succeeded
         | 
| 12 | 
            -
                end
         | 
| 13 | 
            -
              end
         | 
| 14 | 
            -
            end
         | 
| 1 | 
            +
            require "multirepo/utility/console"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module MultiRepo
         | 
| 4 | 
            +
              class SystemRunner
         | 
| 5 | 
            +
                def self.run(cmd)
         | 
| 6 | 
            +
                  Console.log_info("Command: #{cmd}") if Config.instance.verbose
         | 
| 7 | 
            +
                  
         | 
| 8 | 
            +
                  output = system(cmd)
         | 
| 9 | 
            +
                  last_command_succeeded = ($?.exitstatus == 0)
         | 
| 10 | 
            +
                  
         | 
| 11 | 
            +
                  return output, last_command_succeeded
         | 
| 12 | 
            +
                end
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
            end
         | 
| @@ -1,99 +1,99 @@ | |
| 1 | 
            -
            require "multirepo/multirepo-exception"
         | 
| 2 | 
            -
            require "fileutils"
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            module MultiRepo
         | 
| 5 | 
            -
              class Utils
         | 
| 6 | 
            -
                def self.only_one_true?(*flags)
         | 
| 7 | 
            -
                  flags.reduce(0) { |count, flag| count += 1 if flag; count } <= 1
         | 
| 8 | 
            -
                end
         | 
| 9 | 
            -
             | 
| 10 | 
            -
                def self.path_for_resource(resource_name)
         | 
| 11 | 
            -
                  gem_path = Gem::Specification.find_by_name("git-multirepo").gem_dir
         | 
| 12 | 
            -
                  File.join(gem_path, "resources/#{resource_name}")
         | 
| 13 | 
            -
                end
         | 
| 14 | 
            -
                
         | 
| 15 | 
            -
                def self.multirepo_enabled?(path)
         | 
| 16 | 
            -
                  File.exist?(File.join(path, ".multirepo"))
         | 
| 17 | 
            -
                end
         | 
| 18 | 
            -
             | 
| 19 | 
            -
                def self.multirepo_tracked?(path)
         | 
| 20 | 
            -
                  multirepo_enabled?(path) && File.exist?(File.join(path, ".multirepo.lock"))
         | 
| 21 | 
            -
                end
         | 
| 22 | 
            -
                
         | 
| 23 | 
            -
                def self.install_hook(name, path)
         | 
| 24 | 
            -
                  destination_path = File.join(path, ".git/hooks")
         | 
| 25 | 
            -
                  destination_file = File.join(destination_path, name)
         | 
| 26 | 
            -
                  FileUtils.cp(path_for_resource(name), destination_file)
         | 
| 27 | 
            -
                  FileUtils.chmod(0755, destination_file) # -rwxr-xr-x
         | 
| 28 | 
            -
                end
         | 
| 29 | 
            -
                
         | 
| 30 | 
            -
                def self.sibling_repos
         | 
| 31 | 
            -
                  sibling_directories = Dir['../*/']
         | 
| 32 | 
            -
                  sibling_repos = sibling_directories.map{ |d| Repo.new(d) }.select(&:exists?)
         | 
| 33 | 
            -
                  sibling_repos.delete_if{ |r| Pathname.new(r.path).realpath == Pathname.new(".").realpath }
         | 
| 34 | 
            -
                end
         | 
| 35 | 
            -
                
         | 
| 36 | 
            -
                def self.dependencies_clean?(config_entries)
         | 
| 37 | 
            -
                  clean = true
         | 
| 38 | 
            -
                  missing = false
         | 
| 39 | 
            -
                  config_entries.each do |e|
         | 
| 40 | 
            -
                    # Ensure the dependency exists
         | 
| 41 | 
            -
                    unless e.repo.exists?
         | 
| 42 | 
            -
                      Console.log_error("Dependency '#{e.path}' does not exist on disk")
         | 
| 43 | 
            -
                      missing |= true
         | 
| 44 | 
            -
                      next
         | 
| 45 | 
            -
                    end
         | 
| 46 | 
            -
                    
         | 
| 47 | 
            -
                    # Ensure it contains no uncommitted changes
         | 
| 48 | 
            -
                    dependency_clean = e.repo.clean?
         | 
| 49 | 
            -
                    clean &= dependency_clean
         | 
| 50 | 
            -
                    Console.log_warning("Dependency '#{e.repo.path}' contains uncommitted changes") unless dependency_clean
         | 
| 51 | 
            -
                  end
         | 
| 52 | 
            -
                  
         | 
| 53 | 
            -
                  fail MultiRepoException, "Some dependencies are not present on this machine." \
         | 
| 54 | 
            -
                    " Run \"multi install\" to clone missing dependencies." if missing
         | 
| 55 | 
            -
                  
         | 
| 56 | 
            -
                  return clean
         | 
| 57 | 
            -
                end
         | 
| 58 | 
            -
                
         | 
| 59 | 
            -
                def self.ensure_working_copies_clean(repos)
         | 
| 60 | 
            -
                  clean = true
         | 
| 61 | 
            -
                  repos.each do |repo|
         | 
| 62 | 
            -
                    dependency_clean = repo.clean?
         | 
| 63 | 
            -
                    clean &= dependency_clean
         | 
| 64 | 
            -
                    Console.log_warning("Repo '#{repo.path}' contains uncommitted changes") unless dependency_clean
         | 
| 65 | 
            -
                  end
         | 
| 66 | 
            -
                  return clean
         | 
| 67 | 
            -
                end
         | 
| 68 | 
            -
                
         | 
| 69 | 
            -
                def self.convert_to_windows_path(unix_path)
         | 
| 70 | 
            -
                  components = Pathname.new(unix_path).each_filename.to_a
         | 
| 71 | 
            -
                  components.join(File::ALT_SEPARATOR)
         | 
| 72 | 
            -
                end
         | 
| 73 | 
            -
                
         | 
| 74 | 
            -
                def self.reveal_in_default_file_browser(unix_path)
         | 
| 75 | 
            -
                  if OS.osx?
         | 
| 76 | 
            -
                    system %(open "#{unix_path}")
         | 
| 77 | 
            -
                  elsif OS.windows?
         | 
| 78 | 
            -
                    system %(explorer "#{Utils.convert_to_windows_path(unix_path)}")
         | 
| 79 | 
            -
                  end
         | 
| 80 | 
            -
                end
         | 
| 81 | 
            -
                
         | 
| 82 | 
            -
                def self.open_in_default_app(unix_path)
         | 
| 83 | 
            -
                  if OS.osx?
         | 
| 84 | 
            -
                    system %(open "#{unix_path}")
         | 
| 85 | 
            -
                  elsif OS.windows?
         | 
| 86 | 
            -
                    system %(cmd /c "start C:\\#{Utils.convert_to_windows_path(unix_path)}")
         | 
| 87 | 
            -
                  end
         | 
| 88 | 
            -
                end
         | 
| 89 | 
            -
                
         | 
| 90 | 
            -
                def self.append_if_missing(path, pattern, string_to_append)
         | 
| 91 | 
            -
                  if File.exist?(path)
         | 
| 92 | 
            -
                    string_located = File.readlines(path).grep(pattern).any?
         | 
| 93 | 
            -
                    File.open(path, 'a') { |f| f.puts(string_to_append) } unless string_located
         | 
| 94 | 
            -
                  else
         | 
| 95 | 
            -
                    File.open(path, 'w') { |f| f.puts(string_to_append) }
         | 
| 96 | 
            -
                  end
         | 
| 97 | 
            -
                end
         | 
| 98 | 
            -
              end
         | 
| 99 | 
            -
            end
         | 
| 1 | 
            +
            require "multirepo/multirepo-exception"
         | 
| 2 | 
            +
            require "fileutils"
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            module MultiRepo
         | 
| 5 | 
            +
              class Utils
         | 
| 6 | 
            +
                def self.only_one_true?(*flags)
         | 
| 7 | 
            +
                  flags.reduce(0) { |count, flag| count += 1 if flag; count } <= 1
         | 
| 8 | 
            +
                end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                def self.path_for_resource(resource_name)
         | 
| 11 | 
            +
                  gem_path = Gem::Specification.find_by_name("git-multirepo").gem_dir
         | 
| 12 | 
            +
                  File.join(gem_path, "resources/#{resource_name}")
         | 
| 13 | 
            +
                end
         | 
| 14 | 
            +
                
         | 
| 15 | 
            +
                def self.multirepo_enabled?(path)
         | 
| 16 | 
            +
                  File.exist?(File.join(path, ".multirepo"))
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                def self.multirepo_tracked?(path)
         | 
| 20 | 
            +
                  multirepo_enabled?(path) && File.exist?(File.join(path, ".multirepo.lock"))
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
                
         | 
| 23 | 
            +
                def self.install_hook(name, path)
         | 
| 24 | 
            +
                  destination_path = File.join(path, ".git/hooks")
         | 
| 25 | 
            +
                  destination_file = File.join(destination_path, name)
         | 
| 26 | 
            +
                  FileUtils.cp(path_for_resource(name), destination_file)
         | 
| 27 | 
            +
                  FileUtils.chmod(0755, destination_file) # -rwxr-xr-x
         | 
| 28 | 
            +
                end
         | 
| 29 | 
            +
                
         | 
| 30 | 
            +
                def self.sibling_repos
         | 
| 31 | 
            +
                  sibling_directories = Dir['../*/']
         | 
| 32 | 
            +
                  sibling_repos = sibling_directories.map{ |d| Repo.new(d) }.select(&:exists?)
         | 
| 33 | 
            +
                  sibling_repos.delete_if{ |r| Pathname.new(r.path).realpath == Pathname.new(".").realpath }
         | 
| 34 | 
            +
                end
         | 
| 35 | 
            +
                
         | 
| 36 | 
            +
                def self.dependencies_clean?(config_entries)
         | 
| 37 | 
            +
                  clean = true
         | 
| 38 | 
            +
                  missing = false
         | 
| 39 | 
            +
                  config_entries.each do |e|
         | 
| 40 | 
            +
                    # Ensure the dependency exists
         | 
| 41 | 
            +
                    unless e.repo.exists?
         | 
| 42 | 
            +
                      Console.log_error("Dependency '#{e.path}' does not exist on disk")
         | 
| 43 | 
            +
                      missing |= true
         | 
| 44 | 
            +
                      next
         | 
| 45 | 
            +
                    end
         | 
| 46 | 
            +
                    
         | 
| 47 | 
            +
                    # Ensure it contains no uncommitted changes
         | 
| 48 | 
            +
                    dependency_clean = e.repo.clean?
         | 
| 49 | 
            +
                    clean &= dependency_clean
         | 
| 50 | 
            +
                    Console.log_warning("Dependency '#{e.repo.path}' contains uncommitted changes") unless dependency_clean
         | 
| 51 | 
            +
                  end
         | 
| 52 | 
            +
                  
         | 
| 53 | 
            +
                  fail MultiRepoException, "Some dependencies are not present on this machine." \
         | 
| 54 | 
            +
                    " Run \"multi install\" to clone missing dependencies." if missing
         | 
| 55 | 
            +
                  
         | 
| 56 | 
            +
                  return clean
         | 
| 57 | 
            +
                end
         | 
| 58 | 
            +
                
         | 
| 59 | 
            +
                def self.ensure_working_copies_clean(repos)
         | 
| 60 | 
            +
                  clean = true
         | 
| 61 | 
            +
                  repos.each do |repo|
         | 
| 62 | 
            +
                    dependency_clean = repo.clean?
         | 
| 63 | 
            +
                    clean &= dependency_clean
         | 
| 64 | 
            +
                    Console.log_warning("Repo '#{repo.path}' contains uncommitted changes") unless dependency_clean
         | 
| 65 | 
            +
                  end
         | 
| 66 | 
            +
                  return clean
         | 
| 67 | 
            +
                end
         | 
| 68 | 
            +
                
         | 
| 69 | 
            +
                def self.convert_to_windows_path(unix_path)
         | 
| 70 | 
            +
                  components = Pathname.new(unix_path).each_filename.to_a
         | 
| 71 | 
            +
                  components.join(File::ALT_SEPARATOR)
         | 
| 72 | 
            +
                end
         | 
| 73 | 
            +
                
         | 
| 74 | 
            +
                def self.reveal_in_default_file_browser(unix_path)
         | 
| 75 | 
            +
                  if OS.osx?
         | 
| 76 | 
            +
                    system %(open "#{unix_path}")
         | 
| 77 | 
            +
                  elsif OS.windows?
         | 
| 78 | 
            +
                    system %(explorer "#{Utils.convert_to_windows_path(unix_path)}")
         | 
| 79 | 
            +
                  end
         | 
| 80 | 
            +
                end
         | 
| 81 | 
            +
                
         | 
| 82 | 
            +
                def self.open_in_default_app(unix_path)
         | 
| 83 | 
            +
                  if OS.osx?
         | 
| 84 | 
            +
                    system %(open "#{unix_path}")
         | 
| 85 | 
            +
                  elsif OS.windows?
         | 
| 86 | 
            +
                    system %(cmd /c "start C:\\#{Utils.convert_to_windows_path(unix_path)}")
         | 
| 87 | 
            +
                  end
         | 
| 88 | 
            +
                end
         | 
| 89 | 
            +
                
         | 
| 90 | 
            +
                def self.append_if_missing(path, pattern, string_to_append)
         | 
| 91 | 
            +
                  if File.exist?(path)
         | 
| 92 | 
            +
                    string_located = File.readlines(path).grep(pattern).any?
         | 
| 93 | 
            +
                    File.open(path, 'a') { |f| f.puts(string_to_append) } unless string_located
         | 
| 94 | 
            +
                  else
         | 
| 95 | 
            +
                    File.open(path, 'w') { |f| f.puts(string_to_append) }
         | 
| 96 | 
            +
                  end
         | 
| 97 | 
            +
                end
         | 
| 98 | 
            +
              end
         | 
| 99 | 
            +
            end
         | 
| @@ -1,6 +1,6 @@ | |
| 1 | 
            -
            module MultiRepo
         | 
| 2 | 
            -
              class Verbosity
         | 
| 3 | 
            -
                OUTPUT_NEVER = 0
         | 
| 4 | 
            -
                OUTPUT_ON_ERROR = 1
         | 
| 5 | 
            -
              end
         | 
| 6 | 
            -
            end
         | 
| 1 | 
            +
            module MultiRepo
         | 
| 2 | 
            +
              class Verbosity
         | 
| 3 | 
            +
                OUTPUT_NEVER = 0
         | 
| 4 | 
            +
                OUTPUT_ON_ERROR = 1
         | 
| 5 | 
            +
              end
         | 
| 6 | 
            +
            end
         | 
    
        data/resources/.gitconfig
    CHANGED
    
    | @@ -1,3 +1,3 @@ | |
| 1 | 
            -
            [merge "ours"]
         | 
| 2 | 
            -
            	name = "Always keep ours"
         | 
| 1 | 
            +
            [merge "ours"]
         | 
| 2 | 
            +
            	name = "Always keep ours"
         | 
| 3 3 | 
             
            	driver = true
         | 
    
        data/resources/post-commit
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 | 
            -
            #!/usr/bin/env ruby
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            require "rubygems"
         | 
| 4 | 
            -
            require "git-multirepo"
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            MultiRepo::PostCommitHook.run
         | 
| 1 | 
            +
            #!/usr/bin/env ruby
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require "rubygems"
         | 
| 4 | 
            +
            require "git-multirepo"
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            MultiRepo::PostCommitHook.run
         | 
    
        data/resources/pre-commit
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 | 
            -
            #!/usr/bin/env ruby
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            require "rubygems"
         | 
| 4 | 
            -
            require "git-multirepo"
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            MultiRepo::PreCommitHook.run
         | 
| 1 | 
            +
            #!/usr/bin/env ruby
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require "rubygems"
         | 
| 4 | 
            +
            require "git-multirepo"
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            MultiRepo::PreCommitHook.run
         | 
| @@ -1,19 +1,19 @@ | |
| 1 | 
            -
            require "multirepo/commands/init"
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            RSpec.describe("Init") do
         | 
| 4 | 
            -
              it "creates the config file" do
         | 
| 5 | 
            -
                pending
         | 
| 6 | 
            -
              end
         | 
| 7 | 
            -
              
         | 
| 8 | 
            -
              it "adds only specified repos to the config file" do
         | 
| 9 | 
            -
                pending
         | 
| 10 | 
            -
              end
         | 
| 11 | 
            -
              
         | 
| 12 | 
            -
              it "installs the hooks" do
         | 
| 13 | 
            -
                pending
         | 
| 14 | 
            -
              end
         | 
| 15 | 
            -
              
         | 
| 16 | 
            -
              it "fails when there are uncommitted changes in dependencies" do
         | 
| 17 | 
            -
                pending
         | 
| 18 | 
            -
              end
         | 
| 19 | 
            -
            end
         | 
| 1 | 
            +
            require "multirepo/commands/init"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            RSpec.describe("Init") do
         | 
| 4 | 
            +
              it "creates the config file" do
         | 
| 5 | 
            +
                pending
         | 
| 6 | 
            +
              end
         | 
| 7 | 
            +
              
         | 
| 8 | 
            +
              it "adds only specified repos to the config file" do
         | 
| 9 | 
            +
                pending
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
              
         | 
| 12 | 
            +
              it "installs the hooks" do
         | 
| 13 | 
            +
                pending
         | 
| 14 | 
            +
              end
         | 
| 15 | 
            +
              
         | 
| 16 | 
            +
              it "fails when there are uncommitted changes in dependencies" do
         | 
| 17 | 
            +
                pending
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
            end
         |