~gagern/bzr-svn/bug242321

« back to all changes in this revision

Viewing changes to remote.py

  • Committer: Jelmer Vernooij
  • Date: 2008-04-04 13:57:34 UTC
  • Revision ID: jelmer@samba.org-20080404135734-zq2qmd6pu9lebcmx
Cache revision number when repository is read locked. Significantly improves performance of push.

Show diffs side-by-side

added added

removed removed

Lines of Context:
140
140
            stop_revision = source.last_revision()
141
141
        target_branch_path = self.branch_path.strip("/")
142
142
        repos = self.find_repository()
143
 
        full_branch_url = urlutils.join(repos.transport.base, 
144
 
                                        target_branch_path)
145
 
        if repos.transport.check_path(target_branch_path,
146
 
            repos.get_latest_revnum()) != svn.core.svn_node_none:
147
 
            raise AlreadyBranchError(full_branch_url)
148
 
        push_new(repos, target_branch_path, source, stop_revision)
149
 
        branch = self.open_branch()
150
 
        branch.pull(source, stop_revision=stop_revision)
 
143
        repos.lock_write()
 
144
        try:
 
145
            full_branch_url = urlutils.join(repos.transport.base, 
 
146
                                            target_branch_path)
 
147
            if repos.transport.check_path(target_branch_path,
 
148
                repos.get_latest_revnum()) != svn.core.svn_node_none:
 
149
                raise AlreadyBranchError(full_branch_url)
 
150
            push_new(repos, target_branch_path, source, stop_revision)
 
151
            branch = self.open_branch()
 
152
            branch.pull(source, stop_revision=stop_revision)
 
153
        finally:
 
154
            repos.unlock()
151
155
        return branch
152
156
 
153
157
    def create_branch(self):