Compare commits

..

4 Commits

Author SHA1 Message Date
b750b48f50 init: add --manifest-depth for shallow manifest clone
People rarely care about the history of the manifest repo.  Add a
parameter to specify depth for the manifest.

For now, make the default behavior the same as the current behavior.  At
a future date, the default will be changed to 1.  People who need the
full history should begin passing --manifest-depth=0 to preserve the
behavior when the default changes.

We can't reuse the existing --depth option because that applies to
all projects we clone, not just the manifest repo.

Bug: https://crbug.com/gerrit/16193, https://crbug.com/gerrit/16358
Change-Id: I9130fed3eaed656435c778a85cfe9d04e3a4a6a0
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/349814
Tested-by: LaMont Jones <lamontjones@google.com>
Reviewed-by: Xin Li <delphij@google.com>
2022-10-27 21:59:09 +00:00
6c8b894d8d Revert "init: change --depth default to 1 for manifest repo"
This reverts commit 076d54652e.

Reason for revert: crbug.com/gerrit/16358

Change-Id: I2970eb50677cca69786f71edffe4aa5271cf139f
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/349834
Reviewed-by: Sam Saccone <samccone@google.com>
Tested-by: LaMont Jones <lamontjones@google.com>
Reviewed-by: Xin Li <delphij@google.com>
2022-10-27 21:52:02 +00:00
b6cfa09500 sync: uninitialized variable on mirror sync failure
When repo sync fails, if the workspace is a mirror, an uninitialized
variable is referenced.

Bug: crbug.com/gerrit/16356
Change-Id: I1dba9f92319b9cbfd18460327560a395c88a089f
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/349654
Reviewed-by: Sam Saccone <samccone@google.com>
Reviewed-by: Xin Li <delphij@google.com>
Tested-by: LaMont Jones <lamontjones@google.com>
2022-10-26 23:13:02 +00:00
78dcd3799b sync: do not require python 3.9
Use pre-3.9 syntax for NamedTuple, so that users do not need to have
python 3.9 or later installed.

Bug: b/255632143, crbug.com/gerrit/16355
Test: manually verified with python 3.8
Change-Id: I488d2d5267ed98d5c55c233cc789e629f1911c9d
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/349395
Tested-by: LaMont Jones <lamontjones@google.com>
Reviewed-by: Jonathan Nieder <jrn@google.com>
2022-10-25 22:46:47 +00:00
5 changed files with 23 additions and 13 deletions

View File

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man. .\" DO NOT MODIFY THIS FILE! It was generated by help2man.
.TH REPO "1" "August 2022" "repo gitc-init" "Repo Manual" .TH REPO "1" "October 2022" "repo gitc-init" "Repo Manual"
.SH NAME .SH NAME
repo \- repo gitc-init - manual page for repo gitc-init repo \- repo gitc-init - manual page for repo gitc-init
.SH SYNOPSIS .SH SYNOPSIS
@ -48,7 +48,7 @@ create a git checkout of the manifest repo
.TP .TP
\fB\-\-manifest\-depth\fR=\fI\,DEPTH\/\fR \fB\-\-manifest\-depth\fR=\fI\,DEPTH\/\fR
create a shallow clone of the manifest repo with given create a shallow clone of the manifest repo with given
depth; see git clone (default: 1) depth (0 for full clone); see git clone (default: 0)
.SS Manifest (only) checkout options: .SS Manifest (only) checkout options:
.TP .TP
\fB\-\-current\-branch\fR \fB\-\-current\-branch\fR

View File

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man. .\" DO NOT MODIFY THIS FILE! It was generated by help2man.
.TH REPO "1" "August 2022" "repo init" "Repo Manual" .TH REPO "1" "October 2022" "repo init" "Repo Manual"
.SH NAME .SH NAME
repo \- repo init - manual page for repo init repo \- repo init - manual page for repo init
.SH SYNOPSIS .SH SYNOPSIS
@ -48,7 +48,7 @@ create a git checkout of the manifest repo
.TP .TP
\fB\-\-manifest\-depth\fR=\fI\,DEPTH\/\fR \fB\-\-manifest\-depth\fR=\fI\,DEPTH\/\fR
create a shallow clone of the manifest repo with given create a shallow clone of the manifest repo with given
depth; see git clone (default: 1) depth (0 for full clone); see git clone (default: 0)
.SS Manifest (only) checkout options: .SS Manifest (only) checkout options:
.TP .TP
\fB\-c\fR, \fB\-\-current\-branch\fR \fB\-c\fR, \fB\-\-current\-branch\fR

