fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Podwyższenie wymaganej wersji biblioteki librarian do 1.2.5 (wydanej dzisiaj).
[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
e9861f4
..
4c072cb
100644
(file)
--- a/
lib/wlrepo/mercurial_backend/library.py
+++ b/
lib/wlrepo/mercurial_backend/library.py
@@
-10,8
+10,8
@@
from mercurial import ui as hgui
from mercurial import error
import wlrepo
from mercurial import error
import wlrepo
-from wlrepo.mercurial_backend.document import MercurialDocument
from wlrepo.mercurial_backend import MercurialRevision
from wlrepo.mercurial_backend import MercurialRevision
+from wlrepo.mercurial_backend.document import MercurialDocument
class MergeStatus(object):
def __init__(self, mstatus):
class MergeStatus(object):
def __init__(self, mstatus):
@@
-70,18
+70,18
@@
class MercurialLibrary(wlrepo.Library):
def documents(self):
def documents(self):
- return [ key[5:] for key in \
+ return [ key[5:]
.decode('utf-8')
for key in \
self._hgrepo.branchmap() if key.startswith("$doc:") ]
@property
def ospath(self):
self._hgrepo.branchmap() if key.startswith("$doc:") ]
@property
def ospath(self):
- return self._ospath
+ return self._ospath
.decode('utf-8')
def document_for_rev(self, revision):
if revision is None:
raise ValueError("Revision can't be None.")
def document_for_rev(self, revision):
if revision is None:
raise ValueError("Revision can't be None.")
- if not isinstance(revision, MercurialRevision):
+ if not isinstance(revision, MercurialRevision):
rev = self.get_revision(revision)
else:
rev = revision
rev = self.get_revision(revision)
else:
rev = revision
@@
-97,46
+97,47
@@
class MercurialLibrary(wlrepo.Library):
def get_revision(self, revid):
revid = self._sanitize_string(revid)
def get_revision(self, revid):
revid = self._sanitize_string(revid)
-
- ctx = self._changectx(revid)
+
+ print "Looking up rev %r (%s)" %(revid, type(revid))
+
+ try:
+ ctx = self._changectx( revid )
+ except mercurial.error.RepoError, e:
+ raise wlrepo.RevisionNotFound(revid)
if ctx is None:
if ctx is None:
- raise RevisionNotFound(revid)
+ raise
wlrepo.
RevisionNotFound(revid)
if self._revcache.has_key(ctx):
return self._revcache[ctx]
return MercurialRevision(self, ctx)
if self._revcache.has_key(ctx):
return self._revcache[ctx]
return MercurialRevision(self, ctx)
- def fulldocid(self, docid, user=None):
- docid = self._sanitize_string(docid)
- user = self._sanitize_string(user)
-
- fulldocid = ''
+ def fulldocid(self, docid, user=None):
+ fulldocid = u''
if user is not None:
if user is not None:
- fulldocid += '$user:' + user
- fulldocid += '$doc:' + docid
+ fulldocid +=
u
'$user:' + user
+ fulldocid +=
u
'$doc:' + docid
return fulldocid
return fulldocid
-
def has_revision(self, revid):
try:
self._hgrepo[revid]
return True
def has_revision(self, revid):
try:
self._hgrepo[revid]
return True
- except error.RepoError:
+ except
mercurial.
error.RepoError:
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 wlrepo.DocumentAlreadyExists("Document %s already exists!" % docid);
+ raise wlrepo.DocumentAlreadyExists(
u
"Document %s already exists!" % docid);
# doesn't exist
# doesn't exist
- self._create_branch(
fullid
)
+ self._create_branch(
self._sanitize_string(fullid)
)
return self.document_for_rev(fullid)
#
return self.document_for_rev(fullid)
#
@@
-147,11
+148,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:
@@
-199,6
+200,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
#
@@
-252,9
+256,6
@@
class MercurialLibrary(wlrepo.Library):
return None
if isinstance(s, unicode):
return None
if isinstance(s, unicode):
- s = s.encode('utf-8')
-
- if ' ' in s:
- raise ValueError('Whitespace is forbidden!')
+ s = s.encode('utf-8')
return s
\ No newline at end of file
return s
\ No newline at end of file