~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

Added support for branch nicks

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
from bzrlib.transport import Transport, get_transport
51
51
import bzrlib.xml5
52
52
import bzrlib.ui
 
53
from config import TreeConfig
53
54
 
54
55
 
55
56
BZR_BRANCH_FORMAT_4 = "Bazaar-NG branch, format 0.0.4\n"
152
153
        """
153
154
        self.cache_root = cache_root
154
155
 
 
156
    def _get_nick(self):
 
157
        cfg = self.tree_config()
 
158
        return cfg.get_option(u"nickname", default=self.base.split('/')[-1])
 
159
 
 
160
    def _set_nick(self, nick):
 
161
        cfg = self.tree_config()
 
162
        cfg.set_option(nick, "nickname")
 
163
        assert cfg.get_option("nickname") == nick
 
164
 
 
165
    nick = property(_get_nick, _set_nick)
 
166
        
 
167
 
155
168
 
156
169
class _Branch(Branch):
157
170
    """A branch stored in the actual filesystem.
1176
1189
        finally:
1177
1190
            f.close()
1178
1191
 
 
1192
    def tree_config(self):
 
1193
        return TreeConfig(self)
 
1194
 
1179
1195
    def check_revno(self, revno):
1180
1196
        """\
1181
1197
        Check whether a revno corresponds to any revision.
1202
1218
                                revision_id, "sig")
1203
1219
 
1204
1220
 
 
1221
 
1205
1222
class ScratchBranch(_Branch):
1206
1223
    """Special test class: a branch that cleans up after itself.
1207
1224