• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python core.SCMTool类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中reviewboard.scmtools.core.SCMTool的典型用法代码示例。如果您正苦于以下问题:Python SCMTool类的具体用法?Python SCMTool怎么用?Python SCMTool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了SCMTool类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, repository):
        self.repopath = repository.path

        if self.repopath[-1] == '/':
            self.repopath = self.repopath[:-1]

        SCMTool.__init__(self, repository)
开发者ID:CrystalLokKoo,项目名称:reviewboard,代码行数:7,代码来源:localfile.py


示例2: __init__

    def __init__(self, repository):
        self.repopath = repository.path
        if self.repopath[-1] == '/':
            self.repopath = self.repopath[:-1]

        SCMTool.__init__(self, repository)

        import pysvn
        self.client = pysvn.Client()
        if repository.username:
            self.client.set_default_username(str(repository.username))
        if repository.password:
            self.client.set_default_password(str(repository.password))

        self.uses_atomic_revisions = True

        # svnlook uses 'rev 0', while svn diff uses 'revision 0'
        self.revision_re = re.compile("""
            ^(\(([^\)]+)\)\s)?              # creating diffs between two branches
                                            # of a remote repository will insert
                                            # extra "relocation information" into
                                            # the diff.

            (?:\d+-\d+-\d+\ +               # svnlook-style diffs contain a
               \d+:\d+:\d+\ +               # timestamp on each line before the
               [A-Z]+\ +)?                  # revision number.  This here is
                                            # probably a really crappy way to
                                            # express that, but oh well.

            \ *\([Rr]ev(?:ision)?\ (\d+)\)$ # svnlook uses 'rev 0' while svn diff
                                            # uses 'revision 0'
            """, re.VERBOSE)
开发者ID:asutherland,项目名称:opc-reviewboard,代码行数:32,代码来源:svn.py


示例3: __init__

    def __init__(self, repository):
        SCMTool.__init__(self, repository)

        self.client = self._create_client(
            str(repository.mirror_path or repository.path),
            str(repository.username),
            str(repository.password))
开发者ID:PlasticSCM,项目名称:reviewboard,代码行数:7,代码来源:perforce.py


示例4: __init__

    def __init__(self, repository):
        self.repopath = repository.path

        SCMTool.__init__(self, repository)

        self.client = ClearCaseClient(self.repopath)
        self.uses_atomic_revisions = False
开发者ID:Cka3o4Huk,项目名称:reviewboard,代码行数:7,代码来源:clearcase.py


示例5: __init__

    def __init__(self, repository):
        SCMTool.__init__(self, repository)

        self.cvsroot, self.repopath = \
            self.build_cvsroot(self.repository.path,
                               self.repository.username,
                               self.repository.password)
        self.client = CVSClient(self.cvsroot, self.repopath)
开发者ID:bellthoven,项目名称:reviewboard,代码行数:8,代码来源:cvs.py


示例6: __init__

    def __init__(self, repository):
        SCMTool.__init__(self, repository)

        self.client = self._create_client(
            six.text_type(repository.mirror_path or repository.path),
            six.text_type(repository.username),
            six.text_type(repository.password),
            six.text_type(repository.encoding),
            repository.extra_data.get('use_ticket_auth', False))
开发者ID:EricSchles,项目名称:reviewboard,代码行数:9,代码来源:perforce.py


示例7: __init__

    def __init__(self, repository):
        SCMTool.__init__(self, repository)
        if repository.path.startswith("http"):
            self.client = HgWebClient(repository.path, repository.username, repository.password)
        else:
            self.client = HgClient(repository.path, repository.local_site)

        self.uses_atomic_revisions = True
        self.diff_uses_changeset_ids = True
开发者ID:nicoschoenmaker,项目名称:reviewboard,代码行数:9,代码来源:hg.py


示例8: __init__

    def __init__(self, repository):
        SCMTool.__init__(self, repository)

        import P4
        self.p4 = P4.P4()
        self.p4.port = str(repository.mirror_path or repository.path)
        self.p4.user = str(repository.username)
        self.p4.password = str(repository.password)
        self.p4.exception_level = 1
开发者ID:Cka3o4Huk,项目名称:reviewboard,代码行数:9,代码来源:perforce.py


示例9: __init__

    def __init__(self, repository):
        SCMTool.__init__(self, repository)

        credentials = repository.get_credentials()

        self.client = self._create_client(
            six.text_type(repository.mirror_path or repository.path),
            six.text_type(credentials['username']),
            six.text_type(credentials['password'] or ''),
            six.text_type(repository.encoding),
            repository.extra_data.get('use_ticket_auth', False))
