~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: abentley
  • Date: 2005-10-14 02:34:55 UTC
  • mto: (1185.25.1)
  • mto: This revision was merged to the branch mainline in revision 1460.
  • Revision ID: abentley@lappy-20051014023455-a86628f6fdc2e6d1
Removed all remaining use of readonly_path

Show diffs side-by-side

added added

removed removed

Lines of Context:
124
124
 
125
125
    def new_contents_conflict(self, filename, other_contents):
126
126
        """Conflicting contents for newly added file."""
127
 
        self.copy(other_contents, filename + ".OTHER")
 
127
        other.contents.apply(filename + ".OTHER")
128
128
        self.conflict("Conflict in newly added file %s" % filename)
129
129
    
130
130
 
232
232
    """MergeAdapterTree adapts a normal tree for merge_inner to use.
233
233
 
234
234
    The interface the merge_inner needs is nearly but not quite
235
 
    the same as that of bzrlib.tree with the exception of readonly_path.
 
235
    the same as that of bzrlib.tree.
236
236
    """
237
237
    
238
238
    def __init__(self, tree, tempdir):
278
278
            return True
279
279
        return self.tree.inventory.has_id(file_id)
280
280
 
281
 
    def readonly_path(self, id):
282
 
        if id not in self.tree:
283
 
            return None
284
 
        if self.root is not None:
285
 
            return self.tree.abspath(self.tree.id2path(id))
286
 
        else:
287
 
            kind = self.tree.inventory[id].kind
288
 
            if kind in ("directory", "root_directory"):
289
 
                return self.tempdir
290
 
            if not self.cached.has_key(id):
291
 
                if kind == "file":
292
 
                    path = os.path.join(self.tempdir, "texts", id)
293
 
                    outfile = file(path, "wb")
294
 
                    outfile.write(self.tree.get_file(id).read())
295
 
                    assert(bzrlib.osutils.lexists(path))
296
 
                    if self.tree.is_executable(id):
297
 
                        os.chmod(path, 0755)
298
 
                else:
299
 
                    assert kind == "symlink"
300
 
                    path = os.path.join(self.tempdir, "symlinks", id)
301
 
                    target = self.tree.get_symlink_target(id)
302
 
                    os.symlink(target, path)
303
 
                self.cached[id] = path
304
 
            return self.cached[id]
305
 
 
306
281
    def kind(self, file_id):
307
282
        return self.tree.kind(file_id)
308
283
 
309
284
    def get_symlink_target(self, file_id):
310
285
        return self.tree.get_symlink_target(file_id)
311
286
 
 
287
    def id2abspath(self, file_id):
 
288
        return self.tree.id2abspath(file_id)
 
289
 
312
290
 
313
291
def build_working_dir(to_dir):
314
292
    """Build a working directory in an empty directory.