##// END OF EJS Templates
Fixed validators for remote repos...
marcink -
r2706:22f79562 beta
parent child Browse files
Show More
@@ -36,7 +36,8 b' news'
36 - Implemented landing revisions. Each repository will get landing_rev attribute
36 - Implemented landing revisions. Each repository will get landing_rev attribute
37 that defines 'default' revision/branch for generating readme files
37 that defines 'default' revision/branch for generating readme files
38 - Implemented #509, RhodeCode enforces SSL for push/pulling if requested.
38 - Implemented #509, RhodeCode enforces SSL for push/pulling if requested.
39
39 - Import remote svn repositories to mercurial using hgsubversion
40
40
41
41 fixes
42 fixes
42 +++++
43 +++++
@@ -82,4 +82,27 b' Trending source files'
82 Trending source files are calculated based on pre defined dict of known
82 Trending source files are calculated based on pre defined dict of known
83 types and extensions. If You miss some extension or Would like to scan some
83 types and extensions. If You miss some extension or Would like to scan some
84 custom files it's possible to add new types in `LANGUAGES_EXTENSIONS_MAP` dict
84 custom files it's possible to add new types in `LANGUAGES_EXTENSIONS_MAP` dict
85 located in `/rhodecode/lib/celerylib/tasks.py` No newline at end of file
85 located in `/rhodecode/lib/celerylib/tasks.py`
86
87
88 Cloning remote repositories
89 ---------------------------
90
91 RhodeCode has an ability to clone remote repos from given remote locations.
92 Currently it support following options:
93
94 - hg -> hg clone
95 - svn -> hg clone
96 - git -> git clone
97
98
99 .. note::
100
101 - *`svn -> hg` cloning requires `hgsubversion` library to be installed.*
102
103 If you need to clone repositories that are protected via basic auth, you
104 might pass the url with stored credentials inside eg.
105 `http://user:passw@remote.server/repo, RhodeCode will try to login and clone
106 using given credentials. Please take a note that they will be stored as
107 plaintext inside the database. RhodeCode will remove auth info when showing the
108 clone url in summary page.
@@ -176,7 +176,7 b' class GitRepository(BaseRepository):'
176 return resp.code == 200
176 return resp.code == 200
177 except Exception, e:
177 except Exception, e:
178 # means it cannot be cloned
178 # means it cannot be cloned
179 raise urllib2.URLError(e)
179 raise urllib2.URLError("[%s] %s" % (url, e))
180
180
181 def _get_repo(self, create, src_url=None, update_after_clone=False,
181 def _get_repo(self, create, src_url=None, update_after_clone=False,
182 bare=False):
182 bare=False):
@@ -300,7 +300,7 b' class MercurialRepository(BaseRepository'
300 return resp.code == 200
300 return resp.code == 200
301 except Exception, e:
301 except Exception, e:
302 # means it cannot be cloned
302 # means it cannot be cloned
303 raise urllib2.URLError(e)
303 raise urllib2.URLError("[%s] %s" % (url, e))
304
304
305 def _get_repo(self, create, src_url=None, update_after_clone=False):
305 def _get_repo(self, create, src_url=None, update_after_clone=False):
306 """
306 """
@@ -312,6 +312,7 b' class MercurialRepository(BaseRepository'
312 location at given clone_point. Additionally it'll make update to
312 location at given clone_point. Additionally it'll make update to
313 working copy accordingly to ``update_after_clone`` flag
313 working copy accordingly to ``update_after_clone`` flag
314 """
314 """
315
315 try:
316 try:
316 if src_url:
317 if src_url:
317 url = str(self._get_url(src_url))
318 url = str(self._get_url(src_url))
@@ -325,6 +326,7 b' class MercurialRepository(BaseRepository'
325 # raise Abort("Got HTTP 404 error")
326 # raise Abort("Got HTTP 404 error")
326 except Exception:
327 except Exception:
327 raise
328 raise
329
328 # Don't try to create if we've already cloned repo
330 # Don't try to create if we've already cloned repo
329 create = False
331 create = False
330 return localrepository(self.baseui, self.path, create=create)
332 return localrepository(self.baseui, self.path, create=create)
@@ -372,17 +372,29 b' def ValidCloneUri():'
372
372
373 def url_handler(repo_type, url, ui=None):
373 def url_handler(repo_type, url, ui=None):
374 if repo_type == 'hg':
374 if repo_type == 'hg':
375 from mercurial.httprepo import httprepository, httpsrepository
375 from rhodecode.lib.vcs.backends.hg.repository import MercurialRepository
376 if url.startswith('https'):
376 from mercurial.httppeer import httppeer
377 httpsrepository(make_ui('db'), url).capabilities
377 if url.startswith('http'):
378 elif url.startswith('http'):
378 ## initially check if it's at least the proper URL
379 httprepository(make_ui('db'), url).capabilities
379 ## or does it pass basic auth
380 MercurialRepository._check_url(url)
381 httppeer(make_ui('db'), url)._capabilities()
380 elif url.startswith('svn+http'):
382 elif url.startswith('svn+http'):
381 from hgsubversion.svnrepo import svnremoterepo
383 from hgsubversion.svnrepo import svnremoterepo
382 svnremoterepo(make_ui('db'), url).capabilities
384 svnremoterepo(make_ui('db'), url).capabilities
385 elif url.startswith('git+http'):
386 raise NotImplementedError()
387
383 elif repo_type == 'git':
388 elif repo_type == 'git':
384 #TODO: write a git url validator
389 from rhodecode.lib.vcs.backends.git.repository import GitRepository
385 pass
390 if url.startswith('http'):
391 ## initially check if it's at least the proper URL
392 ## or does it pass basic auth
393 GitRepository._check_url(url)
394 elif url.startswith('svn+http'):
395 raise NotImplementedError()
396 elif url.startswith('hg+http'):
397 raise NotImplementedError()
386
398
387 class _validator(formencode.validators.FancyValidator):
399 class _validator(formencode.validators.FancyValidator):
388 messages = {
400 messages = {
General Comments 0
You need to be logged in to leave comments. Login now