View File

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man. .\" DO NOT MODIFY THIS FILE! It was generated by help2man.
.TH REPO "1" "July 2022" "repo manifest" "Repo Manual" .TH REPO "1" "October 2022" "repo manifest" "Repo Manual"
.SH NAME .SH NAME
repo \- repo manifest - manual page for repo manifest repo \- repo manifest - manual page for repo manifest
.SH SYNOPSIS .SH SYNOPSIS
@ -190,6 +190,8 @@ CDATA #IMPLIED>
<!ATTLIST extend\-project groups CDATA #IMPLIED> <!ATTLIST extend\-project groups CDATA #IMPLIED>
<!ATTLIST extend\-project revision CDATA #IMPLIED> <!ATTLIST extend\-project revision CDATA #IMPLIED>
<!ATTLIST extend\-project remote CDATA #IMPLIED> <!ATTLIST extend\-project remote CDATA #IMPLIED>
<!ATTLIST extend\-project dest\-branch CDATA #IMPLIED>
<!ATTLIST extend\-project upstream CDATA #IMPLIED>
.IP .IP
<!ELEMENT remove\-project EMPTY> <!ELEMENT remove\-project EMPTY>
<!ATTLIST remove\-project name CDATA #REQUIRED> <!ATTLIST remove\-project name CDATA #REQUIRED>
@ -485,6 +487,12 @@ project. Same syntax as the corresponding element of `project`.
Attribute `remote`: If specified, overrides the remote of the original project. Attribute `remote`: If specified, overrides the remote of the original project.
Same syntax as the corresponding element of `project`. Same syntax as the corresponding element of `project`.
.PP .PP
Attribute `dest\-branch`: If specified, overrides the dest\-branch of the original
project. Same syntax as the corresponding element of `project`.
.PP
Attribute `upstream`: If specified, overrides the upstream of the original
project. Same syntax as the corresponding element of `project`.
.PP
Element annotation Element annotation
.PP .PP
Zero or more annotation elements may be specified as children of a project or Zero or more annotation elements may be specified as children of a project or

5
repo
View File

@ -316,9 +316,10 @@ def InitParser(parser, gitc_init=False):
help='download the manifest as a static file ' help='download the manifest as a static file '
'rather then create a git checkout of ' 'rather then create a git checkout of '
'the manifest repo') 'the manifest repo')
group.add_option('--manifest-depth', type='int', default=1, metavar='DEPTH', group.add_option('--manifest-depth', type='int', default=0, metavar='DEPTH',
help='create a shallow clone of the manifest repo with ' help='create a shallow clone of the manifest repo with '
'given depth; see git clone (default: %default)') 'given depth (0 for full clone); see git clone '
'(default: %default)')
# Options that only affect manifest project, and not any of the projects # Options that only affect manifest project, and not any of the projects
# specified in the manifest itself. # specified in the manifest itself.

View File

@ -26,7 +26,7 @@ import socket
import sys import sys
import tempfile import tempfile
import time import time
from typing import NamedTuple from typing import NamedTuple, List, Set
import urllib.error import urllib.error
import urllib.parse import urllib.parse
import urllib.request import urllib.request
@ -94,19 +94,19 @@ class _FetchResult(NamedTuple):
Attributes: Attributes:
success (bool): True if successful. success (bool): True if successful.
projects (set[str]): The names of the git directories of fetched projects. projects (Set[str]): The names of the git directories of fetched projects.
""" """
success: bool success: bool
projects: set[str] projects: Set[str]
class _FetchMainResult(NamedTuple): class _FetchMainResult(NamedTuple):
"""_FetchMain return value. """_FetchMain return value.
Attributes: Attributes:
all_projects (list[Project]): The fetched projects. all_projects (List[Project]): The fetched projects.
""" """
all_projects: list[Project] all_projects: List[Project]
class _CheckoutOneResult(NamedTuple): class _CheckoutOneResult(NamedTuple):
@ -1277,6 +1277,7 @@ later is required to fix a server side protocol bug.
err_network_sync = False err_network_sync = False
err_update_projects = False err_update_projects = False
err_update_linkfiles = False
self._fetch_times = _FetchTimes(manifest) self._fetch_times = _FetchTimes(manifest)
if not opt.local_only: if not opt.local_only: