Mercurial > public > mercurial-scm > hg-stable
diff hgext/largefiles/lfcommands.py @ 15171:547da6115d1d
largefiles: eliminate naked exceptions
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 29 Sep 2011 17:14:47 -0500 |
parents | c1a4a3220711 |
children | fb1dcd2aae2a |
line wrap: on
line diff
--- a/hgext/largefiles/lfcommands.py Thu Sep 29 17:04:57 2011 -0500 +++ b/hgext/largefiles/lfcommands.py Thu Sep 29 17:14:47 2011 -0500 @@ -65,6 +65,7 @@ ui.traceback() raise util.Abort(_('%s is not a repo') % dest) + success = False try: # Lock destination to prevent modification while it is converted to. # Don't need to lock src because we are just reading from its history @@ -106,7 +107,7 @@ os.unlink(rdst.wjoin(f)) try: os.removedirs(os.path.dirname(rdst.wjoin(f))) - except: + except OSError: pass else: @@ -116,11 +117,11 @@ _addchangeset(ui, rsrc, rdst, ctx, revmap) ui.progress(_('converting revisions'), None) - except: - # we failed, remove the new directory - shutil.rmtree(rdst.root) - raise + success = True finally: + if not success: + # we failed, remove the new directory + shutil.rmtree(rdst.root) dst_lock.release() def _addchangeset(ui, rsrc, rdst, ctx, revmap):