def makeDirectory(self, directory_name, commit_message=None): """Make a directory on the repository.""" if commit_message is None: commit_message = 'Make %r' % (directory_name,) ra = self._get_ra(self.get_url()) editor = ra.get_commit_editor({"svn:log": commit_message}) root = editor.open_root() root.add_directory(directory_name).close() root.close() editor.close() return urljoin(self.get_url(), directory_name)
def makeBranch(self, branch_name, tree_contents): """Create a branch on the Subversion server called `branch_name`. :param branch_name: The name of the branch to create. :param tree_contents: The contents of the module. This is a list of tuples of (relative filename, file contents). """ branch_url = self.makeDirectory(branch_name) ra = self._get_ra(branch_url) editor = ra.get_commit_editor({"svn:log": "Import"}) root = editor.open_root() for filename, content in tree_contents: f = root.add_file(filename) try: subvertpy.delta.send_stream(StringIO(content), f.apply_textdelta()) finally: f.close() root.close() editor.close() return branch_url