~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-06-08 06:38:32 UTC
  • mfrom: (1685.1.81 encoding)
  • Revision ID: pqm@pqm.ubuntu.com-20060608063832-74b46cf8fdd4567a
(jam,mbp,wvh) Lots of updates to unicode,url,and encoding support

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
                            safe_unicode,
48
48
                            rmtree,
49
49
                            )
50
 
from bzrlib.textui import show_status
51
 
from bzrlib.trace import mutter, note
52
 
from bzrlib.tree import EmptyTree, RevisionTree
53
50
from bzrlib.repository import Repository
54
51
from bzrlib.revision import (
55
52
                             is_ancestor,
58
55
                             )
59
56
from bzrlib.store import copy_all
60
57
from bzrlib.symbol_versioning import *
 
58
from bzrlib.textui import show_status
 
59
from bzrlib.trace import mutter, note
61
60
import bzrlib.transactions as transactions
62
61
from bzrlib.transport import Transport, get_transport
63
62
from bzrlib.tree import EmptyTree, RevisionTree
64
63
import bzrlib.ui
 
64
import bzrlib.urlutils as urlutils
65
65
import bzrlib.xml5
66
66
 
67
67
 
1133
1133
        """See Branch.get_parent."""
1134
1134
        import errno
1135
1135
        _locs = ['parent', 'pull', 'x-pull']
 
1136
        assert self.base[-1] == '/'
1136
1137
        for l in _locs:
1137
1138
            try:
1138
 
                return self.control_files.get_utf8(l).read().strip('\n')
 
1139
                return urlutils.join(self.base[:-1], 
 
1140
                            self.control_files.get(l).read().strip('\n'))
1139
1141
            except NoSuchFile:
1140
1142
                pass
1141
1143
        return None
1162
1164
        if url is None:
1163
1165
            self.control_files._transport.delete('parent')
1164
1166
        else:
1165
 
            self.control_files.put_utf8('parent', url + '\n')
 
1167
            if isinstance(url, unicode):
 
1168
                try: 
 
1169
                    url = url.encode('ascii')
 
1170
                except UnicodeEncodeError:
 
1171
                    raise bzrlib.errors.InvalidURL(url,
 
1172
                        "Urls must be 7-bit ascii, "
 
1173
                        "use bzrlib.urlutils.escape")
 
1174
                    
 
1175
            url = urlutils.relative_url(self.base, url)
 
1176
            self.control_files.put('parent', url + '\n')
1166
1177
 
1167
1178
    def tree_config(self):
1168
1179
        return TreeConfig(self)