~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

[merge] aaron, various fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
from bzrlib.transport import Transport, get_transport
53
53
import bzrlib.xml5
54
54
import bzrlib.ui
 
55
from config import TreeConfig
55
56
 
56
57
 
57
58
BZR_BRANCH_FORMAT_4 = "Bazaar-NG branch, format 0.0.4\n"
154
155
        """
155
156
        self.cache_root = cache_root
156
157
 
 
158
    def _get_nick(self):
 
159
        cfg = self.tree_config()
 
160
        return cfg.get_option(u"nickname", default=self.base.split('/')[-1])
 
161
 
 
162
    def _set_nick(self, nick):
 
163
        cfg = self.tree_config()
 
164
        cfg.set_option(nick, "nickname")
 
165
        assert cfg.get_option("nickname") == nick
 
166
 
 
167
    nick = property(_get_nick, _set_nick)
 
168
        
157
169
    def push_stores(self, branch_to):
158
170
        """Copy the content of this branches store to branch_to."""
159
171
        raise NotImplementedError('push_stores is abstract')
1374
1386
        finally:
1375
1387
            f.close()
1376
1388
 
 
1389
    def tree_config(self):
 
1390
        return TreeConfig(self)
 
1391
 
 
1392
    def check_revno(self, revno):
 
1393
        """\
 
1394
        Check whether a revno corresponds to any revision.
 
1395
        Zero (the NULL revision) is considered valid.
 
1396
        """
 
1397
        if revno != 0:
 
1398
            self.check_real_revno(revno)
 
1399
            
 
1400
    def check_real_revno(self, revno):
 
1401
        """\
 
1402
        Check whether a revno corresponds to a real revision.
 
1403
        Zero (the NULL revision) is considered invalid
 
1404
        """
 
1405
        if revno < 1 or revno > self.revno():
 
1406
            raise InvalidRevisionNumber(revno)
 
1407
        
1377
1408
    def sign_revision(self, revision_id, gpg_strategy):
1378
1409
        """See Branch.sign_revision."""
1379
1410
        plaintext = Testament.from_revision(self, revision_id).as_short_text()