Skip to content

Instantly share code, notes, and snippets.

@sibson
Created November 9, 2011 20:34
Show Gist options
  • Save sibson/1352911 to your computer and use it in GitHub Desktop.
Save sibson/1352911 to your computer and use it in GitHub Desktop.
svn project within project fails
diff --git a/zest/releaser/svn.py b/zest/releaser/svn.py
index 45c10ad..44696ed 100644
--- a/zest/releaser/svn.py
+++ b/zest/releaser/svn.py
@@ -28,7 +28,7 @@ class Subversion(BaseVersionControl):
# Note: slashes are used to prevent problems with 'tha.tagfinder'-like
# project names...
for remove in ['/trunk', '/tags', '/branches', '/tag', '/branch']:
- base = base.split(remove)[0]
+ base = base.rsplit(remove, 1)[0]
if not base.endswith('/'):
base += '/'
logger.debug("Base url is %s", base)
diff --git a/zest/releaser/tests/svn.txt b/zest/releaser/tests/svn.txt
index 8133a59..17ec6ee 100644
--- a/zest/releaser/tests/svn.txt
+++ b/zest/releaser/tests/svn.txt
@@ -334,3 +334,56 @@ the singular /tag and /branch is used:
>>> singular_checkout = svn.Subversion()
>>> singular_checkout._base_from_svn()
'file://TESTREPO/singular/'
+
+Tags within a trunk
+----------------------------
+Some legacy projects, often converted from CVS, have multiple subprojects
+under a single trunk. This creates URLs that contain a regular svn layout
+within an top level trunk. For example::
+
+ trunk/
+ projectA/
+ trunk/
+ tags/
+ branches/
+
+ projectB
+ trunk/
+ tags/
+ branches/
+
+Create trunk/ for both projects:
+
+ >>> repo_url
+ 'file://TESTREPO'
+ >>> cmd = 'svn mkdir --parents %s/trunk/projectA/trunk -m"mk projectA"' % repo_url
+ >>> dont_care = system(cmd)
+ >>> cmd = 'svn mkdir %s/trunk/projectB/trunk -m "mkdir projectB"' % repo_url
+ >>> dont_care = system(cmd)
+
+Make a checkout:
+
+ >>> os.chdir(tempdir)
+ >>> cmd = 'svn co %s/trunk' % repo_url
+ >>> dont_care = system(cmd)
+
+Now check that we try to create the proper trunk/projectA/tags directory
+
+ >>> os.chdir('trunk/projectA/trunk')
+ >>> from zest.releaser import utils
+ >>> utils.TESTMODE = True
+ >>> sample_checkout = svn.Subversion()
+ >>> utils.answers_for_testing = ['y']
+ >>> sample_checkout.available_tags()
+ tags dir does not exist at file://TESTREPO/trunk/projectA/tags
+ Question: Shall I create it (Y/n)?
+ Our reply: y
+ <BLANKLINE>
+ Committed revision 18.
+ []
+ >>> cmd = 'svn list -R %s/trunk' % repo_url
+ >>> print system(cmd)
+ projectA/
+ projectA/tags/
+ projectA/trunk/
+ <BLANKLINE>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment