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
/
library.py
diff --git
a/lib/wlrepo/mercurial_backend/library.py
b/lib/wlrepo/mercurial_backend/library.py
index
219a01d
..
7a33bf3
100644
(file)
--- a/
lib/wlrepo/mercurial_backend/library.py
+++ b/
lib/wlrepo/mercurial_backend/library.py
@@
-96,6
+96,8
@@
class MercurialLibrary(wlrepo.Library):
return self.document_for_rev(self.fulldocid(docid, user))
def get_revision(self, revid):
return self.document_for_rev(self.fulldocid(docid, user))
def get_revision(self, revid):
+ revid = self._sanitize_string(revid)
+
ctx = self._changectx(revid)
if ctx is None:
ctx = self._changectx(revid)
if ctx is None:
@@
-107,6
+109,9
@@
class MercurialLibrary(wlrepo.Library):
return MercurialRevision(self, ctx)
def fulldocid(self, docid, user=None):
return MercurialRevision(self, ctx)
def fulldocid(self, docid, user=None):
+ docid = self._sanitize_string(docid)
+ user = self._sanitize_string(user)
+
fulldocid = ''
if user is not None:
fulldocid += '$user:' + user
fulldocid = ''
if user is not None:
fulldocid += '$user:' + user
@@
-122,11
+127,13
@@
class MercurialLibrary(wlrepo.Library):
return False
def document_create(self, docid):
return False
def document_create(self, docid):
+ docid = self._sanitize_string(docid)
+
# check if it already exists
fullid = self.fulldocid(docid)
if self.has_revision(fullid):
# check if it already exists
fullid = self.fulldocid(docid)
if self.has_revision(fullid):
- raise
LibraryException("Document already exists!"
);
+ raise
wlrepo.DocumentAlreadyExists("Document %s already exists!" % docid
);
# doesn't exist
self._create_branch(fullid)
# doesn't exist
self._create_branch(fullid)
@@
-140,11
+147,11
@@
class MercurialLibrary(wlrepo.Library):
# Locking
#
# Locking
#
- def
_
lock(self, write_mode=False):
+ def lock(self, write_mode=False):
return self._hgrepo.wlock() # no support for read/write mode yet
def _transaction(self, write_mode, action):
return self._hgrepo.wlock() # no support for read/write mode yet
def _transaction(self, write_mode, action):
- lock = self.
_
lock(write_mode)
+ lock = self.lock(write_mode)
try:
return action(self)
finally:
try:
return action(self)
finally:
@@
-192,6
+199,9
@@
class MercurialLibrary(wlrepo.Library):
def _changectx(self, nodeid):
return self._hgrepo.changectx(nodeid)
def _changectx(self, nodeid):
return self._hgrepo.changectx(nodeid)
+ def _rollback(self):
+ return self._hgrepo.rollback()
+
#
# BASIC BRANCH routines
#
#
# BASIC BRANCH routines
#
@@
-241,10
+251,10
@@
class MercurialLibrary(wlrepo.Library):
@staticmethod
def _sanitize_string(s):
@staticmethod
def _sanitize_string(s):
- if
isinstance(s, unicode)
:
- s = s.encode('utf-8')
+ if
s is None
:
+ return None
- if
' ' in s
:
- raise ValueError('Whitespace is forbidden!')
+ if
isinstance(s, unicode)
:
+ s = s.encode('utf-8')
return s
\ No newline at end of file
return s
\ No newline at end of file