/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/remotebranch.py

- merge various windows and other fixes from Ollie Rutherfurd
  
1179: changed diff help example to -r1..2 from deprecated -r1:2
1178: fixed \r\n -> \n conversion in branch._check_format
1177: disable urlgrabber on win32, since it converts / -> \
1176: changed assert path.startswith('./') -> '.'+os.sep in merge.py
1175: replaced os.spawnvp with subprocess.call in msgeditor.py
1174: os.name == 'windows' -> 'nt', check for %EDITOR% on win32
1173: fixed bzr mv filename newfilename, re-enabled test_mv_modes

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
import gzip
28
28
from cStringIO import StringIO
 
29
import os
29
30
import urllib2
30
31
 
31
32
from errors import BzrError, BzrCheckError
36
37
# breaks keep-alive -- sucks!
37
38
 
38
39
 
39
 
ENABLE_URLGRABBER = True
 
40
ENABLE_URLGRABBER = False
40
41
 
41
 
from bzrlib.errors import BzrError
 
42
from bzrlib.errors import BzrError, NoSuchRevision
42
43
 
43
44
class GetFailed(BzrError):
44
45
    def __init__(self, url, status):
47
48
        self.status = status
48
49
 
49
50
if ENABLE_URLGRABBER:
50
 
    import urlgrabber
51
 
    import urlgrabber.keepalive
52
 
    urlgrabber.keepalive.DEBUG = 0
 
51
    import util.urlgrabber
 
52
    import util.urlgrabber.keepalive
 
53
    util.urlgrabber.keepalive.DEBUG = 0
53
54
    def get_url(path, compressed=False):
54
55
        try:
55
56
            url = path
56
57
            if compressed:
57
58
                url += '.gz'
58
59
            mutter("grab url %s" % url)
59
 
            url_f = urlgrabber.urlopen(url, keepalive=1, close_connection=0)
 
60
            url_f = util.urlgrabber.urlopen(url, keepalive=1, close_connection=0)
60
61
            if url_f.status != 200:
61
62
                raise GetFailed(url, url_f.status)
62
63
            if not compressed:
155
156
 
156
157
    def get_revision(self, revision_id):
157
158
        from bzrlib.revision import Revision
158
 
        from bzrlib.xml import unpack_xml
159
 
        revf = self.revision_store[revision_id]
160
 
        r = unpack_xml(Revision, revf)
 
159
        try:
 
160
            revf = self.revision_store[revision_id]
 
161
        except KeyError:
 
162
            raise NoSuchRevision(self, revision_id)
 
163
        r = serializer_v4.read_revision(revf)
161
164
        if r.revision_id != revision_id:
162
165
            raise BzrCheckError('revision stored as {%s} actually contains {%s}'
163
166
                                % (revision_id, r.revision_id))