-
Notifications
You must be signed in to change notification settings - Fork 277
/
Copy pathhelp-functions.bash
339 lines (233 loc) · 12 KB
/
help-functions.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
#!/usr/bin/env bash
# DO NOT EDIT. This file generated by pkg/bin/generate-help-functions.pl.
set -e
help:all() {
cat <<'...'
branch branch <subdir>|--all [-f] [-F]
clean clean <subdir>|--all|--ALL [-f]
clone clone <repository> [<subdir>] [-b <branch>] [-f] [-m <msg>] [--file=<msg file>] [-e] [--method <merge|rebase>]
commit commit <subdir> [<subrepo-ref>] [-m <msg>] [--file=<msg file>] [-e] [-f] [-F]
config config <subdir> <option> [<value>] [-f]
fetch fetch <subdir>|--all [-r <remote>] [-b <branch>]
help help [<command>|--all]
init init <subdir> [-r <remote>] [-b <branch>] [--method <merge|rebase>]
pull pull <subdir>|--all [-M|-R|-f] [-m <msg>] [--file=<msg file>] [-e] [-b <branch>] [-r <remote>] [-u]
push push <subdir>|--all [<branch>] [-m msg] [--file=<msg file>] [-r <remote>] [-b <branch>] [-M|-R] [-u] [-f] [-s] [-N]
status status [<subdir>|--all|--ALL] [-F] [-q|-v]
upgrade upgrade
version version [-q|-v]
...
}
help:branch() {
cat <<'...'
Usage: git subrepo branch <subdir>|--all [-f] [-F]
Create a branch with local subrepo commits.
Scan the history of the mainline for all the commits that affect the `subdir`
and create a new branch from them called `subrepo/<subdir>`.
This is useful for doing `pull` and `push` commands by hand.
Use the `--force` option to write over an existing `subrepo/<subdir>` branch.
The `branch` command accepts the `--all`, `--fetch` and `--force` options.
...
}
help:clean() {
cat <<'...'
Usage: git subrepo clean <subdir>|--all|--ALL [-f]
Remove artifacts created by `fetch` and `branch` commands.
The `fetch` and `branch` operations (and other commands that call them)
create temporary things like refs, branches and remotes. This command
removes all those things.
Use `--force` to remove refs. Refs are not removed by default because they
are sometimes needed between commands.
Use `--all` to clean up after all the current subrepos. Sometimes you might
change to a branch where a subrepo doesn't exist, and then `--all` won't find
it. Use `--ALL` to remove any artifacts that were ever created by subrepo.
To remove ALL subrepo artifacts:
git subrepo clean --ALL --force
The `clean` command accepts the `--all`, `--ALL`, and `--force` options.
...
}
help:clone() {
cat <<'...'
Usage: git subrepo clone <repository> [<subdir>] [-b <branch>] [-f] [-m <msg>] [--file=<msg file>] [-e] [--method <merge|rebase>]
Add a repository as a subrepo in a subdir of your repository.
This is similar in feel to `git clone`. You just specify the remote repo
url, and optionally a sub-directory and/or branch name. The repo will be
fetched and merged into the subdir.
The subrepo history is /squashed/ into a single commit that contains the
reference information. This information is also stored in a special file
called `<subdir>/.gitrepo`. The presence of this file indicates that the
directory is a subrepo.
All subsequent commands refer to the subrepo by the name of the /subdir/.
From the subdir, all the current information about the subrepo can be
obtained.
The `--force` option will "reclone" (completely replace) an existing subdir.
The `--method` option will decide how the join process between branches are
performed. The default option is merge.
The `clone` command accepts the `--branch=` `--edit`, `--file`, `--force`
and `--message=` options.
...
}
help:commit() {
cat <<'...'
Usage: git subrepo commit <subdir> [<subrepo-ref>] [-m <msg>] [--file=<msg file>] [-e] [-f] [-F]
Add subrepo branch to current history as a single commit.
This command is generally used after a hand-merge. You have done a `subrepo
branch` and merged (rebased) it with the upstream. This command takes the
HEAD of that branch, puts its content into the subrepo subdir and adds a new
commit for it to the top of your mainline history.
This command requires that the upstream HEAD be in the `subrepo/<subdir>`
branch history. That way the same branch can push upstream. Use the
`--force` option to commit anyway.
The `commit` command accepts the `--edit`, `--fetch`, `--file`, `--force`
and `--message=` options.
...
}
help:config() {
cat <<'...'
Usage: git subrepo config <subdir> <option> [<value>] [-f]
Read or update configuration values in the subdir/.gitrepo file.
Because most of the values stored in the .gitrepo file are generated you
will need to use `--force` if you want to change anything else then the
`method` option.
Example to update the `method` option for a subrepo:
git subrepo config foo method rebase
...
}
help:fetch() {
cat <<'...'
Usage: git subrepo fetch <subdir>|--all [-r <remote>] [-b <branch>] [--commit=<commit-hash>]
Fetch the remote/upstream content for a subrepo.
It will create a Git reference called `subrepo/<subdir>/fetch` that points at
the same commit as `FETCH_HEAD`. It will also create a remote called
`subrepo/<subdir>`. These are temporary and you can easily remove them with
the subrepo `clean` command.
The `fetch` command accepts the `--all`, `--branch=`, `--commit=`, and `--remote=` options.
...
}
help:help() {
cat <<'...'
Usage: git subrepo help [<command>|--all]
Same as `git help subrepo`. Will launch the manpage. For the shorter usage,
use `git subrepo -h`.
Use `git subrepo help <command>` to get help for a specific command. Use
`--all` to get a summary of all commands.
The `help` command accepts the `--all` option.
...
}
help:init() {
cat <<'...'
Usage: git subrepo init <subdir> [-r <remote>] [-b <branch>] [--method <merge|rebase>]
Turn an existing subdirectory into a subrepo.
If you want to expose a subdirectory of your project as a published subrepo,
this command will do that. It will split out the content of a normal
subdirectory into a branch and start tracking it as a subrepo. Afterwards
your original repo will look exactly the same except that there will be a
`<subdir>/.gitrepo` file.
If you specify the `--remote` (and optionally the `--branch`) option, the
values will be added to the `<subdir>/.gitrepo` file. The `--remote` option
is the upstream URL, and the `--branch` option is the upstream branch to push
to. These values will be needed to do a `git subrepo push` command, but they
can be provided later on the `push` command (and saved to `<subdir>/.gitrepo`
if you also specify the `--update` option).
Note: You will need to create the empty upstream repo and push to it on your
own, using `git subrepo push <subdir>`.
The `--method` option will decide how the join process between branches
are performed. The default option is merge.
The `init` command accepts the `--branch=` and `--remote=` options.
...
}
help:pull() {
cat <<'...'
Usage: git subrepo pull <subdir>|--all [-M|-R|-f] [-m <msg>] [--file=<msg file>] [-e] [-b <branch>] [-r <remote>] [-u] [--commit=<commit-hash>]
Update the subrepo subdir with the latest upstream changes.
The `pull` command fetches the latest content from the remote branch pointed
to by the subrepo's `.gitrepo` file, and then tries to merge the changes into
the corresponding subdir. It does this by making a branch of the local
commits to the subdir and then merging or rebasing (see below) it with the
fetched upstream content. After the merge, the content of the new branch
replaces your subdir, the `.gitrepo` file is updated and a single 'pull'
commit is added to your mainline history.
The `pull` command will attempt to do the following commands in one go:
git subrepo fetch <subdir>
git subrepo branch <subdir>
git merge/rebase subrepo/<subdir>/fetch subrepo/<subdir>
git subrepo commit <subdir>
# Only needed for a consequential push:
git update-ref refs/subrepo/<subdir>/pull subrepo/<subdir>
In other words, you could do all the above commands yourself, for the same
effect. If any of the commands fail, subrepo will stop and tell you to finish
this by hand. Generally a failure would be in the merge or rebase part, where
conflicts can happen. Since Git has lots of ways to resolve conflicts to your
personal tastes, the subrepo command defers to letting you do this by hand.
When pulling new data, the method selected in clone/init is used. This has
no effect on the final result of the pull, since it becomes a single commit.
But it does affect the resulting `subrepo/<subdir>` branch, which is often
used for a subrepo `push` command. See 'push' below for more information.
If you want to change the method you can use the `config` command for this.
When you pull you can assume a fast-forward strategy (default) or you can
specify a `--rebase`, `--merge` or `--force` strategy. The latter is the same
as a `clone --force` operation, using the current remote and branch.
Like the `clone` command, `pull` will squash all the changes (since the last
pull or clone) into one commit. This keeps your mainline history nice and
clean. You can easily see the subrepo's history with the `git log` command:
git log refs/subrepo/<subdir>/fetch
The set of commands used above are described in detail below.
The `pull` command accepts the `--all`, `--branch=`, `--commit=`, `--edit`, `--file`,
`--force`, `--message=`, `--remote=` and `--update` options.
...
}
help:push() {
cat <<'...'
Usage: git subrepo push <subdir>|--all [<branch>] [-m msg] [--file=<msg file>] [-r <remote>] [-b <branch>] [-M|-R] [-u] [-f] [-s] [-N]
Push a properly merged subrepo branch back upstream.
This command takes the subrepo branch from a successful pull command and
pushes the history back to its designated remote and branch. You can also use
the `branch` command and merge things yourself before pushing if you want to
(although that is probably a rare use case).
The `push` command requires a branch that has been properly merged/rebased
with the upstream HEAD (unless the upstream HEAD is empty, which is common
when doing a first `push` after an `init`). That means the upstream HEAD is
one of the commits in the branch.
By default the branch ref `refs/subrepo/<subdir>/pull` will be pushed, but
you can specify a (properly merged) branch to push.
After that, the `push` command just checks that the branch contains the
upstream HEAD and then pushes it upstream.
The `--force` option will do a force push. Force pushes are typically
discouraged. Only use this option if you fully understand it. (The `--force`
option will NOT check for a proper merge. ANY branch will be force pushed!)
The `push` command accepts the `--all`, `--branch=`, `--dry-run`, `--file`,
`--force`, `--merge`, `--message`, `--rebase`, `--remote=`, `--squash` and
`--update` options.
...
}
help:status() {
cat <<'...'
Usage: git subrepo status [<subdir>|--all|--ALL] [-F] [-q|-v]
Get the status of a subrepo. Uses the `--all` option by default. If the
`--quiet` flag is used, just print the subrepo names, one per line.
The `--verbose` option will show all the recent local and upstream commits.
Use `--ALL` to show the subrepos of the subrepos (ie the "subsubrepos"), if
any.
The `status` command accepts the `--all`, `--ALL`, `--fetch`, `--quiet` and
`--verbose` options.
...
}
help:upgrade() {
cat <<'...'
Usage: git subrepo upgrade
Upgrade the `git-subrepo` software itself. This simply does a `git pull` on
the git repository that the code is running from. It only works if you are on
the `master` branch. It won't work if you installed `git-subrepo` using `make
install`; in that case you'll need to `make install` from the latest code.
...
}
help:version() {
cat <<'...'
Usage: git subrepo version [-q|-v]
This command will display version information about git-subrepo and its
environment. For just the version number, use `git subrepo --version`. Use
`--verbose` for more version info, and `--quiet` for less.
The `version` command accepts the `--quiet` and `--verbose` options.
...
}
# vim: set sw=2 lisp: