git-multirepo 1.0.0.beta40 → 1.0.0.beta42

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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +2 -2
  3. data/.gitbugtraq +3 -3
  4. data/.gitignore +38 -38
  5. data/.multirepo.meta +2 -2
  6. data/.rspec +2 -2
  7. data/Gemfile +4 -4
  8. data/Gemfile.lock +42 -42
  9. data/LICENSE +22 -22
  10. data/README.md +143 -146
  11. data/Rakefile +2 -2
  12. data/bin/multi +10 -10
  13. data/docs/bug-repros/91565510-repro.sh +20 -20
  14. data/docs/git-multirepo-cheatsheet.docx +0 -0
  15. data/git-multirepo.gemspec +31 -31
  16. data/lib/commands.rb +13 -15
  17. data/lib/git-multirepo.rb +2 -2
  18. data/lib/info.rb +4 -4
  19. data/lib/multirepo/commands/add-command.rb +50 -53
  20. data/lib/multirepo/commands/branch-command.rb +81 -82
  21. data/lib/multirepo/commands/checkout-command.rb +119 -122
  22. data/lib/multirepo/commands/clone-command.rb +67 -70
  23. data/lib/multirepo/commands/command.rb +89 -75
  24. data/lib/multirepo/commands/do-command.rb +100 -75
  25. data/lib/multirepo/commands/graph-command.rb +42 -45
  26. data/lib/multirepo/commands/init-command.rb +119 -119
  27. data/lib/multirepo/commands/install-command.rb +106 -103
  28. data/lib/multirepo/commands/merge-command.rb +225 -167
  29. data/lib/multirepo/commands/open-command.rb +55 -57
  30. data/lib/multirepo/commands/remove-command.rb +47 -50
  31. data/lib/multirepo/commands/uninit-command.rb +17 -20
  32. data/lib/multirepo/commands/update-command.rb +55 -60
  33. data/lib/multirepo/config.rb +15 -15
  34. data/lib/multirepo/files/config-entry.rb +38 -38
  35. data/lib/multirepo/files/config-file.rb +45 -45
  36. data/lib/multirepo/files/lock-entry.rb +28 -24
  37. data/lib/multirepo/files/lock-file.rb +55 -38
  38. data/lib/multirepo/files/meta-file.rb +40 -40
  39. data/lib/multirepo/files/tracking-file.rb +8 -8
  40. data/lib/multirepo/files/tracking-files.rb +46 -46
  41. data/lib/multirepo/git/branch.rb +31 -30
  42. data/lib/multirepo/git/change.rb +10 -10
  43. data/lib/multirepo/git/commit.rb +6 -17
  44. data/lib/multirepo/git/git-runner.rb +46 -46
  45. data/lib/multirepo/git/git.rb +10 -0
  46. data/lib/multirepo/git/ref.rb +38 -0
  47. data/lib/multirepo/git/remote.rb +16 -16
  48. data/lib/multirepo/git/repo.rb +122 -77
  49. data/lib/multirepo/hooks/post-commit-hook.rb +22 -22
  50. data/lib/multirepo/hooks/pre-commit-hook.rb +34 -31
  51. data/lib/multirepo/logic/dependency.rb +6 -0
  52. data/lib/multirepo/logic/merge-descriptor.rb +94 -12
  53. data/lib/multirepo/logic/node.rb +71 -44
  54. data/lib/multirepo/logic/performer.rb +56 -62
  55. data/lib/multirepo/logic/revision-selector.rb +34 -34
  56. data/lib/multirepo/multirepo-exception.rb +5 -5
  57. data/lib/multirepo/utility/console.rb +51 -51
  58. data/lib/multirepo/utility/runner.rb +34 -34
  59. data/lib/multirepo/utility/utils.rb +94 -81
  60. data/resources/.gitconfig +2 -2
  61. data/resources/post-commit +5 -5
  62. data/resources/pre-commit +5 -5
  63. data/spec/integration/init_spec.rb +18 -18
  64. data/spec/spec_helper.rb +89 -89
  65. metadata +6 -5
  66. data/lib/multirepo/commands/clean-command.rb +0 -32
  67. data/lib/multirepo/commands/fetch-command.rb +0 -31
