~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remotebranch.py

  • Committer: Lalo Martins
  • Date: 2005-09-14 05:22:13 UTC
  • mfrom: (1185.1.10)
  • mto: (1185.1.22)
  • mto: This revision was merged to the branch mainline in revision 1390.
  • Revision ID: lalo@exoweb.net-20050914052213-2aa5c1005959abdf
merging from Robert's integration branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
from cStringIO import StringIO
29
29
import os
30
30
import urllib2
 
31
import urlparse
31
32
 
32
33
from bzrlib.errors import BzrError, BzrCheckError
33
34
from bzrlib.branch import Branch, BZR_BRANCH_FORMAT
83
84
    orig_url = url
84
85
    while True:
85
86
        try:
86
 
            ff = get_url(url + '/.bzr/branch-format')
87
 
 
 
87
            fmt_url = url + '/.bzr/branch-format'
 
88
            ff = get_url(fmt_url)
88
89
            fmt = ff.read()
89
90
            ff.close()
90
91
 
97
98
        except urllib2.URLError:
98
99
            pass
99
100
 
100
 
        try:
101
 
            idx = url.rindex('/')
102
 
        except ValueError:
103
 
            raise BzrError('no branch root found for URL %s' % orig_url)
104
 
 
105
 
        url = url[:idx]        
 
101
        scheme, host, path = list(urlparse.urlparse(url))[:3]
 
102
        # discard params, query, fragment
 
103
        
 
104
        # strip off one component of the path component
 
105
        idx = path.rfind('/')
 
106
        if idx == -1 or path == '/':
 
107
            raise BzrError('no branch root found for URL %s'
 
108
                           ' or enclosing directories'
 
109
                           % orig_url)
 
110
        path = path[:idx]
 
111
        url = urlparse.urlunparse((scheme, host, path, '', '', ''))
 
112
        
106
113
 
107
114
 
108
115
class RemoteBranch(Branch):