~bzr/ubuntu/maverick/bzr-svn/bzr-ppa

« back to all changes in this revision

Viewing changes to remote.py

  • Committer: Jelmer Vernooij
  • Date: 2008-05-11 19:29:26 UTC
  • mfrom: (220.36.144 0.4)
  • Revision ID: jelmer@samba.org-20080511192926-7mh02j45r25qmzkz
Merge 0.4 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
5
 
# the Free Software Foundation; either version 2 of the License, or
 
5
# the Free Software Foundation; either version 3 of the License, or
6
6
# (at your option) any later version.
7
7
 
8
8
# This program is distributed in the hope that it will be useful,
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.transport.get_latest_revnum()) != svn.core.svn_node_none:
147
 
            raise AlreadyBranchError(full_branch_url)
148
 
        push_new(repos, target_branch_path, source, 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
        finally:
 
152
            repos.unlock()
149
153
        branch = self.open_branch()
150
 
        branch.pull(source, stop_revision=stop_revision)
 
154
        branch.lock_write()
 
155
        try:
 
156
            branch.pull(source, stop_revision=stop_revision)
 
157
        finally:
 
158
            branch.unlock()
151
159
        return branch
152
160
 
153
161
    def create_branch(self):
158
166
        if self.branch_path != "":
159
167
            # TODO: Set NULL_REVISION in SVN_PROP_BZR_BRANCHING_SCHEME
160
168
            repos.transport.mkdir(self.branch_path.strip("/"))
161
 
        elif repos.transport.get_latest_revnum() > 0:
 
169
        elif repos.get_latest_revnum() > 0:
162
170
            # Bail out if there are already revisions in this repository
163
171
            raise AlreadyBranchError(self.root_transport.base)
164
172
        branch = SvnBranch(self.root_transport.base, repos, self.branch_path)