~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: John Arbash Meinel
  • Date: 2007-05-02 14:54:20 UTC
  • mto: (2476.3.2 111702)
  • mto: This revision was merged to the branch mainline in revision 2479.
  • Revision ID: john@arbash-meinel.com-20070502145420-k2vebnl0rd45q8kk
Change calls to try/mkdir('.')/except FileExists to ensure_base()

Show diffs side-by-side

added added

removed removed

Lines of Context:
170
170
        :param force_new_repo: Do not use a shared repository for the target 
171
171
                               even if one is available.
172
172
        """
173
 
        self._make_tail_on_transport(transport)
 
173
        transport.ensure_base()
174
174
        result = self._format.initialize_on_transport(transport)
175
175
        try:
176
176
            local_repo = self.find_repository()
210
210
    # TODO: This should be given a Transport, and should chdir up; otherwise
211
211
    # this will open a new connection.
212
212
    def _make_tail(self, url):
213
 
        head, tail = urlutils.split(url)
214
 
        if tail and tail != '.':
215
 
            t = get_transport(head)
216
 
            try:
217
 
                t.mkdir(tail)
218
 
            except errors.FileExists:
219
 
                pass
220
 
 
221
 
    def _make_tail_on_transport(self, transport):
222
 
        """Create the final directory in transport if it doesn't exist.
223
 
 
224
 
        We use "Easier to ask for Permission". And just create it, and ignore
225
 
        if the directory already exists.
226
 
        """
227
 
        try:
228
 
            transport.mkdir('.')
229
 
        except errors.FileExists:
230
 
            pass
 
213
        t = get_transport(url)
 
214
        t.ensure_base()
231
215
 
232
216
    # TODO: Should take a Transport
233
217
    @classmethod
243
227
        if cls is not BzrDir:
244
228
            raise AssertionError("BzrDir.create always creates the default"
245
229
                " format, not one of %r" % cls)
246
 
        head, tail = urlutils.split(base)
247
 
        if tail and tail != '.':
248
 
            t = get_transport(head)
249
 
            try:
250
 
                t.mkdir(tail)
251
 
            except errors.FileExists:
252
 
                pass
 
230
        t = get_transport(base)
 
231
        t.ensure_base()
253
232
        if format is None:
254
233
            format = BzrDirFormat.get_default_format()
255
234
        return format.initialize(safe_unicode(base))
783
762
            itself to download less data.
784
763
        """
785
764
        target_transport = get_transport(url)
786
 
        self._make_tail_on_transport(target_transport)
 
765
        target_transport.ensure_base()
787
766
        cloning_format = self.cloning_metadir()
788
767
        result = cloning_format.initialize_on_transport(target_transport)
789
768
        try: