Show More
@@ -30,7 +30,7 b' import traceback' | |||||
30 | import logging |
|
30 | import logging | |
31 | import cStringIO |
|
31 | import cStringIO | |
32 | import pkg_resources |
|
32 | import pkg_resources | |
33 |
from os.path import |
|
33 | from os.path import join as jn | |
34 |
|
34 | |||
35 | from sqlalchemy import func |
|
35 | from sqlalchemy import func | |
36 | from pylons.i18n.translation import _ |
|
36 | from pylons.i18n.translation import _ | |
@@ -47,9 +47,9 b' from rhodecode.lib import helpers as h' | |||||
47 | from rhodecode.lib.utils2 import safe_str, safe_unicode, get_server_url,\ |
|
47 | from rhodecode.lib.utils2 import safe_str, safe_unicode, get_server_url,\ | |
48 | _set_extras |
|
48 | _set_extras | |
49 | from rhodecode.lib.auth import HasRepoPermissionAny, HasReposGroupPermissionAny,\ |
|
49 | from rhodecode.lib.auth import HasRepoPermissionAny, HasReposGroupPermissionAny,\ | |
50 |
|
|
50 | HasUserGroupPermissionAny | |
51 | from rhodecode.lib.utils import get_filesystem_repos, make_ui, \ |
|
51 | from rhodecode.lib.utils import get_filesystem_repos, make_ui, \ | |
52 |
action_logger |
|
52 | action_logger | |
53 | from rhodecode.model import BaseModel |
|
53 | from rhodecode.model import BaseModel | |
54 | from rhodecode.model.db import Repository, RhodeCodeUi, CacheInvalidation, \ |
|
54 | from rhodecode.model.db import Repository, RhodeCodeUi, CacheInvalidation, \ | |
55 | UserFollowing, UserLog, User, RepoGroup, PullRequest |
|
55 | UserFollowing, UserLog, User, RepoGroup, PullRequest | |
@@ -486,12 +486,15 b' class ScmModel(BaseModel):' | |||||
486 | :param scm_type: |
|
486 | :param scm_type: | |
487 | """ |
|
487 | """ | |
488 | if scm_type == 'hg': |
|
488 | if scm_type == 'hg': | |
489 |
from rhodecode.lib.vcs.backends.hg import |
|
489 | from rhodecode.lib.vcs.backends.hg import MercurialInMemoryChangeset | |
490 |
|
|
490 | return MercurialInMemoryChangeset | |
491 | elif scm_type == 'git': |
|
491 | ||
492 | from rhodecode.lib.vcs.backends.git import \ |
|
492 | if scm_type == 'git': | |
493 | GitInMemoryChangeset as IMC |
|
493 | from rhodecode.lib.vcs.backends.git import GitInMemoryChangeset | |
494 | return IMC |
|
494 | return GitInMemoryChangeset | |
|
495 | ||||
|
496 | raise Exception('Invalid scm_type, must be one of hg,git got %s' | |||
|
497 | % (scm_type,)) | |||
495 |
|
498 | |||
496 | def pull_changes(self, repo, username): |
|
499 | def pull_changes(self, repo, username): | |
497 | dbrepo = self.__get_repo(repo) |
|
500 | dbrepo = self.__get_repo(repo) | |
@@ -724,7 +727,6 b' class ScmModel(BaseModel):' | |||||
724 | if os.path.exists(_hook_file): |
|
727 | if os.path.exists(_hook_file): | |
725 | # let's take a look at this hook, maybe it's rhodecode ? |
|
728 | # let's take a look at this hook, maybe it's rhodecode ? | |
726 | log.debug('hook exists, checking if it is from rhodecode') |
|
729 | log.debug('hook exists, checking if it is from rhodecode') | |
727 | _HOOK_VER_PAT = re.compile(r'^RC_HOOK_VER') |
|
|||
728 | with open(_hook_file, 'rb') as f: |
|
730 | with open(_hook_file, 'rb') as f: | |
729 | data = f.read() |
|
731 | data = f.read() | |
730 | matches = re.compile(r'(?:%s)\s*=\s*(.*)' |
|
732 | matches = re.compile(r'(?:%s)\s*=\s*(.*)' | |
@@ -741,7 +743,7 b' class ScmModel(BaseModel):' | |||||
741 | _rhodecode_hook = True |
|
743 | _rhodecode_hook = True | |
742 |
|
744 | |||
743 | if _rhodecode_hook or force_create: |
|
745 | if _rhodecode_hook or force_create: | |
744 | log.debug('writing %s hook file !' % h_type) |
|
746 | log.debug('writing %s hook file !' % (h_type,)) | |
745 | with open(_hook_file, 'wb') as f: |
|
747 | with open(_hook_file, 'wb') as f: | |
746 | tmpl = tmpl.replace('_TMPL_', rhodecode.__version__) |
|
748 | tmpl = tmpl.replace('_TMPL_', rhodecode.__version__) | |
747 | f.write(tmpl) |
|
749 | f.write(tmpl) |
General Comments 0
You need to be logged in to leave comments.
Login now