Pastebin

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
diff --git ForgeSVN/forgesvn/model/svn.py ForgeSVN/forgesvn/model/svn.py
index 082966f..e348850 100644
--- ForgeSVN/forgesvn/model/svn.py
+++ ForgeSVN/forgesvn/model/svn.py
@@ -278,8 +278,8 @@ def update_checkout_url(self):
         """Validate the current ``checkout_url`` against the on-disk repo,
         and change it if necessary.

-        If ``checkout_url`` is valid, no changes are made.
-        If ``checkout_url`` is invalid:
+        If ``checkout_url`` is valid and not '', no changes are made.
+        If ``checkout_url`` is invalid or '':

             - Set it to 'trunk' if repo has a top-level trunk directory
             - Else, set it to ''
diff --git ForgeSVN/forgesvn/tests/model/test_svnimplementation.py ForgeSVN/forgesvn/tests/model/test_svnimplementation.py
index 4e4e57a..fbd92b8 100644
--- ForgeSVN/forgesvn/tests/model/test_svnimplementation.py
+++ ForgeSVN/forgesvn/tests/model/test_svnimplementation.py
@@ -19,12 +19,16 @@
 from nose.tools import assert_equal
 from pylons import app_globals as g

+from alluratest.controller import setup_unit_test
 from allura.model.repo import Commit
 from forgesvn.model.svn import SVNImplementation


 class TestSVNImplementation(object):

+    def setUp(self):
+        setup_unit_test()
+
     def test_compute_tree_new(self):
         self._test_compute_tree_new('/trunk/foo/')
         self._test_compute_tree_new('/trunk/foo')
@@ -120,3 +124,8 @@ def test_update_checkout_url(self, svn_path_exists):
         opts['checkout_url'] = 'invalid'
         impl.update_checkout_url()
         assert_equal(opts['checkout_url'], 'trunk')
+
+        svn_path_exists.side_effect = lambda path: path.endswith('trunk')
+        opts['checkout_url'] = ''
+        impl.update_checkout_url()
+        assert_equal(opts['checkout_url'], 'trunk')