/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

Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
     * set_executability
74
74
    """
75
75
    def __init__(self, tree, pb=DummyProgress()):
76
 
        """Note: a write lock is taken on the tree.
 
76
        """Note: a tree_write lock is taken on the tree.
77
77
        
78
78
        Use TreeTransform.finalize() to release the lock
79
79
        """
80
80
        object.__init__(self)
81
81
        self._tree = tree
82
 
        self._tree.lock_write()
 
82
        self._tree.lock_tree_write()
83
83
        try:
84
84
            control_files = self._tree._control_files
85
85
            self._limbodir = urlutils.local_path_from_url(
292
292
        except KeyError:
293
293
            return
294
294
        try:
295
 
            mode = os.stat(old_path).st_mode
 
295
            mode = os.stat(self._tree.abspath(old_path)).st_mode
296
296
        except OSError, e:
297
297
            if e.errno == errno.ENOENT:
298
298
                return
1086
1086
def create_by_entry(tt, entry, tree, trans_id, lines=None, mode_id=None):
1087
1087
    """Create new file contents according to an inventory entry."""
1088
1088
    if entry.kind == "file":
1089
 
        if lines == None:
 
1089
        if lines is None:
1090
1090
            lines = tree.get_file(entry.file_id).readlines()
1091
1091
        tt.create_file(lines, trans_id, mode_id=mode_id)
1092
1092
    elif entry.kind == "symlink":
1229
1229
        pp.next_phase()
1230
1230
        wt_interesting = [i for i in working_tree.inventory if interesting(i)]
1231
1231
        child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
 
1232
        basis_tree = None
1232
1233
        try:
1233
1234
            for id_num, file_id in enumerate(wt_interesting):
1234
1235
                child_pb.update("New file check", id_num+1, 
1240
1241
                        file_kind = working_tree.kind(file_id)
1241
1242
                    except NoSuchFile:
1242
1243
                        file_kind = None
 
1244
                    delete_merge_modified = (file_id in merge_modified)
1243
1245
                    if file_kind != 'file' and file_kind is not None:
1244
1246
                        keep_contents = False
1245
 
                        delete_merge_modified = False
1246
1247
                    else:
 
1248
                        if basis_tree is None:
 
1249
                            basis_tree = working_tree.basis_tree()
 
1250
                        wt_sha1 = working_tree.get_file_sha1(file_id)
1247
1251
                        if (file_id in merge_modified and 
1248
 
                            merge_modified[file_id] == 
1249
 
                            working_tree.get_file_sha1(file_id)):
1250
 
                            keep_contents = False
1251
 
                            delete_merge_modified = True
 
1252
                            merge_modified[file_id] == wt_sha1):
 
1253
                            keep_contents = False
 
1254
                        elif (file_id in basis_tree and 
 
1255
                            basis_tree.get_file_sha1(file_id) == wt_sha1):
 
1256
                            keep_contents = False
1252
1257
                        else:
1253
1258
                            keep_contents = True
1254
 
                            delete_merge_modified = False
1255
1259
                    if not keep_contents:
1256
1260
                        tt.delete_contents(trans_id)
1257
1261
                    if delete_merge_modified: