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

Merge with walkdirs

Show diffs side-by-side

added added

removed removed

Lines of Context:
1296
1296
 
1297
1297
    upgrade_recommended = False
1298
1298
 
 
1299
    _tree_class = WorkingTree4
 
1300
 
1299
1301
    def get_format_string(self):
1300
1302
        """See WorkingTreeFormat.get_format_string()."""
1301
1303
        return "Bazaar Working Tree Format 4 (bzr 0.15)\n"
1339
1341
        state = dirstate.DirState.initialize(local_path)
1340
1342
        state.unlock()
1341
1343
        del state
1342
 
        wt = WorkingTree4(a_bzrdir.root_transport.local_abspath('.'),
 
1344
        wt = self._tree_class(a_bzrdir.root_transport.local_abspath('.'),
1343
1345
                         branch,
1344
1346
                         _format=self,
1345
1347
                         _bzrdir=a_bzrdir,
1347
1349
        wt._new_tree()
1348
1350
        wt.lock_tree_write()
1349
1351
        try:
 
1352
            self._init_custom_control_files(wt)
1350
1353
            if revision_id in (None, NULL_REVISION):
1351
1354
                if branch.repository.supports_rich_root():
1352
1355
                    wt._set_root_id(generate_ids.gen_root_id())
1390
1393
            wt.unlock()
1391
1394
        return wt
1392
1395
 
 
1396
    def _init_custom_control_files(self, wt):
 
1397
        """Subclasses with custom control files should override this method.
 
1398
        
 
1399
        The working tree and control files are locked for writing when this
 
1400
        method is called.
 
1401
        
 
1402
        :param wt: the WorkingTree object
 
1403
        """
 
1404
 
1393
1405
    def _open(self, a_bzrdir, control_files):
1394
1406
        """Open the tree itself.
1395
1407
 
1396
1408
        :param a_bzrdir: the dir for the tree.
1397
1409
        :param control_files: the control files for the tree.
1398
1410
        """
1399
 
        return WorkingTree4(a_bzrdir.root_transport.local_abspath('.'),
 
1411
        return self._tree_class(a_bzrdir.root_transport.local_abspath('.'),
1400
1412
                           branch=a_bzrdir.open_branch(),
1401
1413
                           _format=self,
1402
1414
                           _bzrdir=a_bzrdir,
1968
1980
        # record is handled, but isn't interesting to process (unchanged)
1969
1981
        uninteresting = object()
1970
1982
 
1971
 
 
1972
1983
        old_dirname_to_file_id = {}
1973
1984
        new_dirname_to_file_id = {}
1974
1985
        # TODO: jam 20070516 - Avoid the _get_entry lookup overhead by
2157
2168
                    return uninteresting
2158
2169
            elif source_minikind in 'a' and target_minikind in 'fdlt':
2159
2170
                # looks like a new file
 
2171
                path = pathjoin(entry[0][0], entry[0][1])
 
2172
                # parent id is the entry for the path in the target tree
 
2173
                # TODO: these are the same for an entire directory: cache em.
 
2174
                parent_id = state._get_entry(target_index,
 
2175
                                             path_utf8=entry[0][0])[0][2]
 
2176
                if parent_id == entry[0][2]:
 
2177
                    parent_id = None
2160
2178
                if path_info is not None:
2161
 
                    path = pathjoin(entry[0][0], entry[0][1])
2162
 
                    # parent id is the entry for the path in the target tree
2163
 
                    # TODO: these are the same for an entire directory: cache em.
2164
 
                    parent_id = state._get_entry(target_index,
2165
 
                                                 path_utf8=entry[0][0])[0][2]
2166
 
                    if parent_id == entry[0][2]:
2167
 
                        parent_id = None
 
2179
                    # Present on disk:
2168
2180
                    if use_filesystem_for_exec:
2169
2181
                        # We need S_ISREG here, because we aren't sure if this
2170
2182
                        # is a file or not.
2182
2194
                           (None, path_info[2]),
2183
2195
                           (None, target_exec))
2184
2196
                else:
2185
 
                    # but its not on disk: we deliberately treat this as just
2186
 
                    # never-present. (Why ?! - RBC 20070224)
2187
 
                    pass
 
2197
                    # Its a missing file, report it as such.
 
2198
                    return (entry[0][2],
 
2199
                           (None, utf8_decode(path)[0]),
 
2200
                           False,
 
2201
                           (False, True),
 
2202
                           (None, parent_id),
 
2203
                           (None, utf8_decode(entry[0][1])[0]),
 
2204
                           (None, None),
 
2205
                           (None, False))
2188
2206
            elif source_minikind in 'fdlt' and target_minikind in 'a':
2189
2207
                # unversioned, possibly, or possibly not deleted: we dont care.
2190
2208
                # if its still on disk, *and* theres no other entry at this
2509
2527
                    except StopIteration:
2510
2528
                        current_dir_info = None
2511
2529
 
2512
 
 
2513
2530
    @staticmethod
2514
2531
    def is_compatible(source, target):
2515
2532
        # the target must be a dirstate working tree