Catch and print OSError instead of Exception.

Also open the altfile with 'w' because we assume ownership over the object
alternates. The logic to correctly support other alternates would be quite
complex, so don't even imply support.

R=maruel@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/19777004

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@212426 0039d316-1c4b-4281-b951-d872f2087c98
experimental/szager/collated-output
iannucci@chromium.org 12 years ago
parent f3ec5784d3
commit 578e5e548f

@ -761,7 +761,7 @@ class GitWrapper(SCMWrapper):
if self.cache_dir: if self.cache_dir:
if not os.path.exists(altfile): if not os.path.exists(altfile):
try: try:
with open(altfile, 'wa') as f: with open(altfile, 'w') as f:
f.write(os.path.join(url, 'objects')) f.write(os.path.join(url, 'objects'))
# pylint: disable=C0301 # pylint: disable=C0301
# This dance is necessary according to emperical evidence, also at: # This dance is necessary according to emperical evidence, also at:
@ -773,8 +773,8 @@ class GitWrapper(SCMWrapper):
# this path again next time. # this path again next time.
try: try:
os.remove(altfile) os.remove(altfile)
except Exception: except OSError as e:
pass print >> sys.stderr, "FAILED: os.remove('%s') -> %s" % (altfile, e)
raise raise
else: else:
if os.path.exists(altfile): if os.path.exists(altfile):

Loading…
Cancel
Save