~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge_core.py

  • Committer: Martin Pool
  • Date: 2005-09-30 06:39:42 UTC
  • mfrom: (1185.10.11)
  • mto: (1185.14.2)
  • mto: This revision was merged to the branch mainline in revision 1396.
  • Revision ID: mbp@sourcefrog.net-20050930063942-3eab86500bffba49
- merge merge and export fixes from aaron
aaron.bentley@utoronto.ca-20050930040234-71c1a151f795e806

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