/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/branch.py

  • Committer: Martin Pool
  • Date: 2006-06-10 23:16:19 UTC
  • mfrom: (1759 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1761.
  • Revision ID: mbp@sourcefrog.net-20060610231619-05b997deeb005d02
[merge] bzr.dev

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
 
249
249
        branch.
250
250
        """
251
251
        return None
 
252
    
 
253
    def get_commit_builder(self, parents, config=None, timestamp=None, 
 
254
                           timezone=None, committer=None, revprops=None, 
 
255
                           revision_id=None):
 
256
        """Obtain a CommitBuilder for this branch.
 
257
        
 
258
        :param parents: Revision ids of the parents of the new revision.
 
259
        :param config: Optional configuration to use.
 
260
        :param timestamp: Optional timestamp recorded for commit.
 
261
        :param timezone: Optional timezone for timestamp.
 
262
        :param committer: Optional committer to set for commit.
 
263
        :param revprops: Optional dictionary of revision properties.
 
264
        :param revision_id: Optional revision id.
 
265
        """
 
266
 
 
267
        if config is None:
 
268
            config = bzrlib.config.BranchConfig(self)
 
269
        
 
270
        return self.repository.get_commit_builder(self, parents, config, 
 
271
            timestamp, timezone, committer, revprops, revision_id)
252
272
 
253
273
    def get_master_branch(self):
254
274
        """Return the branch we are bound to.
1161
1181
        """See Branch.get_parent."""
1162
1182
        import errno
1163
1183
        _locs = ['parent', 'pull', 'x-pull']
 
1184
        assert self.base[-1] == '/'
1164
1185
        for l in _locs:
1165
1186
            try:
1166
 
                return self.control_files.get_utf8(l).read().strip('\n')
 
1187
                return urlutils.join(self.base[:-1], 
 
1188
                            self.control_files.get(l).read().strip('\n'))
1167
1189
            except NoSuchFile:
1168
1190
                pass
1169
1191
        return None
1190
1212
        if url is None:
1191
1213
            self.control_files._transport.delete('parent')
1192
1214
        else:
1193
 
            self.control_files.put_utf8('parent', url + '\n')
 
1215
            if isinstance(url, unicode):
 
1216
                try: 
 
1217
                    url = url.encode('ascii')
 
1218
                except UnicodeEncodeError:
 
1219
                    raise bzrlib.errors.InvalidURL(url,
 
1220
                        "Urls must be 7-bit ascii, "
 
1221
                        "use bzrlib.urlutils.escape")
 
1222
                    
 
1223
            url = urlutils.relative_url(self.base, url)
 
1224
            self.control_files.put('parent', url + '\n')
1194
1225
 
1195
1226
    def tree_config(self):
1196
1227
        return TreeConfig(self)