This commit is contained in:
Augie Fackler 2010-10-10 10:22:37 -05:00
commit 7b2029d1b8
2 changed files with 29 additions and 8 deletions

View File

@ -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

View File

@ -79,6 +79,29 @@ class TestPushDirectories(test_util.TestBase):
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),