fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixes
[redakcja.git]
/
src
/
dvcs
/
models.py
diff --git
a/src/dvcs/models.py
b/src/dvcs/models.py
index
24bdeb3
..
d6b0cc6
100644
(file)
--- a/
src/dvcs/models.py
+++ b/
src/dvcs/models.py
@@
-11,7
+11,7
@@
from django.core.files.base import ContentFile
from django.db import models, transaction
from django.db.models.base import ModelBase
from django.utils.translation import string_concat, ugettext_lazy as _
from django.db import models, transaction
from django.db.models.base import ModelBase
from django.utils.translation import string_concat, ugettext_lazy as _
-from mercurial import simplemerge
+import merge3
from django.conf import settings
from dvcs.signals import post_commit, post_publishable
from django.conf import settings
from dvcs.signals import post_commit, post_publishable
@@
-30,7
+30,7
@@
class Tag(models.Model):
abstract = True
ordering = ['ordering']
abstract = True
ordering = ['ordering']
- def __
unicode
__(self):
+ def __
str
__(self):
return self.name
@classmethod
return self.name
@classmethod
@@
-93,7
+93,7
@@
class Change(models.Model):
ordering = ('created_at',)
unique_together = ['tree', 'revision']
ordering = ('created_at',)
unique_together = ['tree', 'revision']
- def __
unicode
__(self):
+ def __
str
__(self):
return u"Id: %r, Tree %r, Parent %r, Data: %s" % (self.id, self.tree_id, self.parent_id, self.data)
def author_str(self):
return u"Id: %r, Tree %r, Parent %r, Data: %s" % (self.id, self.tree_id, self.parent_id, self.data)
def author_str(self):
@@
-124,7
+124,7
@@
class Change(models.Model):
f = self.data.storage.open(self.data)
text = f.read()
f.close()
f = self.data.storage.open(self.data)
text = f.read()
f.close()
- return
unicode
(text, 'utf-8')
+ return
str
(text, 'utf-8')
def merge_with(self, other, author=None,
author_name=None, author_email=None,
def merge_with(self, other, author=None,
author_name=None, author_email=None,
@@
-135,11
+135,11
@@
class Change(models.Model):
# immediate child - fast forward
return other
# immediate child - fast forward
return other
- local = self.materialize().
encode('utf-8'
)
- base = other.parent.materialize().
encode('utf-8'
)
- remote = other.materialize().
encode('utf-8'
)
+ local = self.materialize().
splitlines(True
)
+ base = other.parent.materialize().
splitlines(True
)
+ remote = other.materialize().
splitlines(True
)
- merge =
simplemerge.Merge3Text
(base, local, remote)
+ merge =
merge3.Merge3
(base, local, remote)
result = ''.join(merge.merge_lines())
merge_node = self.children.create(
merge_parent=other, tree=self.tree,
result = ''.join(merge.merge_lines())
merge_node = self.children.create(
merge_parent=other, tree=self.tree,
@@
-225,11
+225,9
@@
class DocumentMeta(ModelBase):
return model
return model
-class Document(models.Model):
+class Document(models.Model
, metaclass=DocumentMeta
):
"""File in repository. Subclass it to use version control in your app."""
"""File in repository. Subclass it to use version control in your app."""
- __metaclass__ = DocumentMeta
-
# default repository path
REPO_PATH = os.path.join(settings.MEDIA_ROOT, 'dvcs')
# default repository path
REPO_PATH = os.path.join(settings.MEDIA_ROOT, 'dvcs')
@@
-238,7
+236,7
@@
class Document(models.Model):
class Meta:
abstract = True
class Meta:
abstract = True
- def __
unicode
__(self):
+ def __
str
__(self):
return u"{0}, HEAD: {1}".format(self.id, self.head_id)
def materialize(self, change=None):
return u"{0}, HEAD: {1}".format(self.id, self.head_id)
def materialize(self, change=None):
@@
-256,12
+254,12
@@
class Document(models.Model):
This will automatically merge the commit into the main branch,
if parent is not document's head.
This will automatically merge the commit into the main branch,
if parent is not document's head.
- :param
unicode
text: new version of the document
+ :param
str
text: new version of the document
:param parent: parent revision (head, if not specified)
:type parent: Change or None
:param User author: the commiter
:param parent: parent revision (head, if not specified)
:type parent: Change or None
:param User author: the commiter
- :param
unicode
author_name: commiter name (if ``author`` not specified)
- :param
unicode
author_email: commiter e-mail (if ``author`` not specified)
+ :param
str
author_name: commiter name (if ``author`` not specified)
+ :param
str
author_email: commiter e-mail (if ``author`` not specified)
:param Tag[] tags: list of tags to apply to the new commit
:param bool publishable: set new commit as ready to publish
:returns: new head
:param Tag[] tags: list of tags to apply to the new commit
:param bool publishable: set new commit as ready to publish
:returns: new head