diff options
| author | Kaushik Lingarkar <kaushik.lingarkar@linaro.org> | 2024-09-05 15:34:48 -0700 |
|---|---|---|
| committer | LUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2024-09-26 00:52:28 +0000 |
| commit | d7ebdf56be6095338ea37bd4b52533c5bd7774e7 (patch) | |
| tree | e6db62fd873e70bb0453791a69f8772f9d567a0c /subcmds/init.py | |
| parent | fabab4e24527fca9b6b4a0c64607524b1890c609 (diff) | |
| download | git-repo-d7ebdf56be6095338ea37bd4b52533c5bd7774e7.tar.gz | |
init: add --manifest-upstream-branch
When a sha1 is provided to '--manifest-branch', the ref which
is expected to contain that sha1 can be provided using the new
'--manifest-upstream-branch' option. This is useful with
'--current-branch' to avoid having to sync all heads and tags,
or with a commit that comes from a non-head/tag ref (like a
Gerrit change ref).
Change-Id: I46a3e255ca69ed9e809039e58b0c163e02af94ef
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/436717
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Kaushik Lingarkar <kaushik.lingarkar@linaro.org>
Tested-by: Kaushik Lingarkar <kaushik.lingarkar@linaro.org>
Diffstat (limited to 'subcmds/init.py')
| -rw-r--r-- | subcmds/init.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/subcmds/init.py b/subcmds/init.py index 7617bc1f..fb6d3eb5 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
| @@ -52,6 +52,10 @@ The optional -b argument can be used to select the manifest branch | |||
| 52 | to checkout and use. If no branch is specified, the remote's default | 52 | to checkout and use. If no branch is specified, the remote's default |
| 53 | branch is used. This is equivalent to using -b HEAD. | 53 | branch is used. This is equivalent to using -b HEAD. |
| 54 | 54 | ||
| 55 | The optional --manifest-upstream-branch argument can be used when a commit is | ||
| 56 | provided to --manifest-branch (or -b), to specify the name of the git ref in | ||
| 57 | which the commit can be found. | ||
| 58 | |||
| 55 | The optional -m argument can be used to specify an alternate manifest | 59 | The optional -m argument can be used to specify an alternate manifest |
| 56 | to be used. If no manifest is specified, the manifest default.xml | 60 | to be used. If no manifest is specified, the manifest default.xml |
| 57 | will be used. | 61 | will be used. |
| @@ -135,6 +139,7 @@ to update the working directory files. | |||
| 135 | # manifest project is special and is created when instantiating the | 139 | # manifest project is special and is created when instantiating the |
| 136 | # manifest which happens before we parse options. | 140 | # manifest which happens before we parse options. |
| 137 | self.manifest.manifestProject.clone_depth = opt.manifest_depth | 141 | self.manifest.manifestProject.clone_depth = opt.manifest_depth |
| 142 | self.manifest.manifestProject.upstream = opt.manifest_upstream_branch | ||
| 138 | clone_filter_for_depth = ( | 143 | clone_filter_for_depth = ( |
| 139 | "blob:none" if (_REPO_ALLOW_SHALLOW == "0") else None | 144 | "blob:none" if (_REPO_ALLOW_SHALLOW == "0") else None |
| 140 | ) | 145 | ) |
| @@ -317,6 +322,12 @@ to update the working directory files. | |||
| 317 | " be used with --standalone-manifest." | 322 | " be used with --standalone-manifest." |
| 318 | ) | 323 | ) |
| 319 | 324 | ||
| 325 | if opt.manifest_upstream_branch and opt.manifest_branch is None: | ||
| 326 | self.OptionParser.error( | ||
| 327 | "--manifest-upstream-branch cannot be used without " | ||
| 328 | "--manifest-branch." | ||
| 329 | ) | ||
| 330 | |||
| 320 | if args: | 331 | if args: |
| 321 | if opt.manifest_url: | 332 | if opt.manifest_url: |
| 322 | self.OptionParser.error( | 333 | self.OptionParser.error( |
