~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge_core.py

  • Committer: Robert Collins
  • Date: 2005-10-02 01:53:46 UTC
  • mfrom: (1393.1.23)
  • Revision ID: robertc@robertcollins.net-20051002015346-587422189352289e
merge from upstream newformat

Show diffs side-by-side

added added

removed removed

Lines of Context:
198
198
 
199
199
 
200
200
def get_contents(entry, tree):
 
201
    return get_id_contents(entry.id, tree)
 
202
 
 
203
def get_id_contents(file_id, tree):
201
204
    """Get a contents change element suitable for use with ReplaceContents
202
205
    """
203
 
    tree_entry = tree.tree.inventory[entry.id]
 
206
    tree_entry = tree.tree.inventory[file_id]
204
207
    if tree_entry.kind == "file":
205
 
        return changeset.FileCreate(tree.get_file(entry.id).read())
 
208
        return changeset.FileCreate(tree.get_file(file_id).read())
206
209
    else:
207
210
        assert tree_entry.kind in ("root_directory", "directory")
208
211
        return changeset.dir_create
224
227
        if contents.old_contents is None and contents.new_contents is None:
225
228
            return None
226
229
        if contents.new_contents is None:
 
230
            this_contents = get_contents(entry, this)
227
231
            if this_path is not None and os.path.exists(this_path):
 
232
                if this_contents != contents.old_contents:
 
233
                    return conflict_handler.rem_contents_conflict(this_path, 
 
234
                        this_contents, contents.old_contents)
228
235
                return contents
229
236
            else:
230
237
                return None