- # special care for merged nodes
- if self.parent is None and self.merge_parent is not None:
- return self.apply_to(self.merge_parent.materialize())
-
- changes = self.tree.change_set.exclude(parent=None).filter(
- revision__lte=self.revision).order_by('revision')
- text = u''
- for change in changes:
- text = change.apply_to(text)
- return text
-
- def make_child(self, patch, description, author=None,
- author_name=None, author_email=None, tags=None):
- ch = self.children.create(patch=patch,
- tree=self.tree, author=author,
- author_name=author_name,
- author_email=author_email,
- description=description)
- if tags is not None:
- ch.tags = tags
- return ch
-
- def make_merge_child(self, patch, description, author=None,
- author_name=None, author_email=None, tags=None):
- ch = self.merge_children.create(patch=patch,
- tree=self.tree, author=author,
- author_name=author_name,
- author_email=author_email,
- description=description,
- tags=tags)
- if tags is not None:
- ch.tags = tags
- return ch
-
- def apply_to(self, text):
- return mdiff.patch(text, pickle.loads(self.patch.encode('ascii')))
-
- def merge_with(self, other, author=None,
- author_name=None, author_email=None,
- description=u"Automatic merge."):
+ f = self.data.storage.open(self.data)
+ text = f.read()
+ f.close()
+ return unicode(text, 'utf-8')
+
+ def merge_with(self, other, author=None, author_name=None, author_email=None, description=u"Automatic merge."):
+ """Performs an automatic merge after straying commits."""