git-multirepo 1.0.0.beta77 → 78.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -2
- data/README.md +22 -18
- data/lib/multirepo/commands/checkout-command.rb +6 -6
- data/lib/multirepo/commands/merge-command.rb +9 -7
- data/lib/multirepo/info.rb +1 -1
- data/lib/multirepo/logic/revision-selector.rb +4 -4
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67bba471cade171734f7f9b6bdf68fc214d77d94117d91c4935d00db73547dde
|
4
|
+
data.tar.gz: 387d7fcd24da4d5d0880687987cd7728919b1dbbadfc2070fc59052a67624eec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d050eafad731d9f704975b8612364a2569152662fa9df35fea45bba821276435c841cae7f1ea81ea146c6ddd85f423b9ee4c9d78ef018ac844946e778af8c778
|
7
|
+
data.tar.gz: d384043a504f629792474fd179f91a162aa12637d5d4a25d5984f23654607a689c7c7d6f2d42644f6bc54b89882500ac2bb30c140d1d7aa2c3643d893040a530
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,13 @@
|
|
1
|
-
|
1
|
+
# Releases
|
2
2
|
|
3
|
-
|
3
|
+
## 78.0
|
4
|
+
|
5
|
+
The first official release! 🎉
|
6
|
+
|
7
|
+
Most kinks have been ironed out by now. There are no major known issues.
|
8
|
+
|
9
|
+
- **Enhancement:** Use the (removed) `--exact` flag's behaviour by default for `merge` and `checkout`. To get the old default behaviour (checking out exact commits as stored in the lock file), use `--as-lock`.
|
10
|
+
- **Enhancement:** The `merge` command merges without opening an editor by default. Use `--edit` to open an editor for each merge operation as before.
|
4
11
|
|
5
12
|
## 1.0.0.beta77
|
6
13
|
|
data/README.md
CHANGED
@@ -16,27 +16,27 @@ You can download a handy cheat sheet [here](https://github.com/fortinmike/git-mu
|
|
16
16
|
|
17
17
|
git-multirepo is distributed as a Ruby Gem.
|
18
18
|
|
19
|
-
$ gem install git-multirepo
|
19
|
+
$ gem install git-multirepo
|
20
20
|
|
21
21
|
The `--pre` flag is necessary to install beta releases.
|
22
22
|
|
23
23
|
## Development
|
24
24
|
|
25
25
|
1. Install dependencies with `bundle install` (install the `bundler` gem beforehand if necessary)
|
26
|
-
2. Run `rake install` to build and install the tool locally
|
26
|
+
2. Run `rake install` to build and install the tool locally (`sudo` might be required based on how your Ruby was installed)
|
27
27
|
3. Run it using the command `multi`
|
28
28
|
|
29
29
|
## Motivation
|
30
30
|
|
31
|
-
|
31
|
+
The
|
32
32
|
[pitfalls](http://somethingsinistral.net/blog/git-submodules-are-probably-not-the-answer/)
|
33
33
|
of git submodules are
|
34
34
|
[pretty](https://codingkilledthecat.wordpress.com/2012/04/28/why-your-company-shouldnt-use-git-submodules/)
|
35
35
|
[well](http://slopjong.de/2013/06/04/git-why-submodules-are-evil/)
|
36
36
|
[known](http://stackoverflow.com/questions/12075809/git-submodules-workflow-issues).
|
37
|
-
They work when your dependencies are linearly-evolving third-party libraries that you seldom update but they fall apart when it comes to managing your own, constantly evolving dependencies.
|
37
|
+
They work when your dependencies are linearly-evolving third-party libraries that you seldom update but they fall apart when it comes to managing your own, constantly evolving dependencies. To solve this, many tools have been created. Among the most popular is [Lerna](https://lerna.js.org) but that only works for JavaScript projets and requires projects to migrate to a monorepo. `git-multirepo` works with separate repos and is language-agnostic.
|
38
38
|
|
39
|
-
Git subtrees are
|
39
|
+
Git subtrees are a recommended approach, but they have pitfalls of their own:
|
40
40
|
|
41
41
|
- They require verbose and error-prone command-line operations. This can become quite tedious when managing more than one or two dependencies.
|
42
42
|
- They change the rules of the game when it comes to merges.
|
@@ -48,7 +48,7 @@ Etc.
|
|
48
48
|
|
49
49
|
## Overview
|
50
50
|
|
51
|
-
Using git-multirepo, you can manage your main project and its dependencies as completely independent repositories while still maintaining the ability to checkout a previous revision in a single step and have the project build properly.
|
51
|
+
Using git-multirepo, you can manage your main project and its dependencies as completely independent repositories while still maintaining the ability to checkout a previous revision (or another branch) in a single step and have the project build properly.
|
52
52
|
|
53
53
|
A git-multirepo setup looks like this:
|
54
54
|
|
@@ -62,9 +62,9 @@ MyAwesomeProject
|
|
62
62
|
In essence:
|
63
63
|
|
64
64
|
1. You tell git-multirepo what your dependencies are.
|
65
|
-
2. Each time you commit the main repo, git-multirepo tracks what revision of each dependency is required by the project (
|
65
|
+
2. Each time you commit the main repo, git-multirepo tracks what revision of each dependency is required by the project (and it ensures that you don't forget to commit changes to dependencies beforehand; more on that later).
|
66
66
|
3. If you ever want to go back to a previous version of your project, git-multirepo handles checking out the main repo and appropriate revisions of all of its dependencies in a single, seamless operation.
|
67
|
-
4. Setting up the project on a new machine is only a single `multi clone` away.
|
67
|
+
4. Setting up the project on a new machine is only a single `multi clone` away. Checking out source for continuous integration is similarly easy.
|
68
68
|
|
69
69
|
## Example
|
70
70
|
|
@@ -106,16 +106,18 @@ If you want to stop using git-multirepo, run `multi uninit`. This will remove al
|
|
106
106
|
- Low possibility of human error (such as forgetting to contribute changes to dependencies back to the appropriate remotes, forgetting to commit dependencies in the proper order, etc.)
|
107
107
|
- You're not stuck with git-multirepo. It stores its metadata as [YAML](http://www.yaml.org) in the main repo. You can clone and checkout appropriate revisions of your dependencies by hand without git-multirepo if you need to. The information is there, in human-readable form.
|
108
108
|
|
109
|
-
| How It Handles... |
|
110
|
-
| -------------------------------- |
|
111
|
-
| Working Copy |
|
112
|
-
| Constantly Evolving Dependencies |
|
113
|
-
| Merging Changes to Dependencies |
|
114
|
-
| Contributing Upstream |
|
115
|
-
| Continuous Integration |
|
116
|
-
| Branch-Based Workflows |
|
109
|
+
| How It Handles... | git-multirepo | git submodules | git subtrees |
|
110
|
+
| -------------------------------- | :----------------: | :------------: | :----------: |
|
111
|
+
| Working Copy | beside main repo | in main repo | in main repo |
|
112
|
+
| Constantly Evolving Dependencies | easy | hard | passable |
|
113
|
+
| Merging Changes to Dependencies | easy | hard | passable |
|
114
|
+
| Contributing Upstream | easy | easy | passable |
|
115
|
+
| Continuous Integration | medium<sup>1</sup> | medium | easy |
|
116
|
+
| Branch-Based Workflows | easy<sup>2</sup> | hard | easy |
|
117
117
|
|
118
|
-
(
|
118
|
+
(1) For simplified checkouts, you must install and use `git-multirepo` in your CI pipeline, otherwise you forgo the benefits it provides for CI. See [Continuous Integration](#continuous-integration) for details.
|
119
|
+
|
120
|
+
(2) The `multi branch` and `multi merge` commands faciliate branching and merging the main repo and its dependencies as a whole.
|
119
121
|
|
120
122
|
## Limitations
|
121
123
|
|
@@ -141,10 +143,12 @@ After repositories are initialized this way, git-multirepo handles the rest and
|
|
141
143
|
|
142
144
|
## Continuous Integration
|
143
145
|
|
146
|
+
<a href="#continuous-integration"></a>
|
147
|
+
|
144
148
|
git-multirepo supports continuous integration in a couple of ways:
|
145
149
|
|
146
150
|
- The `install` command has a special `--ci` flag, which:
|
147
|
-
- Installs exact revisions of dependencies in-place
|
151
|
+
- Installs exact revisions of dependencies in-place (as read from the lock file)
|
148
152
|
- Skips local hooks installation
|
149
153
|
- Logs additional information that's useful in a CI context
|
150
154
|
- The `inspect` command offers plumbing-style output that can be used to inspect repositories to conditionally perform multirepo operations on them afterwards.
|
@@ -12,8 +12,8 @@ module MultiRepo
|
|
12
12
|
def self.options
|
13
13
|
[
|
14
14
|
['<refname>', 'The main repo tag, branch or commit id to checkout.'],
|
15
|
-
['[--latest]', 'Checkout the HEAD of each dependency branch (as recorded in the lock file) instead of the exact
|
16
|
-
['[--
|
15
|
+
['[--latest]', 'Checkout the HEAD of each dependency branch (as recorded in the lock file) instead of the exact stored commits.'],
|
16
|
+
['[--as-lock]', 'Checkout the exact commits for each repo based on the lock file, in detached head state.'],
|
17
17
|
['[--force]', 'Force checkout even if there are uncommmitted changes.']
|
18
18
|
].concat(super)
|
19
19
|
end
|
@@ -21,7 +21,7 @@ module MultiRepo
|
|
21
21
|
def initialize(argv)
|
22
22
|
@ref_name = argv.shift_argument
|
23
23
|
@checkout_latest = argv.flag?("latest")
|
24
|
-
@
|
24
|
+
@checkout_lock = argv.flag?("as-lock")
|
25
25
|
@force = argv.flag?("force")
|
26
26
|
super
|
27
27
|
end
|
@@ -29,8 +29,8 @@ module MultiRepo
|
|
29
29
|
def validate!
|
30
30
|
super
|
31
31
|
help! "You must specify a branch or commit id to checkout" unless @ref_name
|
32
|
-
unless Utils.only_one_true?(@checkout_latest, @
|
33
|
-
help! "You can't provide more than one operation modifier (--latest, --
|
32
|
+
unless Utils.only_one_true?(@checkout_latest, @checkout_lock)
|
33
|
+
help! "You can't provide more than one operation modifier (--latest, --as-lock, etc.)"
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -38,7 +38,7 @@ module MultiRepo
|
|
38
38
|
ensure_in_work_tree
|
39
39
|
|
40
40
|
# Find out the checkout mode based on command-line options
|
41
|
-
mode = RevisionSelector.mode_for_args(@checkout_latest, @
|
41
|
+
mode = RevisionSelector.mode_for_args(@checkout_latest, @checkout_lock)
|
42
42
|
|
43
43
|
strategy_name = RevisionSelection.name_for_mode(mode)
|
44
44
|
Console.log_step("Checking out #{@ref_name} and its dependencies using the '#{strategy_name}' strategy...")
|
@@ -28,15 +28,17 @@ module MultiRepo
|
|
28
28
|
[
|
29
29
|
['<refname>', 'The main repo tag, branch or commit id to merge.'],
|
30
30
|
['[--latest]', 'Merge the HEAD of each stored dependency branch instead of the commits recorded in the lock file.'],
|
31
|
-
['[--
|
32
|
-
['[--
|
31
|
+
['[--as-lock]', 'Merge the exact specified commits for each repo, as stored in the lock file.'],
|
32
|
+
['[--edit]', 'Open an editor to edit the commit message for each merge operation.'],
|
33
|
+
['[--ff]', 'Perform a fast-forward if possible.']
|
33
34
|
].concat(super)
|
34
35
|
end
|
35
36
|
|
36
37
|
def initialize(argv)
|
37
38
|
@ref_name = argv.shift_argument
|
38
39
|
@checkout_latest = argv.flag?("latest")
|
39
|
-
@
|
40
|
+
@checkout_lock = argv.flag?("as-lock")
|
41
|
+
@edit = argv.flag?("edit")
|
40
42
|
@fast_forward = argv.flag?("ff")
|
41
43
|
super
|
42
44
|
end
|
@@ -44,8 +46,8 @@ module MultiRepo
|
|
44
46
|
def validate!
|
45
47
|
super
|
46
48
|
help! "You must specify a ref to merge" unless @ref_name
|
47
|
-
unless Utils.only_one_true?(@checkout_latest, @
|
48
|
-
help! "You can't provide more than one operation modifier (--latest, --
|
49
|
+
unless Utils.only_one_true?(@checkout_latest, @checkout_lock)
|
50
|
+
help! "You can't provide more than one operation modifier (--latest, --as-lock, etc.)"
|
49
51
|
end
|
50
52
|
end
|
51
53
|
|
@@ -54,7 +56,7 @@ module MultiRepo
|
|
54
56
|
ensure_multirepo_enabled
|
55
57
|
|
56
58
|
# Find out the checkout mode based on command-line options
|
57
|
-
mode = RevisionSelector.mode_for_args(@checkout_latest, @
|
59
|
+
mode = RevisionSelector.mode_for_args(@checkout_latest, @checkout_lock)
|
58
60
|
|
59
61
|
strategy_name = RevisionSelection.name_for_mode(mode)
|
60
62
|
Console.log_step("Merging #{@ref_name} with '#{strategy_name}' strategy...")
|
@@ -212,7 +214,7 @@ module MultiRepo
|
|
212
214
|
success = true
|
213
215
|
descriptors.each do |descriptor|
|
214
216
|
Console.log_substep("#{descriptor.name} : Merging #{descriptor.their_revision} into #{descriptor.our_revision}...")
|
215
|
-
GitRunner.run_as_system(descriptor.repo.path, "merge #{descriptor.their_revision}#{@fast_forward ? '' : ' --no-ff'}")
|
217
|
+
GitRunner.run_as_system(descriptor.repo.path, "merge #{descriptor.their_revision}#{@edit ? '' : ' --no-edit'}#{@fast_forward ? '' : ' --no-ff'}")
|
216
218
|
success &= GitRunner.last_command_succeeded
|
217
219
|
end
|
218
220
|
|
data/lib/multirepo/info.rb
CHANGED
@@ -2,13 +2,13 @@ require_relative "revision-selection"
|
|
2
2
|
|
3
3
|
module MultiRepo
|
4
4
|
class RevisionSelector
|
5
|
-
def self.mode_for_args(checkout_latest,
|
5
|
+
def self.mode_for_args(checkout_latest, checkout_lock)
|
6
6
|
if checkout_latest
|
7
7
|
RevisionSelection::LATEST
|
8
|
-
elsif
|
9
|
-
RevisionSelection::EXACT
|
10
|
-
else
|
8
|
+
elsif checkout_lock
|
11
9
|
RevisionSelection::AS_LOCK
|
10
|
+
else
|
11
|
+
RevisionSelection::EXACT
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
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:
|
4
|
+
version: '78.0'
|
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:
|
11
|
+
date: 2020-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -219,9 +219,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
219
219
|
version: '2.0'
|
220
220
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
221
221
|
requirements:
|
222
|
-
- - "
|
222
|
+
- - ">="
|
223
223
|
- !ruby/object:Gem::Version
|
224
|
-
version:
|
224
|
+
version: '0'
|
225
225
|
requirements: []
|
226
226
|
rubygems_version: 3.0.3
|
227
227
|
signing_key:
|