Commits

Marcin Kuzminski  committed 22f7956

Fixed validators for remote repos
- use proper httppeer repo for mercurial 2.3
- validate git repos for remote auth
- docs updates

  • Participants
  • Parent commits bf177b4

Comments (0)

Files changed (5)

File docs/changelog.rst

 - Implemented landing revisions. Each repository will get landing_rev attribute
   that defines 'default' revision/branch for generating readme files
 - Implemented #509, RhodeCode enforces SSL for push/pulling if requested.
-  
+- Import remote svn repositories to mercurial using hgsubversion  
+
 
 fixes
 +++++

File docs/usage/general.rst

 Trending source files are calculated based on pre defined dict of known
 types and extensions. If You miss some extension or Would like to scan some
 custom files it's possible to add new types in `LANGUAGES_EXTENSIONS_MAP` dict
-located in `/rhodecode/lib/celerylib/tasks.py`
+located in `/rhodecode/lib/celerylib/tasks.py`
+
+
+Cloning remote repositories
+---------------------------
+
+RhodeCode has an ability to clone remote repos from given remote locations.
+Currently it support following options:
+
+- hg  -> hg clone
+- svn -> hg clone
+- git -> git clone
+
+
+.. note::
+    
+    - *`svn -> hg` cloning requires `hgsubversion` library to be installed.*
+
+If you need to clone repositories that are protected via basic auth, you
+might pass the url with stored credentials inside eg. 
+`http://user:passw@remote.server/repo, RhodeCode will try to login and clone
+using given credentials. Please take a note that they will be stored as
+plaintext inside the database. RhodeCode will remove auth info when showing the 
+clone url in summary page.

File rhodecode/lib/vcs/backends/git/repository.py

             return resp.code == 200
         except Exception, e:
             # means it cannot be cloned
-            raise urllib2.URLError(e)
+            raise urllib2.URLError("[%s] %s" % (url, e))
 
     def _get_repo(self, create, src_url=None, update_after_clone=False,
             bare=False):

File rhodecode/lib/vcs/backends/hg/repository.py

             return resp.code == 200
         except Exception, e:
             # means it cannot be cloned
-            raise urllib2.URLError(e)
+            raise urllib2.URLError("[%s] %s" % (url, e))
 
     def _get_repo(self, create, src_url=None, update_after_clone=False):
         """
         location at given clone_point. Additionally it'll make update to
         working copy accordingly to ``update_after_clone`` flag
         """
+
         try:
             if src_url:
                 url = str(self._get_url(src_url))
 #                    raise Abort("Got HTTP 404 error")
                 except Exception:
                     raise
+
                 # Don't try to create if we've already cloned repo
                 create = False
             return localrepository(self.baseui, self.path, create=create)

File rhodecode/model/validators.py

 
     def url_handler(repo_type, url, ui=None):
         if repo_type == 'hg':
-            from mercurial.httprepo import httprepository, httpsrepository
-            if url.startswith('https'):
-                httpsrepository(make_ui('db'), url).capabilities
-            elif url.startswith('http'):
-                httprepository(make_ui('db'), url).capabilities
+            from rhodecode.lib.vcs.backends.hg.repository import MercurialRepository
+            from mercurial.httppeer import httppeer
+            if url.startswith('http'):
+                ## initially check if it's at least the proper URL
+                ## or does it pass basic auth
+                MercurialRepository._check_url(url)
+                httppeer(make_ui('db'), url)._capabilities()
             elif url.startswith('svn+http'):
                 from hgsubversion.svnrepo import svnremoterepo
                 svnremoterepo(make_ui('db'), url).capabilities
+            elif url.startswith('git+http'):
+                raise NotImplementedError()
+
         elif repo_type == 'git':
-            #TODO: write a git url validator
-            pass
+            from rhodecode.lib.vcs.backends.git.repository import GitRepository
+            if url.startswith('http'):
+                ## initially check if it's at least the proper URL
+                ## or does it pass basic auth
+                GitRepository._check_url(url)
+            elif url.startswith('svn+http'):
+                raise NotImplementedError()
+            elif url.startswith('hg+http'):
+                raise NotImplementedError()
 
     class _validator(formencode.validators.FancyValidator):
         messages = {