fnp
/
redakcja.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
7a12b55
)
Another pull/push fix.
author
Lukasz
<lreqc@debian.(none)>
Fri, 23 Oct 2009 10:27:40 +0000
(06:27 -0400)
committer
Lukasz
<lreqc@debian.(none)>
Fri, 23 Oct 2009 10:27:40 +0000
(06:27 -0400)
apps/api/handlers/library_handlers.py
patch
|
blob
|
history
lib/wlrepo/mercurial_backend/document.py
patch
|
blob
|
history
lib/wlrepo/mercurial_backend/library.py
patch
|
blob
|
history
lib/wlrepo/mercurial_backend/revision.py
patch
|
blob
|
history
platforma/static/js/models.js
patch
|
blob
|
history
diff --git
a/apps/api/handlers/library_handlers.py
b/apps/api/handlers/library_handlers.py
index
562ed1b
..
0a45a0b
100755
(executable)
--- a/
apps/api/handlers/library_handlers.py
+++ b/
apps/api/handlers/library_handlers.py
@@
-207,8
+207,8
@@
class DiffHandler(BaseHandler):
@hglibrary
def read(self, request, source_revision, target_revision, lib):
'''Return diff between source_revision and target_revision)'''
@hglibrary
def read(self, request, source_revision, target_revision, lib):
'''Return diff between source_revision and target_revision)'''
- source_document = lib.document_for_rev(source_revision)
- target_document = lib.document_for_rev(target_revision)
+ source_document = lib.document_for_rev
ision
(source_revision)
+ target_document = lib.document_for_rev
ision
(target_revision)
print source_document,
print target_document
diff = difflib.unified_diff(
print source_document,
print target_document
diff = difflib.unified_diff(
@@
-261,7
+261,7
@@
class DocumentHandler(BaseHandler):
elif is_prq(user):
prq = prq_for_user(user)
# commiter's document
elif is_prq(user):
prq = prq_for_user(user)
# commiter's document
- prq_doc = lib.document_for_rev(prq.source_revision)
+ prq_doc = lib.document_for_rev
ision
(prq.source_revision)
doc = prq_doc.take(user)
else:
return response.EntityNotFound().django_response({
doc = prq_doc.take(user)
else:
return response.EntityNotFound().django_response({
@@
-310,7
+310,7
@@
class DocumentHTMLHandler(BaseHandler):
try:
revision = form.cleaned_data['revision']
user = form.cleaned_data['user'] or request.user.username
try:
revision = form.cleaned_data['revision']
user = form.cleaned_data['user'] or request.user.username
- document = lib.document_for_rev(revision)
+ document = lib.document_for_rev
ision
(revision)
if document.id != docid:
return response.BadRequest().django_response({
if document.id != docid:
return response.BadRequest().django_response({
@@
-412,7
+412,7
@@
class DocumentGalleryHandler(BaseHandler):
# if revision == 'latest':
# doc = lib.document(docid)
# else:
# if revision == 'latest':
# doc = lib.document(docid)
# else:
-# doc = lib.document_for_rev(revision)
+# doc = lib.document_for_rev
ision
(revision)
#
#
# if document.id != docid:
#
#
# if document.id != docid:
@@
-437,7
+437,7
@@
class DocumentGalleryHandler(BaseHandler):
# msg = u"$AUTO$ Dublin core update."
#
# current = lib.document(docid, request.user.username)
# msg = u"$AUTO$ Dublin core update."
#
# current = lib.document(docid, request.user.username)
-# orig = lib.document_for_rev(revision)
+# orig = lib.document_for_rev
ision
(revision)
#
# if current != orig:
# return response.EntityConflict().django_response({
#
# if current != orig:
# return response.EntityConflict().django_response({
@@
-482,7
+482,7
@@
class MergeHandler(BaseHandler):
doc = lib.document(docid)
# fetch the base document
doc = lib.document(docid)
# fetch the base document
- user_doc = lib.document_for_rev(revision)
+ user_doc = lib.document_for_rev
ision
(revision)
base_doc = user_doc.latest()
if base_doc != user_doc:
base_doc = user_doc.latest()
if base_doc != user_doc:
@@
-512,9
+512,11
@@
class MergeHandler(BaseHandler):
"message": "You must first update your branch to the latest version."
})
"message": "You must first update your branch to the latest version."
})
- if not base_doc.would_share():
+ anwser, info = base_doc.would_share()
+
+ if not anwser:
return response.SuccessAllOk().django_response({
return response.SuccessAllOk().django_response({
- "result": "no-op"
+ "result": "no-op"
, "message": info
})
# check for unresolved conflicts
})
# check for unresolved conflicts
diff --git
a/lib/wlrepo/mercurial_backend/document.py
b/lib/wlrepo/mercurial_backend/document.py
index
3bd26a6
..
35779d8
100755
(executable)
--- a/
lib/wlrepo/mercurial_backend/document.py
+++ b/
lib/wlrepo/mercurial_backend/document.py
@@
-168,13
+168,13
@@
class MercurialDocument(wlrepo.Document):
def would_share(self):
if self.ismain():
def would_share(self):
if self.ismain():
- return False
+ return False
, "Main version is always shared"
shared = self.shared()
# we just did this - move on
if self.parentof(shared):
shared = self.shared()
# we just did this - move on
if self.parentof(shared):
- return False
+ return False
, "Document has been recetly shared - no changes"
# *
# /|
# *
# /|
@@
-191,13
+191,17
@@
class MercurialDocument(wlrepo.Document):
# | |
# We want to prevent stuff like this.
if self.parent().parentof(shared):
# | |
# We want to prevent stuff like this.
if self.parent().parentof(shared):
- return False
+ return False, "Preventing zig-zag"
+
+ return True, "OK"
+
def share(self, message):
lock = self.library.lock()
try:
def share(self, message):
lock = self.library.lock()
try:
+ result, info = self.would_share()
- if not
self.would_share()
:
+ if not
result
:
return self.shared()
# The good situation
return self.shared()
# The good situation
@@
-209,6
+213,8
@@
class MercurialDocument(wlrepo.Document):
# / |
# main * *
# | |
# / |
# main * *
# | |
+ shared = self.shared()
+
if shared.ancestorof(self):
success = shared._revision.merge_with(self._revision, user=self.owner, message=message)
if shared.ancestorof(self):
success = shared._revision.merge_with(self._revision, user=self.owner, message=message)
diff --git
a/lib/wlrepo/mercurial_backend/library.py
b/lib/wlrepo/mercurial_backend/library.py
index
316800f
..
5535a88
100755
(executable)
--- a/
lib/wlrepo/mercurial_backend/library.py
+++ b/
lib/wlrepo/mercurial_backend/library.py
@@
-99,14
+99,14
@@
class MercurialLibrary(wlrepo.Library):
rev = self._sanitize_string(rev)
if rev != u'latest':
rev = self._sanitize_string(rev)
if rev != u'latest':
- doc = self.document_for_rev(rev)
+ doc = self.document_for_rev
ision
(rev)
if doc.id != docid or (doc.owner != user):
raise wlrepo.RevisionMismatch(self.fulldocid(docid, user)+u'@'+unicode(rev))
return doc
else:
if doc.id != docid or (doc.owner != user):
raise wlrepo.RevisionMismatch(self.fulldocid(docid, user)+u'@'+unicode(rev))
return doc
else:
- return self.document_for_rev(self.fulldocid(docid, user))
+ return self.document_for_rev
ision
(self.fulldocid(docid, user))
def get_revision(self, revid):
revid = self._sanitize_string(revid)
def get_revision(self, revid):
revid = self._sanitize_string(revid)
@@
-121,9
+121,12
@@
class MercurialLibrary(wlrepo.Library):
if ctx is None:
raise wlrepo.RevisionNotFound(revid)
if ctx is None:
raise wlrepo.RevisionNotFound(revid)
+ return self._revision(ctx)
+
+ def _revision(self, ctx):
if self._revcache.has_key(ctx):
return self._revcache[ctx]
if self._revcache.has_key(ctx):
return self._revcache[ctx]
-
+
return MercurialRevision(self, ctx)
def fulldocid(self, docid, user=None):
return MercurialRevision(self, ctx)
def fulldocid(self, docid, user=None):
@@
-140,8
+143,7
@@
class MercurialLibrary(wlrepo.Library):
except mercurial.error.RepoError:
return False
except mercurial.error.RepoError:
return False
- def document_create(self, docid):
-
+ def document_create(self, docid):
# check if it already exists
fullid = self.fulldocid(docid)
# check if it already exists
fullid = self.fulldocid(docid)
@@
-151,7
+153,7
@@
class MercurialLibrary(wlrepo.Library):
# doesn't exist
self._create_branch(self._sanitize_string(fullid))
# doesn't exist
self._create_branch(self._sanitize_string(fullid))
- return self.document_for_rev(fullid)
+ return self.document_for_rev
ision
(fullid)
#
# Private methods
#
# Private methods
diff --git
a/lib/wlrepo/mercurial_backend/revision.py
b/lib/wlrepo/mercurial_backend/revision.py
index
80b761f
..
5b1b820
100755
(executable)
--- a/
lib/wlrepo/mercurial_backend/revision.py
+++ b/
lib/wlrepo/mercurial_backend/revision.py
@@
-103,9
+103,12
@@
class MercurialRevision(wlrepo.Revision):
parents = self._changectx.parents()
if len(parents) == 1:
parents = self._changectx.parents()
if len(parents) == 1:
- return parents[0]
-
- return parents[0] if (parents[0].branch() == self.branch()) else parents[1]
+ return self._library._revision(parents[0])
+
+ if parents[0].branch() == self.branch():
+ return self._library._revision(parents[0])
+ else:
+ return self._library._revision(parents[1])
def __eq__(self, other):
return self._changectx.node() == other._changectx.node()
def __eq__(self, other):
return self._changectx.node() == other._changectx.node()
diff --git
a/platforma/static/js/models.js
b/platforma/static/js/models.js
index
ffaf999
..
7fdca39
100755
(executable)
--- a/
platforma/static/js/models.js
+++ b/
platforma/static/js/models.js
@@
-596,10
+596,13
@@
Editor.DocumentModel = Editor.Model.extend({
mergeCompleted: function(xhr, textStatus) {
console.log(xhr.status, xhr.responseText);
var response = parseXHRResponse(xhr);
mergeCompleted: function(xhr, textStatus) {
console.log(xhr.status, xhr.responseText);
var response = parseXHRResponse(xhr);
- if(response.success)
- {
- if( (response.data.result == 'no-op')
- || (response.data.shared_timestamp == response.data.shared_parent_timestamp))
+
+ if(response.success) {
+
+ if( (response.data.result == 'no-op') ||
+ ( response.data.shared_parent_timestamp
+ && response.data.shared_timestamp
+ && (response.data.shared_timestamp == response.data.shared_parent_timestamp)) )
{
if( (response.data.revision) && (response.data.revision != this.get('revision')) )
{
{
if( (response.data.revision) && (response.data.revision != this.get('revision')) )
{