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

Start WorkingTree -> .bzr/checkout transition

Show diffs side-by-side

added added

removed removed

Lines of Context:
1109
1109
    return False
1110
1110
 
1111
1111
 
1112
 
class WorkingTreeFormat2(object):
 
1112
class WorkingTreeFormat(object):
 
1113
    """An encapsulation of the initialization and open routines for a format.
 
1114
 
 
1115
    Formats provide three things:
 
1116
     * An initialization routine,
 
1117
     * a format string,
 
1118
     * an open routine.
 
1119
 
 
1120
    Formats are placed in an dict by their format string for reference 
 
1121
    during workingtree opening. Its not required that these be instances, they
 
1122
    can be classes themselves with class methods - it simply depends on 
 
1123
    whether state is needed for a given format or not.
 
1124
 
 
1125
    Once a format is deprecated, just deprecate the initialize and open
 
1126
    methods on the format class. Do not deprecate the object, as the 
 
1127
    object will be created every time regardless.
 
1128
    """
 
1129
 
 
1130
    def get_format_string(self):
 
1131
        """Return the ASCII format string that identifies this format."""
 
1132
        raise NotImplementedError(self.get_format_string)
 
1133
 
 
1134
 
 
1135
 
 
1136
class WorkingTreeFormat2(WorkingTreeFormat):
1113
1137
    """The second working tree format. 
1114
1138
 
1115
1139
    This format modified the hash cache from the format 1 hash cache.
1138
1162
        result.bzrdir = a_bzrdir
1139
1163
        result._format = self
1140
1164
        return result
 
1165
 
 
1166
 
 
1167
class WorkingTreeFormat3(WorkingTreeFormat):
 
1168
    """The second working tree format updated to record a format marker.
 
1169
 
 
1170
    This format modified the hash cache from the format 1 hash cache.
 
1171
    """
 
1172
 
 
1173
    def get_format_string(self):
 
1174
        """See WorkingTreeFormat.get_format_string()."""
 
1175
        return "Bazaar-NG Working Tree format 3"
 
1176
 
 
1177
    def initialize(self, a_bzrdir):
 
1178
        """See WorkingTreeFormat.initialize()."""
 
1179
        if not isinstance(a_bzrdir.transport, LocalTransport):
 
1180
            raise errors.NotLocalUrl(a_bzrdir.transport.base)
 
1181
        result = WorkingTree.create(a_bzrdir.open_branch(),
 
1182
                                  a_bzrdir.transport.clone('..').base)
 
1183
        result.bzrdir = a_bzrdir
 
1184
        result._format = self
 
1185
        return result
 
1186
 
 
1187
    def open(self, a_bzrdir, _found=False):
 
1188
        """Return the WorkingTree object for a_bzrdir
 
1189
 
 
1190
        _found is a private parameter, do not use it. It is used to indicate
 
1191
               if format probing has already been done.
 
1192
        """
 
1193
        if not _found:
 
1194
            # we are being called directly and must probe.
 
1195
            raise NotImplementedError
 
1196
        result = WorkingTree(a_bzrdir.transport.clone('..').base)
 
1197
        result.bzrdir = a_bzrdir
 
1198
        result._format = self
 
1199
        return result