Show More
@@ -23,12 +23,9 b' Scm model for RhodeCode' | |||||
23 | """ |
|
23 | """ | |
24 |
|
24 | |||
25 | import os.path |
|
25 | import os.path | |
26 | import re |
|
|||
27 | import sys |
|
|||
28 | import traceback |
|
26 | import traceback | |
29 | import logging |
|
27 | import logging | |
30 | import cStringIO |
|
28 | import cStringIO | |
31 | import pkg_resources |
|
|||
32 |
|
29 | |||
33 | from sqlalchemy import func |
|
30 | from sqlalchemy import func | |
34 | from zope.cachedescriptors.property import Lazy as LazyProperty |
|
31 | from zope.cachedescriptors.property import Lazy as LazyProperty | |
@@ -53,6 +50,7 b' from rhodecode.model.db import (' | |||||
53 | Repository, CacheKey, UserFollowing, UserLog, User, RepoGroup, |
|
50 | Repository, CacheKey, UserFollowing, UserLog, User, RepoGroup, | |
54 | PullRequest) |
|
51 | PullRequest) | |
55 | from rhodecode.model.settings import VcsSettingsModel |
|
52 | from rhodecode.model.settings import VcsSettingsModel | |
|
53 | from rhodecode.model.validation_schema.validators import url_validator, InvalidCloneUrl | |||
56 |
|
54 | |||
57 | log = logging.getLogger(__name__) |
|
55 | log = logging.getLogger(__name__) | |
58 |
|
56 | |||
@@ -386,11 +384,17 b' class ScmModel(BaseModel):' | |||||
386 | raise Exception("This repository doesn't have a clone uri") |
|
384 | raise Exception("This repository doesn't have a clone uri") | |
387 |
|
385 | |||
388 | repo = dbrepo.scm_instance(cache=False) |
|
386 | repo = dbrepo.scm_instance(cache=False) | |
389 | # TODO: marcink fix this an re-enable since we need common logic |
|
|||
390 | # for hg/git remove hooks so we don't trigger them on fetching |
|
|||
391 | # commits from remote |
|
|||
392 | repo.config.clear_section('hooks') |
|
387 | repo.config.clear_section('hooks') | |
393 |
|
388 | |||
|
389 | try: | |||
|
390 | # NOTE(marcink): add extra validation so we skip invalid urls | |||
|
391 | # this is due this tasks can be executed via scheduler without | |||
|
392 | # proper validation of remote_uri | |||
|
393 | config = make_db_config(clear_session=False) | |||
|
394 | url_validator(remote_uri, dbrepo.repo_type, config) | |||
|
395 | except InvalidCloneUrl: | |||
|
396 | raise | |||
|
397 | ||||
394 | repo_name = dbrepo.repo_name |
|
398 | repo_name = dbrepo.repo_name | |
395 | try: |
|
399 | try: | |
396 | # TODO: we need to make sure those operations call proper hooks ! |
|
400 | # TODO: we need to make sure those operations call proper hooks ! | |
@@ -411,6 +415,15 b' class ScmModel(BaseModel):' | |||||
411 | repo.config.clear_section('hooks') |
|
415 | repo.config.clear_section('hooks') | |
412 |
|
416 | |||
413 | try: |
|
417 | try: | |
|
418 | # NOTE(marcink): add extra validation so we skip invalid urls | |||
|
419 | # this is due this tasks can be executed via scheduler without | |||
|
420 | # proper validation of remote_uri | |||
|
421 | config = make_db_config(clear_session=False) | |||
|
422 | url_validator(remote_uri, dbrepo.repo_type, config) | |||
|
423 | except InvalidCloneUrl: | |||
|
424 | raise | |||
|
425 | ||||
|
426 | try: | |||
414 | repo.push(remote_uri) |
|
427 | repo.push(remote_uri) | |
415 | except Exception: |
|
428 | except Exception: | |
416 | log.error(traceback.format_exc()) |
|
429 | log.error(traceback.format_exc()) |
General Comments 0
You need to be logged in to leave comments.
Login now