fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Client-side XSLT renderer prototype.
[redakcja.git]
/
lib
/
wlrepo
/
mercurial_backend
/
document.py
diff --git
a/lib/wlrepo/mercurial_backend/document.py
b/lib/wlrepo/mercurial_backend/document.py
index
3bd26a6
..
77b8ead
100755
(executable)
--- a/
lib/wlrepo/mercurial_backend/document.py
+++ b/
lib/wlrepo/mercurial_backend/document.py
@@
-103,7
+103,7
@@
class MercurialDocument(wlrepo.Document):
self.invoke_and_commit(take_action, \
lambda d: ("$AUTO$ File checkout.", user) )
self.invoke_and_commit(take_action, \
lambda d: ("$AUTO$ File checkout.", user) )
- return self._library.document_for_rev(fullid)
+ return self._library.document_for_rev
ision
(fullid)
def up_to_date(self):
if self.ismain():
def up_to_date(self):
if self.ismain():
@@
-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"
# *
# /|
# *
# /|
@@
-190,14
+190,22
@@
class MercurialDocument(wlrepo.Document):
# | *
# | |
# We want to prevent stuff like this.
# | *
# | |
# We want to prevent stuff like this.
- if self.parent().parentof(shared):
- return False
+ if self.parent().parentof(shared) and shared.parentof(self):
+ return False, "Preventing zig-zag"
+
+ return True, "All ok"
def share(self, message):
lock = self.library.lock()
try:
def share(self, message):
lock = self.library.lock()
try:
+ # check if the document is in "updated" state
+ if not self.up_to_date():
+ raise wlrepo.OutdatedException("You must update your document before share.")
- if not self.would_share():
+ # now check if there is anything to do
+ need_work, info = self.would_share()
+
+ if not need_work:
return self.shared()
# The good situation
return self.shared()
# The good situation
@@
-209,15
+217,16
@@
class MercurialDocument(wlrepo.Document):
# / |
# main * *
# | |
# / |
# main * *
# | |
- if shared.ancestorof(self):
- success = shared._revision.merge_with(self._revision, user=self.owner, message=message)
+ shared = self.shared()
+ try:
+ success = shared._revision.merge_with(self._revision, user=self.owner, message=message)
if not success:
raise wlrepo.LibraryException("Merge failed.")
return shared.latest()
if not success:
raise wlrepo.LibraryException("Merge failed.")
return shared.latest()
-
-
raise wlrepo.LibraryException("Unrecognized share-state."
)
+ except Abort, e:
+
raise wlrepo.LibraryException( repr(e)
)
finally:
lock.release()
finally:
lock.release()