comparison mercurial/repair.py @ 16705:c2d9ef43ff6c

check-code: ignore naked excepts with a "re-raise" comment This also promotes the naked except check from a warning to an error.
author Brodie Rao <brodie@sf.io>
date Sun, 13 May 2012 13:18:06 +0200
parents 3c738cb162bf
children 0311a6abd38a
comparison
equal deleted inserted replaced
16704:1f3acc30bdfe 16705:c2d9ef43ff6c
129 try: 129 try:
130 for i in xrange(offset, len(tr.entries)): 130 for i in xrange(offset, len(tr.entries)):
131 file, troffset, ignore = tr.entries[i] 131 file, troffset, ignore = tr.entries[i]
132 repo.sopener(file, 'a').truncate(troffset) 132 repo.sopener(file, 'a').truncate(troffset)
133 tr.close() 133 tr.close()
134 except: 134 except: # re-raises
135 tr.abort() 135 tr.abort()
136 raise 136 raise
137 137
138 if saveheads or savebases: 138 if saveheads or savebases:
139 ui.note(_("adding branch\n")) 139 ui.note(_("adding branch\n"))
158 ui.warn(_('error removing %s: %s\n') % (undofile, str(e))) 158 ui.warn(_('error removing %s: %s\n') % (undofile, str(e)))
159 159
160 for m in updatebm: 160 for m in updatebm:
161 bm[m] = repo['.'].node() 161 bm[m] = repo['.'].node()
162 bookmarks.write(repo) 162 bookmarks.write(repo)
163 except: 163 except: # re-raises
164 if backupfile: 164 if backupfile:
165 ui.warn(_("strip failed, full bundle stored in '%s'\n") 165 ui.warn(_("strip failed, full bundle stored in '%s'\n")
166 % backupfile) 166 % backupfile)
167 elif saveheads: 167 elif saveheads:
168 ui.warn(_("strip failed, partial bundle stored in '%s'\n") 168 ui.warn(_("strip failed, partial bundle stored in '%s'\n")