##// END OF EJS Templates
eliminate various naked except clauses
Idan Kamara -
r14004:97ed99d1 default
parent child Browse files
Show More
@@ -29,7 +29,7 b' def read(repo):'
29 sha, refspec = line.strip().split(' ', 1)
29 sha, refspec = line.strip().split(' ', 1)
30 refspec = encoding.tolocal(refspec)
30 refspec = encoding.tolocal(refspec)
31 bookmarks[refspec] = repo.changelog.lookup(sha)
31 bookmarks[refspec] = repo.changelog.lookup(sha)
32 except:
32 except IOError:
33 pass
33 pass
34 return bookmarks
34 return bookmarks
35
35
@@ -294,7 +294,7 b' def getremotechanges(ui, repo, other, re'
294 if not incoming:
294 if not incoming:
295 try:
295 try:
296 os.unlink(bundlename)
296 os.unlink(bundlename)
297 except:
297 except OSError:
298 pass
298 pass
299 return other, None, None, None
299 return other, None, None, None
300
300
@@ -185,7 +185,7 b' class changelog(revlog.revlog):'
185 try:
185 try:
186 # various tools did silly things with the time zone field.
186 # various tools did silly things with the time zone field.
187 timezone = int(extra_data[0])
187 timezone = int(extra_data[0])
188 except:
188 except ValueError:
189 timezone = 0
189 timezone = 0
190 extra = {}
190 extra = {}
191 else:
191 else:
@@ -293,7 +293,7 b' def addremove(repo, pats=[], opts={}, dr'
293 good = True
293 good = True
294 try:
294 try:
295 audit_path(abs)
295 audit_path(abs)
296 except:
296 except (OSError, util.Abort):
297 good = False
297 good = False
298 rel = m.rel(abs)
298 rel = m.rel(abs)
299 exact = m.exact(abs)
299 exact = m.exact(abs)
@@ -805,7 +805,7 b' class workingctx(changectx):'
805 p = self._repo.wjoin(f)
805 p = self._repo.wjoin(f)
806 try:
806 try:
807 st = os.lstat(p)
807 st = os.lstat(p)
808 except:
808 except OSError:
809 ui.warn(_("%s does not exist!\n") % join(f))
809 ui.warn(_("%s does not exist!\n") % join(f))
810 rejected.append(f)
810 rejected.append(f)
811 continue
811 continue
@@ -133,7 +133,7 b' def _runcatch(ui, args):'
133 elif hasattr(inst, "reason"):
133 elif hasattr(inst, "reason"):
134 try: # usually it is in the form (errno, strerror)
134 try: # usually it is in the form (errno, strerror)
135 reason = inst.reason.args[1]
135 reason = inst.reason.args[1]
136 except: # it might be anything, for example a string
136 except AttributeError: # it might be anything, for example a string
137 reason = inst.reason
137 reason = inst.reason
138 ui.warn(_("abort: error: %s\n") % reason)
138 ui.warn(_("abort: error: %s\n") % reason)
139 elif hasattr(inst, "args") and inst.args[0] == errno.EPIPE:
139 elif hasattr(inst, "args") and inst.args[0] == errno.EPIPE:
@@ -363,7 +363,7 b' def clone(ui, source, dest=None, pull=Fa'
363 try:
363 try:
364 m = dest_repo.lookup(n)
364 m = dest_repo.lookup(n)
365 dest_repo._bookmarks[k] = m
365 dest_repo._bookmarks[k] = m
366 except:
366 except error.RepoLookupError:
367 pass
367 pass
368 if rb:
368 if rb:
369 bookmarks.write(dest_repo)
369 bookmarks.write(dest_repo)
@@ -549,7 +549,7 b' class localrepository(repo.repository):'
549 try:
549 try:
550 if len(key) == 20:
550 if len(key) == 20:
551 key = hex(key)
551 key = hex(key)
552 except:
552 except TypeError:
553 pass
553 pass
554 raise error.RepoLookupError(_("unknown revision '%s'") % key)
554 raise error.RepoLookupError(_("unknown revision '%s'") % key)
555
555
@@ -59,7 +59,7 b' def set_flags(f, l, x):'
59 os.unlink(f)
59 os.unlink(f)
60 try:
60 try:
61 os.symlink(data, f)
61 os.symlink(data, f)
62 except:
62 except OSError:
63 # failed to make a link, rewrite file
63 # failed to make a link, rewrite file
64 fp = open(f, "w")
64 fp = open(f, "w")
65 fp.write(data)
65 fp.write(data)
@@ -167,7 +167,7 b' class sshrepository(wireproto.wirereposi'
167 self.readerr()
167 self.readerr()
168 try:
168 try:
169 l = int(l)
169 l = int(l)
170 except:
170 except ValueError:
171 self._abort(error.ResponseError(_("unexpected response:"), l))
171 self._abort(error.ResponseError(_("unexpected response:"), l))
172 return self.pipei.read(l)
172 return self.pipei.read(l)
173
173
@@ -208,7 +208,7 b' class sshrepository(wireproto.wirereposi'
208 return 1
208 return 1
209 try:
209 try:
210 return int(r)
210 return int(r)
211 except:
211 except ValueError:
212 self._abort(error.ResponseError(_("unexpected response:"), r))
212 self._abort(error.ResponseError(_("unexpected response:"), r))
213
213
214 instance = sshrepository
214 instance = sshrepository
@@ -206,12 +206,12 b' def tempfilter(s, cmd):'
206 try:
206 try:
207 if inname:
207 if inname:
208 os.unlink(inname)
208 os.unlink(inname)
209 except:
209 except OSError:
210 pass
210 pass
211 try:
211 try:
212 if outname:
212 if outname:
213 os.unlink(outname)
213 os.unlink(outname)
214 except:
214 except OSError:
215 pass
215 pass
216
216
217 filtertable = {
217 filtertable = {
@@ -407,7 +407,7 b' def copyfile(src, dest):'
407 if os.path.islink(src):
407 if os.path.islink(src):
408 try:
408 try:
409 os.unlink(dest)
409 os.unlink(dest)
410 except:
410 except OSError:
411 pass
411 pass
412 os.symlink(os.readlink(src), dest)
412 os.symlink(os.readlink(src), dest)
413 else:
413 else:
@@ -556,7 +556,7 b' def checkcase(path):'
556 if s2 == s1:
556 if s2 == s1:
557 return False
557 return False
558 return True
558 return True
559 except:
559 except OSError:
560 return True
560 return True
561
561
562 _fspathcache = {}
562 _fspathcache = {}
@@ -32,7 +32,8 b' class winstdout(object):'
32 def close(self):
32 def close(self):
33 try:
33 try:
34 self.fp.close()
34 self.fp.close()
35 except: pass
35 except IOError:
36 pass
36
37
37 def write(self, s):
38 def write(self, s):
38 try:
39 try:
@@ -243,7 +244,7 b' def _removedirs(name):'
243 if osutil.listdir(head):
244 if osutil.listdir(head):
244 return
245 return
245 os.rmdir(head)
246 os.rmdir(head)
246 except:
247 except (ValueError, OSError):
247 break
248 break
248 head, tail = os.path.split(head)
249 head, tail = os.path.split(head)
249
250
General Comments 0
You need to be logged in to leave comments. Login now