Changeset - f3e91cd075eb
[Not reviewed]
default
3 1 4
Mads Kiilerich (mads) - 5 years ago 2020-10-20 00:54:59
mads@kiilerich.com
Grafted from: 9218f063946b
vcs: move ssh handlers out of "backends"

The ssh handlers are much more high-level than the low-level backends ... and
not used as a part of the "backends" concept at all.
5 files changed with 7 insertions and 7 deletions:
0 comments (0 inline, 0 general)
kallithea/bin/kallithea_cli_ssh.py
Show inline comments
 
@@ -19,14 +19,14 @@ import sys
 

	
 
import click
 

	
 
import kallithea
 
import kallithea.bin.kallithea_cli_base as cli_base
 
from kallithea.lib.utils2 import asbool
 
from kallithea.lib.vcs.backends.git.ssh import GitSshHandler
 
from kallithea.lib.vcs.backends.hg.ssh import MercurialSshHandler
 
from kallithea.lib.vcs.ssh.git import GitSshHandler
 
from kallithea.lib.vcs.ssh.hg import MercurialSshHandler
 
from kallithea.model.ssh_key import SshKeyModel, SshKeyModelException
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
kallithea/lib/vcs/ssh/__init__.py
Show inline comments
 
new file 100644
kallithea/lib/vcs/ssh/base.py
Show inline comments
 
file renamed from kallithea/lib/vcs/backends/ssh.py to kallithea/lib/vcs/ssh/base.py
kallithea/lib/vcs/ssh/git.py
Show inline comments
 
file renamed from kallithea/lib/vcs/backends/git/ssh.py to kallithea/lib/vcs/ssh/git.py
 
@@ -14,19 +14,19 @@
 

	
 
import logging
 
import os
 

	
 
from kallithea.lib.hooks import log_pull_action
 
from kallithea.lib.utils import make_ui
 
from kallithea.lib.vcs.backends.ssh import BaseSshHandler
 
from kallithea.lib.vcs.ssh import base
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
class GitSshHandler(BaseSshHandler):
 
class GitSshHandler(base.BaseSshHandler):
 
    vcs_type = 'git'
 

	
 
    @classmethod
 
    def make(cls, ssh_command_parts):
 
        r"""
 
        >>> import shlex
 
@@ -57,13 +57,13 @@ class GitSshHandler(BaseSshHandler):
 
        ):
 
            return cls(ssh_command_parts[1][1:], ssh_command_parts[0])
 

	
 
        return None
 

	
 
    def __init__(self, repo_name, verb):
 
        BaseSshHandler.__init__(self, repo_name)
 
        base.BaseSshHandler.__init__(self, repo_name)
 
        self.verb = verb
 

	
 
    def _serve(self):
 
        if self.verb == 'git-upload-pack': # action 'pull'
 
            # base class called set_hook_environment - action is hardcoded to 'pull'
 
            log_pull_action(ui=make_ui(), repo=self.db_repo.scm_instance._repo)
kallithea/lib/vcs/ssh/hg.py
Show inline comments
 
file renamed from kallithea/lib/vcs/backends/hg/ssh.py to kallithea/lib/vcs/ssh/hg.py
 
@@ -15,20 +15,20 @@
 
import logging
 

	
 
import mercurial.hg
 
import mercurial.wireprotoserver
 

	
 
from kallithea.lib.utils import make_ui
 
from kallithea.lib.vcs.backends.ssh import BaseSshHandler
 
from kallithea.lib.vcs.ssh import base
 
from kallithea.lib.vcs.utils import safe_bytes
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
class MercurialSshHandler(BaseSshHandler):
 
class MercurialSshHandler(base.BaseSshHandler):
 
    vcs_type = 'hg'
 

	
 
    @classmethod
 
    def make(cls, ssh_command_parts):
 
        r"""
 
        >>> import shlex
0 comments (0 inline, 0 general)