summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Livingston <zacl@codeaurora.org>2017-06-16 08:56:09 -0600
committerDavid Pursehouse <dpursehouse@collab.net>2017-08-25 00:00:02 +0000
commite43322625a423c2dc7aa8b0648c172ccbe7aefa7 (patch)
tree3ae70681f8fd7ec0f30ca5a98690e8c5aba44e26
parentc94d6eb90233421b431adbd5a01b7ec24729a285 (diff)
downloadgit-repo-e43322625a423c2dc7aa8b0648c172ccbe7aefa7.tar.gz
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
-rw-r--r--project.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/project.py b/project.py
index 0b7baeed..6b1535a2 100644
--- a/project.py
+++ b/project.py
@@ -1285,7 +1285,7 @@ class Project(object):
1285 1285
1286 need_to_fetch = not (optimized_fetch and 1286 need_to_fetch = not (optimized_fetch and
1287 (ID_RE.match(self.revisionExpr) and 1287 (ID_RE.match(self.revisionExpr) and
1288 self._CheckForSha1())) 1288 self._CheckForImmutableRevision()))
1289 if (need_to_fetch and 1289 if (need_to_fetch and
1290 not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir, 1290 not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir,
1291 current_branch_only=current_branch_only, 1291 current_branch_only=current_branch_only,
@@ -1895,7 +1895,7 @@ class Project(object):
1895 1895
1896 1896
1897# Direct Git Commands ## 1897# Direct Git Commands ##
1898 def _CheckForSha1(self): 1898 def _CheckForImmutableRevision(self):
1899 try: 1899 try:
1900 # if revision (sha or tag) is not present then following function 1900 # if revision (sha or tag) is not present then following function
1901 # throws an error. 1901 # throws an error.
@@ -1949,7 +1949,9 @@ class Project(object):
1949 tag_name = self.revisionExpr[len(R_TAGS):] 1949 tag_name = self.revisionExpr[len(R_TAGS):]
1950 1950
1951 if is_sha1 or tag_name is not None: 1951 if is_sha1 or tag_name is not None:
1952 if self._CheckForSha1(): 1952 if self._CheckForImmutableRevision():
1953 print('Skipped fetching project %s (already have persistent ref)'
1954 % self.name)
1953 return True 1955 return True
1954 if is_sha1 and not depth: 1956 if is_sha1 and not depth:
1955 # When syncing a specific commit and --depth is not set: 1957 # When syncing a specific commit and --depth is not set:
@@ -2105,7 +2107,7 @@ class Project(object):
2105 # We just synced the upstream given branch; verify we 2107 # We just synced the upstream given branch; verify we
2106 # got what we wanted, else trigger a second run of all 2108 # got what we wanted, else trigger a second run of all
2107 # refs. 2109 # refs.
2108 if not self._CheckForSha1(): 2110 if not self._CheckForImmutableRevision():
2109 if current_branch_only and depth: 2111 if current_branch_only and depth:
2110 # Sync the current branch only with depth set to None 2112 # Sync the current branch only with depth set to None
2111 return self._RemoteFetch(name=name, 2113 return self._RemoteFetch(name=name,