开发者ID:Anastasiya2307,项目名称:reviewboard,代码行数:11,代码来源:perforce.py


示例10: __init__

    def __init__(self, repository):
        SCMTool.__init__(self, repository)
        if repository.path.startswith('http'):
            credentials = repository.get_credentials()

            self.client = HgWebClient(repository.path,
                                      credentials['username'],
                                      credentials['password'])
        else:
            self.client = HgClient(repository.path, repository.local_site)

        self.uses_atomic_revisions = True
开发者ID:CrystalLokKoo,项目名称:reviewboard,代码行数:12,代码来源:hg.py


示例11: __init__

    def __init__(self, repository):
        self.repopath = repository.path

        SCMTool.__init__(self, repository)

        self.viewtype = self._get_view_type(self.repopath)

        if self.viewtype == self.VIEW_SNAPSHOT:
            self.client = ClearCaseSnapshotViewClient(self.repopath)
        elif self.viewtype == self.VIEW_DYNAMIC:
            self.client = ClearCaseDynamicViewClient(self.repopath)
        else:
            raise SCMError('Unsupported view type.')
开发者ID:antrianis,项目名称:reviewboard,代码行数:13,代码来源:clearcase.py


示例12: __init__

    def __init__(self, repository):
        SCMTool.__init__(self, repository)

        import P4
        self.p4 = P4.P4()
        self.p4.port = str(repository.mirror_path or repository.path)
        self.p4.user = str(repository.username)
        self.p4.password = str(repository.password)
        self.p4.exception_level = 1

        # We defer actually connecting until just before we do some operation
        # that requires an active connection to the perforce depot.  This
        # connection is then left open as long as possible.

        self.uses_atomic_revisions = True
开发者ID:asutherland,项目名称:opc-reviewboard,代码行数:15,代码来源:perforce.py


示例13: _run_bzr

    def _run_bzr(self, args):
        """Run a Bazaar command.

        This will run :command:`bzr` with the specified arguments, and sets
        up the environment to work with :command:`rbssh`.

        Args:
            args (list of unicode):
                The list of arguments to pass to :command:`bzr`.

        Returns:
            subprocess.Popen:
            The handle for the process.
        """
        if not BZRClient._bzr_plugin_path:
            BZRClient._bzr_plugin_path = (
                '%s:%s' % (
                    os.path.join(os.path.dirname(__file__), 'plugins',
                                 'bzrlib', 'plugins'),
                    os.environ.get(str('BZR_PLUGIN_PATH'), str('')))
            ).encode('utf-8')

        return SCMTool.popen(
            ['bzr'] + args,
            local_site_name=self.local_site_name,
            env={
                b'BZR_PLUGIN_PATH': BZRClient._bzr_plugin_path,
                b'BZR_SSH': b'rbssh',
                b'TZ': b'UTC',
            })
开发者ID:chipx86,项目名称:reviewboard,代码行数:30,代码来源:__init__.py


示例14: _run_hg

    def _run_hg(self, args):
        """Runs the Mercurial command, returning a subprocess.Popen."""
        if not self.default_args:
            self._calculate_default_args()

        return SCMTool.popen(
            ['hg'] + self.default_args + args,
            local_site_name=self.local_site_name)
开发者ID:xiaogao6681,项目名称:reviewboard,代码行数:8,代码来源:hg.py


示例15: check_repository

 def check_repository(self):
     # Running 'cvs version' and specifying a CVSROOT will bail out if said
     # CVSROOT is invalid, which is perfect for us. This used to use
     # 'cvs rls' which is maybe slightly more correct, but rls is only
     # available in CVS 1.12+
     p = SCMTool.popen(['cvs', '-f', '-d', self.cvsroot, 'version'],
                       self.local_site_name)
     errmsg = six.text_type(p.stderr.read())
     if p.wait() != 0:
         raise SCMError(errmsg)
开发者ID:iosphere,项目名称:reviewboard,代码行数:10,代码来源:cvs.py


示例16: main