@@ -1,123 +1,120 @@
1
- require "multirepo/utility/console"
2
- require "multirepo/logic/revision-selector"
3
- require "multirepo/logic/performer"
4
-
5
- module MultiRepo
6
- class CheckoutCommand < Command
7
- self.command = "checkout"
8
- self.summary = "Checks out the specified commit or branch of the main repo and checks out matching versions of all dependencies."
9
-
10
- def self.options
11
- [
12
- ['<ref>', 'The main repo tag, branch or commit id to checkout.'],
13
- ['[--latest]', 'Checkout the HEAD of each dependency branch (as recorded in the lock file) instead of the exact required commits.'],
14
- ['[--exact]', 'Checkout the exact specified ref for each repo, regardless of what\'s stored in the lock file.']
15
- ].concat(super)
16
- end
17
-
18
- def initialize(argv)
19
- @ref = argv.shift_argument
20
- @checkout_latest = argv.flag?("latest")
21
- @checkout_exact = argv.flag?("exact")
22
- super
23
- end
24
-
25
- def validate!
26
- super
27
- help! "You must specify a branch or commit id to checkout" unless @ref
28
- unless validate_only_one_flag(@checkout_latest, @checkout_exact)
29
- help! "You can't provide more than one operation modifier (--latest, --exact, etc.)"
30
- end
31
- end
32
-
33
- def run
34
- super
35
- ensure_in_work_tree
36
-
37
- # Find out the checkout mode based on command-line options
38
- mode = RevisionSelector.mode_for_args(@checkout_latest, @checkout_exact)
39
-
40
- strategy_name = RevisionSelectionMode.name_for_mode(mode)
41
- Console.log_step("Checking out #{@ref} and its dependencies using the '#{strategy_name}' strategy...")
42
-
43
- main_repo = Repo.new(".")
44
-
45
- unless proceed_if_merge_commit?(main_repo, @ref, mode)
46
- raise MultiRepoException, "Aborting checkout"
47
- end
48
-
49
- checkout_core(main_repo, mode)
50
-
51
- Console.log_step("Done!")
52
- rescue MultiRepoException => e
53
- Console.log_error(e.message)
54
- end
55
-
56
- def checkout_core(main_repo, mode)
57
- initial_revision = main_repo.current_branch || main_repo.head_hash
58
- begin
59
- # Checkout first because the current ref might not be multirepo-enabled
60
- checkout_main_repo_step(main_repo)
61
- # Only then can we check for dependencies and make sure they are clean
62
- ensure_dependencies_clean_step(main_repo)
63
- rescue MultiRepoException => e
64
- Console.log_error("Reverting main repo checkout")
65
- main_repo.checkout(initial_revision)
66
- raise e
67
- end
68
- dependencies_checkout_step(mode, @ref)
69
- end
70
-
71
- def checkout_main_repo_step(main_repo)
72
- Performer.perform_main_repo_checkout(main_repo, @ref)
73
- end
74
-
75
- def ensure_dependencies_clean_step(main_repo)
76
- unless Utils.ensure_dependencies_clean(ConfigFile.new(".").load_entries)
77
- raise MultiRepoException, "Dependencies are not clean!"
78
- end
79
- end
80
-
81
- def dependencies_checkout_step(mode, ref = nil)
82
- Performer.perform_on_dependencies do |config_entry, lock_entry|
83
- # Find out the required dependency revision based on the checkout mode
84
- revision = RevisionSelector.revision_for_mode(mode, ref, lock_entry)
85
- perform_dependency_checkout(config_entry, revision)
86
- end
87
- end
88
-
89
- def proceed_if_merge_commit?(main_repo, ref, mode)
90
- return true unless main_repo.commit(ref).is_merge?
91
-
92
- case mode
93
- when RevisionSelectionMode::AS_LOCK
94
- Console.log_error("The specified ref is a merge commit and an \"as-lock\" checkout was requested.")
95
- Console.log_error("The resulting checkout would most probably not result in a valid project state.")
96
- return false
97
- when RevisionSelectionMode::LATEST
98
- Console.log_warning("The specified ref is a merge commit and a \"latest\" checkout was requested.")
99
- Console.log_warning("The work branches recorded in the branch from which the merge was performed will be checked out.")
100
- end
101
-
102
- return true
103
- end
104
-
105
- def perform_dependency_checkout(config_entry, revision)
106
- dependency_name = config_entry.repo.basename
107
-
108
- # Make sure the repo exists on disk, and clone it if it doesn't
109
- # (in case the checked-out revision had an additional dependency)
110
- unless config_entry.repo.exists?
111
- Console.log_substep("Cloning missing dependency '#{config_entry.path}' from #{config_entry.url}")
112
- config_entry.repo.clone(config_entry.url)
113
- end
114
-
115
- # Checkout!
116
- if config_entry.repo.checkout(revision)
117
- Console.log_substep("Checked out #{dependency_name} #{revision}")
118
- else
119
- raise MultiRepoException, "Couldn't check out the appropriate version of dependency #{dependency_name}"
120
- end
121
- end
122
- end
1
+ require "multirepo/utility/console"
2
+ require "multirepo/logic/revision-selector"
3
+ require "multirepo/logic/performer"
4
+
5
+ module MultiRepo
6
+ class CheckoutCommand < Command
7
+ self.command = "checkout"
8
+ self.summary = "Checks out the specified commit or branch of the main repo and checks out matching versions of all dependencies."
9
+
10
+ def self.options
11
+ [
12
+ ['<refname>', 'The main repo tag, branch or commit id to checkout.'],
13
+ ['[--latest]', 'Checkout the HEAD of each dependency branch (as recorded in the lock file) instead of the exact required commits.'],
14
+ ['[--exact]', 'Checkout the exact specified ref for each repo, regardless of what\'s stored in the lock file.']
15
+ ].concat(super)
16
+ end
17
+
18
+ def initialize(argv)
19
+ @ref_name = argv.shift_argument
20
+ @checkout_latest = argv.flag?("latest")
21
+ @checkout_exact = argv.flag?("exact")
22
+ super
23
+ end
24
+
25
+ def validate!
26
+ super
27
+ help! "You must specify a branch or commit id to checkout" unless @ref_name
28
+ unless validate_only_one_flag(@checkout_latest, @checkout_exact)
29
+ help! "You can't provide more than one operation modifier (--latest, --exact, etc.)"
30
+ end
31
+ end
32
+
33
+ def run
34
+ ensure_in_work_tree
35
+
36
+ # Find out the checkout mode based on command-line options
37
+ mode = RevisionSelector.mode_for_args(@checkout_latest, @checkout_exact)
38
+
39
+ strategy_name = RevisionSelectionMode.name_for_mode(mode)
40
+ Console.log_step("Checking out #{@ref_name} and its dependencies using the '#{strategy_name}' strategy...")
41
+
42
+ main_repo = Repo.new(".")
43
+
44
+ unless proceed_if_merge_commit?(main_repo, @ref_name, mode)
45
+ raise MultiRepoException, "Aborting checkout"
46
+ end
47
+
48
+ checkout_core(main_repo, mode)
49
+
50
+ Console.log_step("Done!")
51
+ end
52
+
53
+ def checkout_core(main_repo, mode)
54
+ initial_revision = main_repo.current_revision
55
+ begin
56
+ # Checkout first because the current ref might not be multirepo-enabled
57
+ checkout_main_repo_step(main_repo)
58
+ # Only then can we check for dependencies and make sure they are clean
59
+ ensure_dependencies_clean_step(main_repo)
60
+ rescue MultiRepoException => e
61
+ Console.log_warning("Restoring working copy to #{initial_revision}")
62
+ main_repo.checkout(initial_revision)
63
+ raise e
64
+ end
65
+ dependencies_checkout_step(mode, @ref_name)
66
+ end
67
+
68
+ def checkout_main_repo_step(main_repo)
69
+ Performer.perform_main_repo_checkout(main_repo, @ref_name)
70
+ end
71
+
72
+ def ensure_dependencies_clean_step(main_repo)
73
+ unless Utils.dependencies_clean?(ConfigFile.new(".").load_entries)
74
+ raise MultiRepoException, "Dependencies are not clean!"
75
+ end
76
+ end
77
+
78
+ def dependencies_checkout_step(mode, ref_name = nil)
79
+ Performer.dependencies.each do |dependency|
80
+ # Find out the required dependency revision based on the checkout mode
81
+ revision = RevisionSelector.revision_for_mode(mode, ref_name, dependency.lock_entry)
82
+ perform_dependency_checkout(dependency.config_entry, revision)
83
+ end
84
+ end
85
+
86
+ def proceed_if_merge_commit?(main_repo, ref_name, mode)
87
+ return true unless main_repo.ref(ref_name).is_merge?
88
+
89
+ case mode
90
+ when RevisionSelectionMode::AS_LOCK
91
+ Console.log_error("The specified ref is a merge commit and an \"as-lock\" checkout was requested.")
92
+ Console.log_error("The resulting checkout would most probably not result in a valid project state.")
93
+ return false
94
+ when RevisionSelectionMode::LATEST
95
+ Console.log_warning("The specified ref is a merge commit and a \"latest\" checkout was requested.")
96
+ Console.log_warning("The work branches recorded in the branch from which the merge was performed will be checked out.")
97
+ end
98
+
99
+ return true
100
+ end
101
+
102
+ def perform_dependency_checkout(config_entry, revision)
103
+ dependency_name = config_entry.repo.basename
104
+
105
+ # Make sure the repo exists on disk, and clone it if it doesn't
106
+ # (in case the checked-out revision had an additional dependency)
107
+ unless config_entry.repo.exists?
108
+ Console.log_substep("Cloning missing dependency '#{config_entry.path}' from #{config_entry.url}")
109
+ config_entry.repo.clone(config_entry.url)
110
+ end
111
+
112
+ # Checkout!
113
+ if config_entry.repo.checkout(revision)
114
+ Console.log_substep("Checked out #{dependency_name} #{revision}")
115
+ else
116
+ raise MultiRepoException, "Couldn't check out the appropriate version of dependency #{dependency_name}"
117
+ end
118
+ end
119
+ end
123
120
  end
