summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
authorKris Giesing <kgiesing@google.com>2014-12-23 13:02:32 -0800
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2014-12-24 10:23:24 +0900
commitc8d882ae2a75c732ef590ef425a3039b8b04403e (patch)
tree5fe47787c3ce15fdd8cb342251dc086b19d42b25 /project.py
parent3eb87cec5cae5f43becfe9fd1ff94de855cac08c (diff)
downloadgit-repo-c8d882ae2a75c732ef590ef425a3039b8b04403e.tar.gz
Silence warnings about invalid clone.bundle files when quieted
The invalid clone.bundle file warning is not typically user actionable, and can be confusing. So don't show it when -q flag is in effect. Change-Id: If9fef4085391acf54b63c75029ec0e161c38eb86
Diffstat (limited to 'project.py')
-rw-r--r--project.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/project.py b/project.py
index cdce1e84..339f1a14 100644
--- a/project.py
+++ b/project.py
@@ -1973,7 +1973,7 @@ class Project(object):
1973 return False 1973 return False
1974 1974
1975 if os.path.exists(tmpPath): 1975 if os.path.exists(tmpPath):
1976 if curlret == 0 and self._IsValidBundle(tmpPath): 1976 if curlret == 0 and self._IsValidBundle(tmpPath, quiet):
1977 os.rename(tmpPath, dstPath) 1977 os.rename(tmpPath, dstPath)
1978 return True 1978 return True
1979 else: 1979 else:
@@ -1982,13 +1982,14 @@ class Project(object):
1982 else: 1982 else:
1983 return False 1983 return False
1984 1984
1985 def _IsValidBundle(self, path): 1985 def _IsValidBundle(self, path, quiet):
1986 try: 1986 try:
1987 with open(path) as f: 1987 with open(path) as f:
1988 if f.read(16) == '# v2 git bundle\n': 1988 if f.read(16) == '# v2 git bundle\n':
1989 return True 1989 return True
1990 else: 1990 else:
1991 print("Invalid clone.bundle file; ignoring.", file=sys.stderr) 1991 if not quiet:
1992 print("Invalid clone.bundle file; ignoring.", file=sys.stderr)
1992 return False 1993 return False
1993 except OSError: 1994 except OSError:
1994 return False 1995 return False