mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Print a message when fetching is skipped for an immutable ref
The output indicates that fetching happens even when it is skipped. To avoid confusion, print a message when fetching is skipped for an immutable ref so that the user knows when and why a fetch is skipped. Change-Id: Id6e4812cebc5e57d379feb76a9d034af0b93043b
This commit is contained in:
parent
c94d6eb902
commit
e43322625a
10
project.py
10
project.py
@ -1285,7 +1285,7 @@ class Project(object):
|
|||||||
|
|
||||||
need_to_fetch = not (optimized_fetch and
|
need_to_fetch = not (optimized_fetch and
|
||||||
(ID_RE.match(self.revisionExpr) and
|
(ID_RE.match(self.revisionExpr) and
|
||||||
self._CheckForSha1()))
|
self._CheckForImmutableRevision()))
|
||||||
if (need_to_fetch and
|
if (need_to_fetch and
|
||||||
not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir,
|
not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir,
|
||||||
current_branch_only=current_branch_only,
|
current_branch_only=current_branch_only,
|
||||||
@ -1895,7 +1895,7 @@ class Project(object):
|
|||||||
|
|
||||||
|
|
||||||
# Direct Git Commands ##
|
# Direct Git Commands ##
|
||||||
def _CheckForSha1(self):
|
def _CheckForImmutableRevision(self):
|
||||||
try:
|
try:
|
||||||
# if revision (sha or tag) is not present then following function
|
# if revision (sha or tag) is not present then following function
|
||||||
# throws an error.
|
# throws an error.
|
||||||
@ -1949,7 +1949,9 @@ class Project(object):
|
|||||||
tag_name = self.revisionExpr[len(R_TAGS):]
|
tag_name = self.revisionExpr[len(R_TAGS):]
|
||||||
|
|
||||||
if is_sha1 or tag_name is not None:
|
if is_sha1 or tag_name is not None:
|
||||||
if self._CheckForSha1():
|
if self._CheckForImmutableRevision():
|
||||||
|
print('Skipped fetching project %s (already have persistent ref)'
|
||||||
|
% self.name)
|
||||||
return True
|
return True
|
||||||
if is_sha1 and not depth:
|
if is_sha1 and not depth:
|
||||||
# When syncing a specific commit and --depth is not set:
|
# When syncing a specific commit and --depth is not set:
|
||||||
@ -2105,7 +2107,7 @@ class Project(object):
|
|||||||
# We just synced the upstream given branch; verify we
|
# We just synced the upstream given branch; verify we
|
||||||
# got what we wanted, else trigger a second run of all
|
# got what we wanted, else trigger a second run of all
|
||||||
# refs.
|
# refs.
|
||||||
if not self._CheckForSha1():
|
if not self._CheckForImmutableRevision():
|
||||||
if current_branch_only and depth:
|
if current_branch_only and depth:
|
||||||
# Sync the current branch only with depth set to None
|
# Sync the current branch only with depth set to None
|
||||||
return self._RemoteFetch(name=name,
|
return self._RemoteFetch(name=name,
|
||||||
|
Loading…
Reference in New Issue
Block a user