@@ -1,71 +1,68 @@
1
- require "multirepo/utility/console"
2
- require "multirepo/utility/utils"
3
- require "multirepo/git/repo"
4
- require_relative "install-command"
5
-
6
- module MultiRepo
7
- class CloneCommand < Command
8
- self.command = "clone"
9
- self.summary = "Clones the specified repository in a subfolder, then installs it."
10
-
11
- def self.options
12
- [
13
- ['<url>', 'The repository to clone.'],
14
- ['<name>', 'The name of the containing folder that will be created.'],
15
- ['[<ref>]', 'The branch, tag or commit id to checkout. Checkout will use "master" if unspecified.']
16
- ].concat(super)
17
- end
18
-
19
- def initialize(argv)
20
- @url = argv.shift_argument
21
- @name = argv.shift_argument
22
- @ref = argv.shift_argument || "master"
23
- super
24
- end
25
-
26
- def validate!
27
- super
28
- help! "You must specify a repository to clone" unless @url
29
- help! "You must specify a containing folder name" unless @name
30
- end
31
-
32
- def run
33
- super
34
- Console.log_step("Cloning #{@url} ...")
35
-
36
- raise MultiRepoException, "A directory named #{@name} already exists" if Dir.exists?(@name)
37
-
38
- main_repo_path = "#{@name}/#{@name}"
39
- main_repo = Repo.new(main_repo_path)
40
-
41
- # Recursively create the directory where we'll clone the main repo
42
- FileUtils.mkpath(main_repo_path)
43
-
44
- # Clone the specified remote in the just-created directory
45
- raise MultiRepoException, "Could not clone repo from #{@url}" unless main_repo.clone(@url)
46
-
47
- # Checkout the specified main repo ref so that install reads the proper config file
48
- unless main_repo.checkout(@ref)
49
- raise MultiRepoException, "Couldn't perform checkout of main repo #{@ref}!"
50
- end
51
-
52
- Console.log_substep("Checked out main repo #{@ref}")
53
-
54
- # Make sure the ref we just checked out is tracked by multirepo
55
- unless Utils.is_multirepo_tracked(main_repo_path)
56
- raise MultiRepoException, "Ref #{@ref} is not tracked by multirepo"
57
- end
58
-
59
- # Install
60
- original_path = Dir.pwd
61
- Dir.chdir(main_repo_path)
62
- install_command = InstallCommand.new(CLAide::ARGV.new([]))
63
- install_command.full_install
64
- Dir.chdir(original_path)
65
-
66
- Console.log_step("Done!")
67
- rescue MultiRepoException => e
68
- Console.log_error(e.message)
69
- end
70
- end
1
+ require "multirepo/utility/console"
2
+ require "multirepo/utility/utils"
3
+ require "multirepo/git/repo"
4
+ require_relative "install-command"
5
+
6
+ module MultiRepo
7
+ class CloneCommand < Command
8
+ self.command = "clone"
9
+ self.summary = "Clones the specified repository in a subfolder, then installs it."
10
+
11
+ def self.options
12
+ [
13
+ ['<url>', 'The repository to clone.'],
14
+ ['<name>', 'The name of the containing folder that will be created.'],
15
+ ['[<refname>]', 'The branch, tag or commit id to checkout. Checkout will use "master" if unspecified.']
16
+ ].concat(super)
17
+ end
18
+
19
+ def initialize(argv)
20
+ @url = argv.shift_argument
21
+ @name = argv.shift_argument
22
+ @ref_name = argv.shift_argument || "master"
23
+ super
24
+ end
25
+
26
+ def validate!
27
+ super
28
+ help! "You must specify a repository to clone" unless @url
29
+ help! "You must specify a containing folder name" unless @name
30
+ end
31
+
32
+ def run
33
+ Console.log_step("Cloning #{@url} ...")
34
+
35
+ raise MultiRepoException, "A directory named #{@name} already exists" if Dir.exists?(@name)
36
+
37
+ main_repo_path = "#{@name}/#{@name}"
38
+ main_repo = Repo.new(main_repo_path)
39
+
40
+ # Recursively create the directory where we'll clone the main repo
41
+ FileUtils.mkpath(main_repo_path)
42
+
43
+ # Clone the specified remote in the just-created directory
44
+ raise MultiRepoException, "Could not clone repo from #{@url}" unless main_repo.clone(@url)
45
+
46
+ # Checkout the specified main repo ref so that install reads the proper config file
47
+ unless main_repo.checkout(@ref_name)
48
+ raise MultiRepoException, "Couldn't perform checkout of main repo #{@ref_name}!"
49
+ end
50
+
51
+ Console.log_substep("Checked out main repo #{@ref_name}")
52
+
53
+ # Make sure the ref we just checked out is tracked by multirepo
54
+ unless Utils.is_multirepo_tracked(main_repo_path)
55
+ raise MultiRepoException, "Ref #{@ref_name} is not tracked by multirepo"
56
+ end
57
+
58
+ # Install
59
+ original_path = Dir.pwd
60
+ Dir.chdir(main_repo_path)
61
+ install_command = InstallCommand.new(CLAide::ARGV.new([]))
62
+ install_command.full_install
63
+ Dir.chdir(original_path)
64
+
65
+ Console.log_step("Done!")
66
+ end
67
+ end
71
68
  end
