# HG changeset patch # User Augie Fackler # Date 1286724157 18000 # Node ID bfb88a304ebe36fc56c8fa4d9d44e3ecc2a2fcde # Parent 050f03a3bdf5064cf9d81f49338d053cc73387fe# Parent de036c2cb36aa6d57b8db1daf34569653463a1de Merge diff --git a/hgsubversion/svnwrap/subvertpy_wrapper.py b/hgsubversion/svnwrap/subvertpy_wrapper.py --- a/hgsubversion/svnwrap/subvertpy_wrapper.py +++ b/hgsubversion/svnwrap/subvertpy_wrapper.py @@ -360,21 +360,20 @@ class SubversionRepo(object): if directory and not path.startswith(directory + '/'): return pathidx - dirent = path[len(directory):].lstrip('/') pathidx += 1 if path in file_data: # visiting a file base_text, new_text, action = file_data[path] if action == 'modify': - fileeditor = editor.open_file(dirent, base_revision) + fileeditor = editor.open_file(path, base_revision) elif action == 'add': frompath, fromrev = copies.get(path, (None, -1)) if frompath: frompath = self.path2url(frompath) - fileeditor = editor.add_file(dirent, frompath, fromrev) + fileeditor = editor.add_file(path, frompath, fromrev) elif action == 'delete': - editor.delete_entry(dirent, base_revision) + editor.delete_entry(path, base_revision) continue else: assert False, 'invalid action \'%s\'' % action @@ -393,9 +392,9 @@ class SubversionRepo(object): else: # visiting a directory if path in addeddirs: - direditor = editor.add_directory(dirent) + direditor = editor.add_directory(path) elif path in deleteddirs: - direditor = editor.delete_entry(dirent, base_revision) + direditor = editor.delete_entry(path, base_revision) continue else: direditor = editor.open_directory(path) @@ -404,8 +403,7 @@ class SubversionRepo(object): for p, v in props[path].iteritems(): direditor.change_prop(p, v) - pathidx = visitdir(direditor, '/'.join((directory, dirent)), - paths, pathidx) + pathidx = visitdir(direditor, path, paths, pathidx) direditor.close() return pathidx diff --git a/tests/test_push_dirs.py b/tests/test_push_dirs.py --- a/tests/test_push_dirs.py +++ b/tests/test_push_dirs.py @@ -79,6 +79,29 @@ class TestPushDirectories(test_util.Test self.pushrevisions() self.assertEqual(self.svnls('project/trunk'), ['a' ,]) + def test_push_single_dir_change_in_subdir(self): + # Tests simple pushing from default branch to a single dir repo + # Changes a file in a subdir (regression). + repo = self._load_fixture_and_fetch('branch_from_tag.svndump', + stupid=False, + layout='single', + subdir='tags') + changes = [('tag_r3/alpha', 'tag_r3/alpha', 'foo'), + ('tag_r3/new', 'tag_r3/new', 'foo'), + ('new_dir/new', 'new_dir/new', 'foo'), + ] + self.commitchanges(changes) + self.pushrevisions() + self.assertEqual(self.svnls('tags'), + ['copied_tag', + 'copied_tag/alpha', + 'copied_tag/beta', + 'new_dir', + 'new_dir/new', + 'tag_r3', + 'tag_r3/alpha', + 'tag_r3/beta', + 'tag_r3/new']) def suite(): all = [unittest.TestLoader().loadTestsFromTestCase(TestPushDirectories),