Brad Hall | 4 Jun 2012 23:27

[PATCH] Catch/abort on subversion exceptions in list_dir

# HG changeset patch
# User Brad Hall <bhall@...>
# Date 1338834444 25200
# Node ID e3b9c313cc7d3631c70e9f17d23b73fa1e9d3758
# Parent  312f36a425f01328c9f36b831019c30b6f4957fc
Catch/abort on subversion exceptions in list_dir

Give the user an error message if they attempt to pull a non-existent SVN rev
instead of a backtrace

diff --git a/hgsubversion/wrappers.py b/hgsubversion/wrappers.py
--- a/hgsubversion/wrappers.py
+++ b/hgsubversion/wrappers.py
 <at>  <at>  -275,7 +275,11  <at>  <at> 

     layout = repo.ui.config('hgsubversion', 'layout', 'auto')
     if layout == 'auto':
-        rootlist = svn.list_dir('', revision=(stopat_rev or None))
+        try:
+            rootlist = svn.list_dir('', revision=(stopat_rev or None))
+        except svnwrap.SubversionException, e:
+            err = "%s (subversion error: %d)" % (e.args[0], e.args[1])
+            raise hgutil.Abort(err)
         if sum(map(lambda x: x in rootlist, ('branches', 'tags', 'trunk'))):
             layout = 'standard'
         else:

--

-- 
You received this message because you are subscribed to the Google Groups "hgsubversion" group.
To post to this group, send email to hgsubversion@...
(Continue reading)


Gmane