def main():
    if DEBUG:
        logging.basicConfig(level=logging.DEBUG,
                            format='%(asctime)s %(name)-18s %(levelname)-8s '
                                   '%(message)s',
                            datefmt='%m-%d %H:%M',
                            filename='rbssh.log',
                            filemode='w')

        logging.debug('%s' % sys.argv)
        logging.debug('PID %s' % os.getpid())

    ch = logging.StreamHandler()
    ch.setLevel(logging.INFO)
    ch.setFormatter(logging.Formatter('%(message)s'))
    ch.addFilter(logging.Filter('root'))
    logging.getLogger('').addHandler(ch)

    path, command = parse_options(sys.argv[1:])

    if '://' not in path:
        path = 'ssh://' + path

    username, hostname = SCMTool.get_auth_from_uri(path, options.username)

    if username is None:
        username = getpass.getuser()

    logging.debug('!!! %s, %s, %s' % (hostname, username, command))

    client = sshutils.get_ssh_client(options.local_site_name)
    client.set_missing_host_key_policy(paramiko.WarningPolicy())

    attempts = 0
    password = None

    key = sshutils.get_user_key(options.local_site_name)

    while True:
        try:
            client.connect(hostname, username=username, password=password,
                           pkey=key, allow_agent=options.allow_agent)
            break
        except paramiko.AuthenticationException, e:
            if attempts == 3 or not sys.stdin.isatty():
                logging.error('Too many authentication failures for %s' %
                              username)
                sys.exit(1)

            attempts += 1
            password = getpass.getpass("%[email protected]%s's password: " %
                                       (username, hostname))
        except paramiko.SSHException, e:
            logging.error('Error connecting to server: %s' % e)
            sys.exit(1)
开发者ID:ballarin,项目名称:reviewboard,代码行数:55,代码来源:rbssh.py


示例17: _cat_specific_file

    def _cat_specific_file(self, filename, revision):
        # Somehow CVS sometimes seems to write .cvsignore files to current
        # working directory even though we force stdout with -p.
        self.tempdir = tempfile.mkdtemp()
        os.chdir(self.tempdir)

        p = SCMTool.popen(['cvs', '-f', '-d', self.cvsroot, 'checkout',
                           '-r', six.text_type(revision), '-p', filename],
                          self.local_site_name)
        contents = p.stdout.read()
        errmsg = six.text_type(p.stderr.read())
        failure = p.wait()

        # Unfortunately, CVS is not consistent about exiting non-zero on
        # errors.  If the file is not found at all, then CVS will print an
        # error message on stderr, but it doesn't set an exit code with
        # pservers.  If the file is found but an invalid revision is requested,
        # then cvs exits zero and nothing is printed at all. (!)
        #
        # But, when it is successful, cvs will print a header on stderr like
        # so:
        #
        # ===================================================================
        # Checking out foobar
        # RCS: /path/to/repo/foobar,v
        # VERS: 1.1
        # ***************

        # So, if nothing is in errmsg, or errmsg has a specific recognized
        # message, call it FileNotFound.
        if (not errmsg or
                errmsg.startswith('cvs checkout: cannot find module') or
                errmsg.startswith('cvs checkout: could not read RCS file')):
            self.cleanup()
            raise FileNotFoundError(filename, revision)

        # Otherwise, if there's an exit code, or errmsg doesn't look like
        # successful header, then call it a generic SCMError.
        #
        # If the .cvspass file doesn't exist, CVS will return an error message
        # stating this. This is safe to ignore.
        if ((failure and not errmsg.startswith('==========')) and
                not '.cvspass does not exist - creating new file' in errmsg):
            self.cleanup()
            raise SCMError(errmsg)

        self.cleanup()
        return contents
开发者ID:aaronmartin0303,项目名称:reviewboard,代码行数:48,代码来源:cvs.py


示例18: main

def main():
    if DEBUG:
        global debug_fp
        fd, name = tempfile.mkstemp(prefix='rbssh', suffix='.log')
        debug_fp = os.fdopen(fd, "w+b")

        fp.write('%s\n' % sys.argv)
        fp.write('PID %s\n' % os.getpid())

    path, command = parse_options(sys.argv[1:])

    if '://' not in path:
        path = 'ssh://' + path

    username, hostname = SCMTool.get_auth_from_uri(path, None)

    debug('%s, %s, %s\n' % (hostname, username, command))

    client = sshutils.get_ssh_client()
    client.connect(hostname, username=username)

    transport = client.get_transport()
    channel = transport.open_session()
    channel.exec_command(' '.join(command))

    if os.name == 'posix':
        begin_posix(channel)
    else:
        begin_windows(channel)

    status = channel.recv_exit_status()
    client.close()

    if debug_fp:
        fp.close()

    return status
