fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
HTML iupdate.
[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
c7f2f9f
..
523e330
100644
(file)
--- a/
lib/wlrepo/mercurial_backend/document.py
+++ b/
lib/wlrepo/mercurial_backend/document.py
@@
-15,6
+15,14
@@
class MercurialDocument(wlrepo.Document):
def quickwrite(self, entry, data, msg, user=None):
user = user or self.owner
def quickwrite(self, entry, data, msg, user=None):
user = user or self.owner
+
+ if isinstance(data, unicode):
+ data = data.encode('utf-8')
+
+ user = self._library._sanitize_string(user)
+ msg = self._library._sanitize_string(msg)
+ entry = self._library._sanitize_string(entry)
+
if user is None:
raise ValueError("Can't determine user.")
if user is None:
raise ValueError("Can't determine user.")
@@
-24,7
+32,7
@@
class MercurialDocument(wlrepo.Document):
f.close()
l._fileadd(r(entry))
f.close()
l._fileadd(r(entry))
- return self.invoke_and_commit(write, lambda d: (msg,
us
er))
+ return self.invoke_and_commit(write, lambda d: (msg,
self.own
er))
def invoke_and_commit(self, ops,
before_commit, rollback=False):
def invoke_and_commit(self, ops,
before_commit, rollback=False):
@@
-38,7
+46,12
@@
class MercurialDocument(wlrepo.Document):
ops(self._library, entry_path)
message, user = before_commit(self)
self._library._commit(message, user)
ops(self._library, entry_path)
message, user = before_commit(self)
self._library._commit(message, user)
- return self._library.document(docid=self.id, user=self.owner)
+ try:
+ return self._library.document(docid=self.id, user=user)
+ except Exception, e:
+ # rollback the last commit
+ self._library._rollback()
+ raise e
finally:
lock.release()
finally:
lock.release()