@@ -1,76 +1,90 @@
1
- require "claide"
2
-
3
- require "info"
4
- require "multirepo/multirepo-exception"
5
- require "multirepo/config"
6
-
7
- module MultiRepo
8
- class Command < CLAide::Command
9
- self.abstract_command = true
10
- self.command = "multi"
11
- self.version = VERSION
12
- self.description = DESCRIPTION
13
-
14
- def initialize(argv)
15
- @argv = argv
16
- Config.instance.verbose = argv.flag?("verbose") ? true : false
17
- Config.instance.git_executable = argv.option("git-exe", "git")
18
- super
19
- end
20
-
21
- def run
22
- help! "Unknown argument(s): #{@argv.remainder.join(', ')}" unless @argv.empty?
23
- end
24
-
25
- def validate!
26
- path = Config.instance.git_executable
27
- is_git_exe = path =~ /.*(git)|(git.exe)$/
28
- file_exists = path == "git" || File.exists?(path)
29
- help! "Invalid git executable '#{path}'" unless is_git_exe && file_exists
30
- end
31
-
32
- def install_hooks(path)
33
- actual_path = path || "."
34
- Utils.install_hook("pre-commit", actual_path)
35
- Utils.install_hook("post-commit", actual_path)
36
- end
37
-
38
- def uninstall_hooks
39
- FileUtils.rm_f(".git/hooks/pre-commit")
40
- FileUtils.rm_f(".git/hooks/post-commit")
41
- end
42
-
43
- def update_gitconfig(path)
44
- actual_path = path || "."
45
- resource_file = Utils.path_for_resource(".gitconfig")
46
- target_file = File.join(actual_path, '.git/config')
47
-
48
- template = File.read(resource_file)
49
- first_template_line = template.lines.first
50
-
51
- Utils.append_if_missing(target_file, Regexp.new(Regexp.quote(first_template_line)), template)
52
- end
53
-
54
- def multirepo_enabled_dependencies
55
- ConfigFile.new(".").load_entries.select { |e| Utils.is_multirepo_enabled(e.repo.path) }
56
- end
57
-
58
- def validate_only_one_flag(*flags)
59
- flags.reduce(0) { |count, flag| count += 1 if flag; count } <= 1
60
- end
61
-
62
- def ensure_in_work_tree
63
- repo = Repo.new(".")
64
- raise MultiRepoException, "Not a git repository" unless repo.exists?
65
- raise MultiRepoException, "HEAD is unborn (you must perform at least one commit)" unless repo.head_born?
66
- end
67
-
68
- def ensure_multirepo_enabled
69
- raise MultiRepoException, "multirepo is not initialized in this repository." unless Utils.is_multirepo_enabled(".")
70
- end
71
-
72
- def ensure_multirepo_tracked
73
- raise MultiRepoException, "This revision is not tracked by multirepo." unless Utils.is_multirepo_tracked(".")
74
- end
75
- end
1
+ require "claide"
2
+
3
+ require "info"
4
+ require "multirepo/multirepo-exception"
5
+ require "multirepo/config"
6
+ require "multirepo/files/config-file"
7
+ require "multirepo/files/lock-file"
8
+
9
+ module MultiRepo
10
+ class Command < CLAide::Command
11
+ self.abstract_command = true
12
+ self.command = "multi"
13
+ self.version = VERSION
14
+ self.description = DESCRIPTION
15
+
16
+ def self.report_error(exception)
17
+ if exception.instance_of?(MultiRepoException)
18
+ Console.log_error(exception.message)
19
+ return
20
+ end
21
+ raise exception
22
+ end
23
+
24
+ def initialize(argv)
25
+ @argv = argv
26
+ Config.instance.verbose = argv.flag?("verbose") ? true : false
27
+ Config.instance.git_executable = argv.option("git-exe", "git")
28
+ super
29
+ end
30
+
31
+ def run
32
+ help!
33
+ end
34
+
35
+ def validate!
36
+ super
37
+ path = Config.instance.git_executable
38
+ is_git_exe = path =~ /.*(git)|(git.exe)$/
39
+ file_exists = path == "git" || File.exists?(path)
40
+ help! "Invalid git executable '#{path}'" unless is_git_exe && file_exists
41
+ end
42
+
43
+ def install_hooks(path)
44
+ actual_path = path || "."
45
+ Utils.install_hook("pre-commit", actual_path)
46
+ Utils.install_hook("post-commit", actual_path)
47
+ end
48
+
49
+ def uninstall_hooks
50
+ FileUtils.rm_f(".git/hooks/pre-commit")
51
+ FileUtils.rm_f(".git/hooks/post-commit")
52
+ end
53
+
54
+ def update_gitconfig(path)
55
+ actual_path = path || "."
56
+ resource_file = Utils.path_for_resource(".gitconfig")
57
+ target_file = File.join(actual_path, '.git/config')
58
+
59
+ template = File.read(resource_file)
60
+ first_template_line = template.lines.first
61
+
62
+ Utils.append_if_missing(target_file, Regexp.new(Regexp.quote(first_template_line)), template)
63
+ end
64
+
65
+ def multirepo_enabled_dependencies
66
+ ConfigFile.new(".").load_entries.select { |e| Utils.is_multirepo_enabled(e.repo.path) }
67
+ end
68
+
69
+ def validate_only_one_flag(*flags)
70
+ flags.reduce(0) { |count, flag| count += 1 if flag; count } <= 1
71
+ end
72
+
73
+ def ensure_in_work_tree
74
+ repo = Repo.new(".")
75
+ raise MultiRepoException, "Not a git repository" unless repo.exists?
76
+ raise MultiRepoException, "HEAD is unborn (you must perform at least one commit)" unless repo.head_born?
77
+ end
78
+
79
+ def ensure_multirepo_enabled
80
+ raise MultiRepoException, "multirepo is not initialized in this repository." unless Utils.is_multirepo_enabled(".")
81
+ end
82
+
83
+ def ensure_multirepo_tracked
84
+ raise MultiRepoException, "Revision is not tracked by multirepo." unless Utils.is_multirepo_tracked(".")
85
+
86
+ lock_file_valid = LockFile.new(".").validate!
87
+ raise MultiRepoException, "Revision is multirepo-enabled but contains a corrupted lock file!" unless lock_file_valid
88
+ end
89
+ end
76
90
  end