开发者ID:Kamlani,项目名称:reviewboard,代码行数:37,代码来源:rbssh.py


示例19: check_repository

    def check_repository(self):
        # Running 'cvs version' and specifying a CVSROOT will bail out if said
        # CVSROOT is invalid, which is perfect for us. This used to use
        # 'cvs rls' which is maybe slightly more correct, but rls is only
        # available in CVS 1.12+
        p = SCMTool.popen(['cvs', '-f', '-d', self.cvsroot, 'version'],
                          self.local_site_name)
        errmsg = six.text_type(p.stderr.read())

        if p.wait() != 0:
            logging.error('CVS repository validation failed for '
                          'CVSROOT %s: %s',
                          self.cvsroot, errmsg)

            auth_failed_prefix = 'cvs version: authorization failed: '

            # See if there's an "authorization failed" anywhere in here. If so,
            # we want to raise AuthenticationError with that error message.
            for line in errmsg.splitlines():
                if line.startswith(auth_failed_prefix):
                    raise AuthenticationError(
                        msg=line[len(auth_failed_prefix):].strip())

            raise SCMError(errmsg)
开发者ID:CharanKamal-CLI,项目名称:reviewboard,代码行数:24,代码来源:cvs.py


示例20: main

def main():
    """Run the application."""
    if DEBUG:
        pid = os.getpid()
        log_filename = 'rbssh-%s.log' % pid

        if DEBUG_LOGDIR:
            log_path = os.path.join(DEBUG_LOGDIR, log_filename)
        else:
            log_path = log_filename

        logging.basicConfig(level=logging.DEBUG,
                            format='%(asctime)s %(name)-18s %(levelname)-8s '
                                   '%(message)s',
                            datefmt='%m-%d %H:%M',
                            filename=log_path,
                            filemode='w')

        logging.debug('%s' % sys.argv)
        logging.debug('PID %s' % pid)

    ch = logging.StreamHandler()
    ch.setLevel(logging.INFO)
    ch.setFormatter(logging.Formatter('%(message)s'))
    ch.addFilter(logging.Filter('root'))
    logging.getLogger('').addHandler(ch)

    path, port, command = parse_options(sys.argv[1:])

    if '://' not in path:
        path = 'ssh://' + path

    username, hostname = SCMTool.get_auth_from_uri(path, options.username)

    if username is None:
        username = getpass.getuser()

    logging.debug('!!! %s, %s, %s' % (hostname, username, command))

    client = SSHClient(namespace=options.local_site_name)
    client.set_missing_host_key_policy(paramiko.WarningPolicy())

    attempts = 0
    password = None

    key = client.get_user_key()

    while True:
        try:
            client.connect(hostname, port, username=username,
                           password=password, pkey=key,
                           allow_agent=options.allow_agent)
            break
        except paramiko.AuthenticationException as e:
            if attempts == 3 or not sys.stdin.isatty():
                logging.error('Too many authentication failures for %s' %
                              username)
                sys.exit(1)

            attempts += 1
            password = getpass.getpass("%[email protected]%s's password: " %
                                       (username, hostname))
        except paramiko.SSHException as e:
            logging.error('Error connecting to server: %s' % e)
            sys.exit(1)
        except Exception as e:
            logging.error('Unknown exception during connect: %s (%s)' %
                          (e, type(e)))
            sys.exit(1)

    transport = client.get_transport()
    channel = transport.open_session()

    if sys.platform in ('cygwin', 'win32'):
        logging.debug('!!! Using WindowsHandler')
        handler = WindowsHandler(channel)
    else:
        logging.debug('!!! Using PosixHandler')
        handler = PosixHandler(channel)

    if options.subsystem == 'sftp':
        logging.debug('!!! Invoking sftp subsystem')
        channel.invoke_subsystem('sftp')
        handler.transfer()
    elif command:
        logging.debug('!!! Sending command %s' % command)
        channel.exec_command(' '.join(command))
        handler.transfer()
    else:
        logging.debug('!!! Opening shell')
        channel.get_pty()
        channel.invoke_shell()
        handler.shell()

    logging.debug('!!! Done')
    status = channel.recv_exit_status()
    client.close()

    return status
开发者ID:Anastasiya2307,项目名称:reviewboard,代码行数:99,代码来源:rbssh.py



注:本文中的reviewboard.scmtools.core.SCMTool类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python crypto_utils.decrypt_password函数代码示例发布时间:2022-05-26
下一篇:
Python core.Commit类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap