~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge_core.py

  • Committer: aaron.bentley at utoronto
  • Date: 2005-08-22 04:35:12 UTC
  • mto: (974.1.47)
  • mto: This revision was merged to the branch mainline in revision 1178.
  • Revision ID: aaron.bentley@utoronto.ca-20050822043512-f4a78ccc9692974f
Handled directories better when merging

Show diffs side-by-side

added added

removed removed

Lines of Context:
197
197
    return new_entry
198
198
 
199
199
 
 
200
def get_contents(entry, tree):
 
201
    """Get a contents change element suitable for use with ReplaceContents
 
202
    """
 
203
    tree_entry = tree.tree.inventory[entry.id]
 
204
    if tree_entry.kind == "file":
 
205
        return changeset.FileCreate(tree.get_file(entry.id).read())
 
206
    else:
 
207
        assert tree_entry.kind in ("root_directory", "directory")
 
208
        return changeset.dir_create
 
209
 
 
210
 
200
211
def make_merged_contents(entry, this, base, other, conflict_handler,
201
212
                         merge_factory):
202
213
    contents = entry.contents_change
221
232
            if this_path is None or not os.path.exists(this_path):
222
233
                return contents
223
234
            else:
224
 
                this_contents = changeset.FileCreate(file(this_path, 
225
 
                                                     "rb").read())
 
235
                this_contents = get_contents(entry, this)
226
236
                if this_contents == contents.new_contents:
227
237
                    return None
228
238
                else: