# HG changeset patch # User Peter Arrenbrecht # Date 1280321264 -7200 # Node ID e910e3ebd23b1986ba6b75db111c3a3165a5e737 # Parent 186f13b35d15dc61b80da4b7474c476cc1647740 svnmeta: strip all repeated slashes from subdir diff --git a/hgsubversion/svnmeta.py b/hgsubversion/svnmeta.py --- a/hgsubversion/svnmeta.py +++ b/hgsubversion/svnmeta.py @@ -55,9 +55,11 @@ class SVNMeta(object): 'usebranchnames', True) # FIXME: test that this hasn't changed! defer & compare? + if subdir: + # strip leading and trailing slashes + # collapse all repeated slashes to a single one + subdir = '/'.join(p for p in subdir.split('/') if p) self.subdir = subdir - if self.subdir and self.subdir[0] == '/': - self.subdir = self.subdir[1:] self.branches = {} if os.path.exists(self.branch_info_file): f = open(self.branch_info_file) diff --git a/tests/test_push_command.py b/tests/test_push_command.py --- a/tests/test_push_command.py +++ b/tests/test_push_command.py @@ -76,7 +76,7 @@ class PushTests(test_util.TestBase): tip = self.repo['tip'] self.assertEqual(new_hash, tip.node()) - def test_push_over_svnserve(self, commit=True): + def internal_push_over_svnserve(self, subdir='', commit=True): test_util.load_svndump_fixture(self.repo_path, 'simple_branch.svndump') open(os.path.join(self.repo_path, 'conf', 'svnserve.conf'), 'w').write('[general]\nanon-access=write\n[sasl]\n') @@ -94,7 +94,8 @@ class PushTests(test_util.TestBase): time.sleep(2) import shutil shutil.rmtree(self.wc_path) - commands.clone(self.ui(), 'svn://%s:%d/' % (self.host, self.port), + commands.clone(self.ui(), + 'svn://%s:%d/%s' % (self.host, self.port, subdir), self.wc_path, noupdate=True) repo = self.repo @@ -135,6 +136,12 @@ class PushTests(test_util.TestBase): # TODO: use svnserve.kill() in Python >2.5 test_util.kill_process(svnserve) + def test_push_over_svnserve(self): + self.internal_push_over_svnserve() + + def test_push_over_svnserve_with_subdir(self): + self.internal_push_over_svnserve(subdir='///branches////the_branch/////') + def test_push_to_default(self, commit=True): repo = self.repo old_tip = repo['tip'].node()