Added "merge_url" to document meta-data.
[redakcja.git] / lib / wlrepo / mercurial_backend / library.py
index e9861f4..648ebe9 100644 (file)
@@ -97,11 +97,14 @@ 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)
+
+        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]
 
         if self._revcache.has_key(ctx):
             return self._revcache[ctx]
@@ -123,7 +126,7 @@ class MercurialLibrary(wlrepo.Library):
         try:
             self._hgrepo[revid]
             return True
         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):
@@ -147,11 +150,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 +202,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 +258,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