示例#1
0
文件: command.py 项目: efroese/svnsh
def _run_flush(self, options, args):

    prefix, name = __parse_prefix_name(args[0])
    repo = __load_repository_from_yaml(prefix, name)

    __write_repository_yaml(repo)
    __write_repository_fisheyeauth(repo)
    __write_authz(repo)
    print 'Wrote apache authz.'
    apache_conf.process_to_file(repo.apache_conf,
                                    {'repopath' : repo.path,
                                     'users' : ', '.join(repo.users()),
                                     'apache_authz_path' : repo.apache_authz})
    print 'Wrote apache conf.'
示例#2
0
文件: command.py 项目: efroese/svnsh
def _run_create(self, options, args):
    """
    Create the repository.
    Save the yaml descriptor.
    """

    prefix, name = __parse_prefix_name(args[0])
    print "Name = %s" % name
    if prefix:
        print "Prefix = %s" % prefix
    print "Fisheye = %s" % options.fisheye

    repo = Repository(prefix, name, options.fisheye)
    if Repository.exists(repo.path_to_repo):
        raise CommandError('A repository named "%s" already exists.' % repo.path)
    try:
        __check_path_dir(repo)
        print 'Creating the repository ...'
        repo.create()
        print 'Created the repository'
        print repo.apache_conf
        apache_conf.process_to_file(repo.apache_conf,
                                    {'repopath' : repo.path,
                                     'users' : ', '.join(repo.users()),
                                     'apache_authz_path' : repo.apache_authz})
        print "Created apache conf"
        __write_repository_yaml(repo)
        print "CREATED repository at %s." % repo.path

        if options.fisheye:
            __write_repository_fisheyeauth(repo)
            fisheye_admin = FisheyeAdmin(password=config.FISHEYE_ADMIN_PW)
            if fisheye_admin.create_repository(repo, __get_description()):
                print "Successfully created a fisheye instance for %s" % repo.name

    except Exception, e:
        raise CommandError("Failed to create the repository at %s\n" % repo.path_to_repo,
                           "The original error was: %s: %s" % (type(e), e))