~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-14 16:16:53 UTC
  • mto: (1946.2.6 reduce-knit-churn)
  • mto: This revision was merged to the branch mainline in revision 1919.
  • Revision ID: john@arbash-meinel.com-20060814161653-54cdcdadcd4e9003
Remove bogus entry from BRANCH.TODO

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
import bzrlib
24
24
from bzrlib import (
25
 
        bzrdir,
26
 
        cache_utf8,
27
 
        errors,
28
 
        lockdir,
29
 
        osutils,
 
25
        bzrdir, 
 
26
        errors, 
 
27
        lockdir, 
 
28
        osutils, 
30
29
        revision,
31
30
        transport,
32
31
        tree,
33
32
        ui,
34
 
        urlutils,
 
33
        urlutils
35
34
        )
36
35
from bzrlib.config import TreeConfig
37
36
from bzrlib.decorators import needs_read_lock, needs_write_lock
158
157
    nick = property(_get_nick, _set_nick)
159
158
 
160
159
    def is_locked(self):
161
 
        raise NotImplementedError(self.is_locked)
 
160
        raise NotImplementedError('is_locked is abstract')
162
161
 
163
162
    def lock_write(self):
164
 
        raise NotImplementedError(self.lock_write)
 
163
        raise NotImplementedError('lock_write is abstract')
165
164
 
166
165
    def lock_read(self):
167
 
        raise NotImplementedError(self.lock_read)
 
166
        raise NotImplementedError('lock_read is abstract')
168
167
 
169
168
    def unlock(self):
170
 
        raise NotImplementedError(self.unlock)
 
169
        raise NotImplementedError('unlock is abstract')
171
170
 
172
171
    def peek_lock_mode(self):
173
172
        """Return lock mode for the Branch: 'r', 'w' or None"""
174
173
        raise NotImplementedError(self.peek_lock_mode)
175
174
 
176
175
    def get_physical_lock_status(self):
177
 
        raise NotImplementedError(self.get_physical_lock_status)
 
176
        raise NotImplementedError('get_physical_lock_status is abstract')
178
177
 
179
178
    def abspath(self, name):
180
179
        """Return absolute filename for something in the branch
182
181
        XXX: Robert Collins 20051017 what is this used for? why is it a branch
183
182
        method and not a tree method.
184
183
        """
185
 
        raise NotImplementedError(self.abspath)
 
184
        raise NotImplementedError('abspath is abstract')
186
185
 
187
186
    def bind(self, other):
188
187
        """Bind the local branch the other branch.
279
278
 
280
279
    def get_root_id(self):
281
280
        """Return the id of this branches root"""
282
 
        raise NotImplementedError(self.get_root_id)
 
281
        raise NotImplementedError('get_root_id is abstract')
283
282
 
284
283
    def print_file(self, file, revision_id):
285
284
        """Print `file` to stdout."""
286
 
        raise NotImplementedError(self.print_file)
 
285
        raise NotImplementedError('print_file is abstract')
287
286
 
288
287
    def append_revision(self, *revision_ids):
289
 
        raise NotImplementedError(self.append_revision)
 
288
        raise NotImplementedError('append_revision is abstract')
290
289
 
291
290
    def set_revision_history(self, rev_history):
292
 
        raise NotImplementedError(self.set_revision_history)
 
291
        raise NotImplementedError('set_revision_history is abstract')
293
292
 
294
293
    def revision_history(self):
295
294
        """Return sequence of revision hashes on to this branch."""
308
307
        raise errors.UpgradeRequired(self.base)
309
308
 
310
309
    def last_revision(self):
311
 
        """Return last revision id, or None"""
 
310
        """Return last patch hash, or None if no history."""
312
311
        ph = self.revision_history()
313
312
        if ph:
314
313
            return ph[-1]
345
344
        :param stop_revision: Updated until the given revision
346
345
        :return: None
347
346
        """
348
 
        raise NotImplementedError(self.update_revisions)
 
347
        raise NotImplementedError('update_revisions is abstract')
349
348
 
350
349
    def revision_id_to_revno(self, revision_id):
351
350
        """Given a revision id, return its revno"""
363
362
            return None
364
363
        if history is None:
365
364
            history = self.revision_history()
366
 
        if revno <= 0 or revno > len(history):
 
365
        elif revno <= 0 or revno > len(history):
367
366
            raise bzrlib.errors.NoSuchRevision(self, revno)
368
367
        return history[revno - 1]
369
368
 
370
369
    def pull(self, source, overwrite=False, stop_revision=None):
371
 
        raise NotImplementedError(self.pull)
 
370
        raise NotImplementedError('pull is abstract')
372
371
 
373
372
    def basis_tree(self):
374
373
        """Return `Tree` object for last revision."""
379
378
 
380
379
        This can change the directory or the filename or both.
381
380
        """
382
 
        raise NotImplementedError(self.rename_one)
 
381
        raise NotImplementedError('rename_one is abstract')
383
382
 
384
383
    def move(self, from_paths, to_name):
385
384
        """Rename files.
395
394
        This returns a list of (from_path, to_path) pairs for each
396
395
        entry that is moved.
397
396
        """
398
 
        raise NotImplementedError(self.move)
 
397
        raise NotImplementedError('move is abstract')
399
398
 
400
399
    def get_parent(self):
401
400
        """Return the parent location of the branch.
404
403
        pattern is that the user can override it by specifying a
405
404
        location.
406
405
        """
407
 
        raise NotImplementedError(self.get_parent)
 
406
        raise NotImplementedError('get_parent is abstract')
408
407
 
409
408
    def get_submit_branch(self):
410
409
        """Return the submit location of the branch.
426
425
 
427
426
    def get_push_location(self):
428
427
        """Return the None or the location to push this branch to."""
429
 
        raise NotImplementedError(self.get_push_location)
 
428
        raise NotImplementedError('get_push_location is abstract')
430
429
 
431
430
    def set_push_location(self, location):
432
431
        """Set a new push location for this branch."""
433
 
        raise NotImplementedError(self.set_push_location)
 
432
        raise NotImplementedError('set_push_location is abstract')
434
433
 
435
434
    def set_parent(self, url):
436
 
        raise NotImplementedError(self.set_parent)
 
435
        raise NotImplementedError('set_parent is abstract')
437
436
 
438
437
    @needs_write_lock
439
438
    def update(self):
1101
1100
        transaction = self.get_transaction()
1102
1101
        history = transaction.map.find_revision_history()
1103
1102
        if history is not None:
1104
 
            # mutter("cache hit for revision-history in %s", self)
 
1103
            mutter("cache hit for revision-history in %s", self)
1105
1104
            return list(history)
1106
 
        decode_utf8 = cache_utf8.decode
1107
 
        history = [decode_utf8(l.rstrip('\r\n')) for l in
1108
 
                self.control_files.get('revision-history').readlines()]
 
1105
        history = [l.rstrip('\r\n') for l in
 
1106
                self.control_files.get_utf8('revision-history').readlines()]
1109
1107
        transaction.map.add_revision_history(history)
1110
1108
        # this call is disabled because revision_history is 
1111
1109
        # not really an object yet, and the transaction is for objects.