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

  • Committer: Aaron Bentley
  • Date: 2008-06-24 19:55:53 UTC
  • mto: (3363.8.1 stored_kind)
  • mto: This revision was merged to the branch mainline in revision 3517.
  • Revision ID: aaron@aaronbentley.com-20080624195553-9q1pboo9aduba0w4
More removals of post-tree support

Show diffs side-by-side

added added

removed removed

Lines of Context:
127
127
        # Cache of relpath results, to speed up canonical_path
128
128
        self._relpaths = {}
129
129
        # The trans_id that will be used as the tree root
130
 
        root_id = tree.get_root_id()
131
 
        if root_id is not None:
132
 
            self._new_root = self.trans_id_tree_file_id(root_id)
133
 
        else:
134
 
            self._new_root = None
 
130
        self._new_root = self.trans_id_tree_file_id(tree.get_root_id())
135
131
        # Indictor of whether the transform has been applied
136
132
        self._done = False
137
133
        # A progress bar
260
256
        This reflects only files that already exist, not ones that will be
261
257
        added by transactions.
262
258
        """
263
 
        if inventory_id is None:
264
 
            raise ValueError('None is not a valid file id')
265
259
        path = self._tree.id2path(inventory_id)
266
260
        return self.trans_id_tree_path(path)
267
261
 
271
265
        a transaction has been unversioned, it is deliberately still returned.
272
266
        (this will likely lead to an unversioned parent conflict.)
273
267
        """
274
 
        if file_id is None:
275
 
            raise ValueError('None is not a valid file id')
276
268
        if file_id in self._r_new_id and self._r_new_id[file_id] is not None:
277
269
            return self._r_new_id[file_id]
278
270
        elif file_id in self._tree.inventory:
2052
2044
    tt = TreeTransform(working_tree, pb)
2053
2045
    try:
2054
2046
        pp = ProgressPhase("Revert phase", 3, pb)
2055
 
        conflicts, merge_modified = _prepare_revert_transform(
2056
 
            working_tree, target_tree, tt, filenames, backups, pp)
 
2047
        pp.next_phase()
 
2048
        child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
 
2049
        try:
 
2050
            merge_modified = _alter_files(working_tree, target_tree, tt,
 
2051
                                          child_pb, filenames, backups)
 
2052
        finally:
 
2053
            child_pb.finished()
 
2054
        pp.next_phase()
 
2055
        child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
 
2056
        try:
 
2057
            raw_conflicts = resolve_conflicts(tt, child_pb,
 
2058
                lambda t, c: conflict_pass(t, c, target_tree))
 
2059
        finally:
 
2060
            child_pb.finished()
 
2061
        conflicts = cook_conflicts(raw_conflicts, tt)
2057
2062
        if change_reporter:
2058
2063
            change_reporter = delta._ChangeReporter(
2059
2064
                unversioned_filter=working_tree.is_ignored)
2070
2075
    return conflicts
2071
2076
 
2072
2077
 
2073
 
def _prepare_revert_transform(working_tree, target_tree, tt, filenames,
2074
 
                              backups, pp):
2075
 
    pp.next_phase()
2076
 
    child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
2077
 
    try:
2078
 
        merge_modified = _alter_files(working_tree, target_tree, tt,
2079
 
                                      child_pb, filenames, backups)
2080
 
    finally:
2081
 
        child_pb.finished()
2082
 
    pp.next_phase()
2083
 
    child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
2084
 
    try:
2085
 
        raw_conflicts = resolve_conflicts(tt, child_pb,
2086
 
            lambda t, c: conflict_pass(t, c, target_tree))
2087
 
    finally:
2088
 
        child_pb.finished()
2089
 
    conflicts = cook_conflicts(raw_conflicts, tt)
2090
 
    return conflicts, merge_modified
2091
 
 
2092
 
 
2093
2078
def _alter_files(working_tree, target_tree, tt, pb, specific_files,
2094
2079
                 backups):
2095
2080
    merge_modified = working_tree.merge_modified()
2168
2153
                tt.version_file(file_id, trans_id)
2169
2154
            if versioned == (True, False):
2170
2155
                tt.unversion_file(trans_id)
2171
 
            if (name[1] is not None and
 
2156
            if (name[1] is not None and 
2172
2157
                (name[0] != name[1] or parent[0] != parent[1])):
2173
 
                if name[1] == '' and parent[1] is None:
2174
 
                    parent_trans = ROOT_PARENT
2175
 
                else:
2176
 
                    parent_trans = tt.trans_id_file_id(parent[1])
2177
 
                tt.adjust_path(name[1], parent_trans, trans_id)
 
2158
                tt.adjust_path(
 
2159
                    name[1], tt.trans_id_file_id(parent[1]), trans_id)
2178
2160
            if executable[0] != executable[1] and kind[1] == "file":
2179
2161
                tt.set_executability(executable[1], trans_id)
2180
2162
        for (trans_id, mode_id), bytes in target_tree.iter_files_bytes(