~ubuntu-branches/ubuntu/hardy/bzr/hardy-updates

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Bazaar Package Importer
  • Author(s): Etienne Goyer
  • Date: 2007-06-14 16:20:21 UTC
  • mfrom: (1.1.26 upstream)
  • Revision ID: james.westby@ubuntu.com-20070614162021-mfokj7k70cv65j6n
Tags: 0.17~rc1-0ubuntu1
* New upstream development release
* debian/control: Setted Maintainer to ubuntu-dev, added Original-Maitainer 
* debian/rules: also remove man1/* and doc/developers/*.htm in the clean
  target

Show diffs side-by-side

added added

removed removed

Lines of Context:
155
155
        :param force_new_repo: Do not use a shared repository for the target 
156
156
                               even if one is available.
157
157
        """
158
 
        self._make_tail(url)
159
 
        result = self._format.initialize(url)
 
158
        return self.clone_on_transport(get_transport(url),
 
159
                                       revision_id=revision_id,
 
160
                                       force_new_repo=force_new_repo)
 
161
 
 
162
    def clone_on_transport(self, transport, revision_id=None,
 
163
                           force_new_repo=False):
 
164
        """Clone this bzrdir and its contents to transport verbatim.
 
165
 
 
166
        If the target directory does not exist, it will be created.
 
167
 
 
168
        if revision_id is not None, then the clone operation may tune
 
169
            itself to download less data.
 
170
        :param force_new_repo: Do not use a shared repository for the target 
 
171
                               even if one is available.
 
172
        """
 
173
        transport.ensure_base()
 
174
        result = self._format.initialize_on_transport(transport)
160
175
        try:
161
176
            local_repo = self.find_repository()
162
177
        except errors.NoRepositoryPresent:
195
210
    # TODO: This should be given a Transport, and should chdir up; otherwise
196
211
    # this will open a new connection.
197
212
    def _make_tail(self, url):
198
 
        head, tail = urlutils.split(url)
199
 
        if tail and tail != '.':
200
 
            t = get_transport(head)
201
 
            try:
202
 
                t.mkdir(tail)
203
 
            except errors.FileExists:
204
 
                pass
 
213
        t = get_transport(url)
 
214
        t.ensure_base()
205
215
 
206
216
    # TODO: Should take a Transport
207
217
    @classmethod
217
227
        if cls is not BzrDir:
218
228
            raise AssertionError("BzrDir.create always creates the default"
219
229
                " format, not one of %r" % cls)
220
 
        head, tail = urlutils.split(base)
221
 
        if tail and tail != '.':
222
 
            t = get_transport(head)
223
 
            try:
224
 
                t.mkdir(tail)
225
 
            except errors.FileExists:
226
 
                pass
 
230
        t = get_transport(base)
 
231
        t.ensure_base()
227
232
        if format is None:
228
233
            format = BzrDirFormat.get_default_format()
229
234
        return format.initialize(safe_unicode(base))
756
761
        if revision_id is not None, then the clone operation may tune
757
762
            itself to download less data.
758
763
        """
759
 
        self._make_tail(url)
 
764
        target_transport = get_transport(url)
 
765
        target_transport.ensure_base()
760
766
        cloning_format = self.cloning_metadir()
761
 
        result = cloning_format.initialize(url)
 
767
        result = cloning_format.initialize_on_transport(target_transport)
762
768
        try:
763
769
            source_branch = self.open_branch()
764
770
            source_repository = source_branch.repository