/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 extras

Show diffs side-by-side

added added

removed removed

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