changeset 733:bfb88a304ebe

Merge
author Augie Fackler <durin42@gmail.com>
date Sun, 10 Oct 2010 10:22:37 -0500
parents 050f03a3bdf5 (current diff) de036c2cb36a (diff)
children e24fb3e27ec9
files
diffstat 2 files changed, 29 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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),