Patchwork convert: on svn failure, note libsvn version (issue4043)

login
register
mail settings
Submitter Augie Fackler
Date Dec. 15, 2014, 7:51 p.m.
Message ID <5d3d0ffadf3c694c4229.1418673086@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/7120/
State Accepted
Commit ebfad9c3ad01862219a326a04a062ea2c25e26d3
Delegated to: Pierre-Yves David
Headers show

Comments

Augie Fackler - Dec. 15, 2014, 7:51 p.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1418417597 18000
#      Fri Dec 12 15:53:17 2014 -0500
# Node ID 5d3d0ffadf3c694c4229c494911536dc5aa460f5
# Parent  65c854f92d6ba8861414ff3191182fba28777a82
convert: on svn failure, note libsvn version (issue4043)

We have our own fast-path logic to see if something passes a sniff
test for being a Subversion repository, but it's possible for a user
to svnsync a repo using svn 1.8 and then use svn 1.7 bindings (as in
the bug) to try and convert the repo. If we at least tell the user the
version of libsvn that we used, they might get enough of a hint to
check on their own for format incompatibilities between their
svn{admin,sync} and the libsvn used by hg.
Pierre-Yves David - Dec. 17, 2014, 12:43 a.m.
On 12/15/2014 11:51 AM, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <raf@durin42.com>
> # Date 1418417597 18000
> #      Fri Dec 12 15:53:17 2014 -0500
> # Node ID 5d3d0ffadf3c694c4229c494911536dc5aa460f5
> # Parent  65c854f92d6ba8861414ff3191182fba28777a82
> convert: on svn failure, note libsvn version (issue4043)

check-code and pyflakes are sending season greeting.

The feature seems right otherwise. Feel free to push that to crew once 
the tests pass.
Augie Fackler - Dec. 17, 2014, 1:18 a.m.
On Dec 16, 2014, at 7:43 PM, Pierre-Yves David <pierre-yves.david@ens-lyon.org> wrote:

> 
> 
> On 12/15/2014 11:51 AM, Augie Fackler wrote:
>> # HG changeset patch
>> # User Augie Fackler <raf@durin42.com>
>> # Date 1418417597 18000
>> #      Fri Dec 12 15:53:17 2014 -0500
>> # Node ID 5d3d0ffadf3c694c4229c494911536dc5aa460f5
>> # Parent  65c854f92d6ba8861414ff3191182fba28777a82
>> convert: on svn failure, note libsvn version (issue4043)
> 
> check-code and pyflakes are sending season greeting.
> 
> The feature seems right otherwise. Feel free to push that to crew once the tests pass.

Will do, thanks.

> 
> -- 
> Pierre-Yves David

Patch

diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py
--- a/hgext/convert/subversion.py
+++ b/hgext/convert/subversion.py
@@ -316,10 +316,14 @@  class svn_source(converter_source):
             self.commits = {}
             self.paths = {}
             self.uuid = svn.ra.get_uuid(self.ra)
-        except SubversionException:
+        except SubversionException, e:
             ui.traceback()
-            raise NoRepo(_("%s does not look like a Subversion repository")
-                         % self.url)
+            svnversion = '%d.%d.%d' % (svn.core.SVN_VER_MAJOR,
+                                       svn.core.SVN_VER_MINOR,
+                                       svn.core.SVN_VER_MICRO)
+            raise NoRepo(_("%s does not look like a Subversion repository "
+                           "to libsvn version %s")
+                         % (self.url, svnversion))
 
         if rev:
             try:
diff --git a/tests/test-convert-svn-source.t b/tests/test-convert-svn-source.t
--- a/tests/test-convert-svn-source.t
+++ b/tests/test-convert-svn-source.t
@@ -239,3 +239,16 @@  Also tests getting logs directly without
   converting...
   1 init projA
   0 adddir
+
+Test that a too-new repository format is properly rejected:
+  $ mv svn-empty/format format
+  $ echo 999 > svn-empty/format
+It's important that this command explicitly specify svn, otherwise it
+can have surprising side effects (like falling back to a perforce
+depot that can be seen from the test environment and slurping from that.)
+  $ hg convert --source-type svn svn-empty this-will-fail
+  initializing destination this-will-fail repository
+  file://$TESTTMP/svn-empty does not look like a Subversion repository to libsvn version 1.*.* (glob)
+  abort: svn-empty: missing or unsupported repository
+  [255]
+  $ mv format svn-empty/format