~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge_core.py

  • Committer: Aaron Bentley
  • Date: 2005-08-11 19:54:55 UTC
  • mto: (1092.1.41) (1185.3.4) (974.1.47)
  • mto: This revision was merged to the branch mainline in revision 1110.
  • Revision ID: abentley@panoramicfeedback.com-20050811195455-91f52bb566728ac7
Fixed spurious new_contents_conflict

Show diffs side-by-side

added added

removed removed

Lines of Context:
218
218
            if this_path is None or not os.path.exists(this_path):
219
219
                return contents
220
220
            else:
221
 
                this_contents = file(this_path, "rb").read()
 
221
                this_contents = changeset.FileCreate(file(this_path, 
 
222
                                                     "rb").read())
222
223
                if this_contents == contents.new_contents:
223
224
                    return None
224
225
                else:
383
384
                tree.remove_file(id)
384
385
            if other or base:
385
386
                change = self.cset.entries[id].contents_change
386
 
                assert isinstance(change, changeset.ReplaceContents)
 
387
                if change is None:
 
388
                    change = changeset.ReplaceContents(None, None)
 
389
                    self.cset.entries[id].contents_change = change
 
390
                    def create_file(tree):
 
391
                        return changeset.FileCreate(tree.get_file(id).read())
 
392
                    if not other:
 
393
                        change.new_contents = create_file(self.other)
 
394
                    if not base:
 
395
                        change.old_contents = create_file(self.base)
 
396
                else:
 
397
                    assert isinstance(change, changeset.ReplaceContents)
387
398
                if other:
388
399
                    change.new_contents=None
389
400
                if base:
638
649
        builder.add_file("2", "0", "name3", "text2", 0655)
639
650
        builder.change_contents("2", base="text5")
640
651
        builder.add_file("3", "0", "name5", "text3", 0744)
 
652
        builder.add_file("4", "0", "name6", "text4", 0744)
 
653
        builder.remove_file("4", base=True)
 
654
        assert not builder.cset.entries["4"].is_boring()
641
655
        builder.change_contents("3", this="text6")
642
656
        cset = builder.merge_changeset(merge_factory)
643
657
        assert(cset.entries["1"].contents_change is not None)
647
661
            assert(isinstance(cset.entries["2"].contents_change,
648
662
                          merge_factory))
649
663
        assert(cset.entries["3"].is_boring())
 
664
        assert(cset.entries["4"].is_boring())
650
665
        builder.apply_changeset(cset)
651
666
        assert(file(builder.this.full_path("1"), "rb").read() == "text4" )
652
667
        assert(file(builder.this.full_path("2"), "rb").read() == "text2" )