`repo_name` - name of the repository to prune
551809
def prune_repo(self, repo_name=None, daycount=None, envs=[], query='/repositories/'):
        
        orphan_query = '/content/orphans/rpm/'
        t = datetime.datetime.now() - datetime.timedelta(days = daycount)
        juicer.utils.Log.log_debug("Prune Repo: %s", repo_name)
        juicer.utils.Log.log_debug("Pruning packages created before %s" % t)

        for env in self.args.envs:
            if not juicer.utils.repo_exists_p(repo_name, self.connectors[env], env):
                juicer.utils.Log.log_info("repo `%s` doesn't exist in %s... skipping!",
                                           (repo_name, env))
                continue
            else:
                url = "%s%s-%s/actions/unassociate/" % (query, repo_name, env)
                # FIXME: this should be at least 90 days ago
                data = {'created' : t.strftime('%Y-%m-%d%H:%M:%S')}
                print data
                _r = self.connectors[env].post(url, data)

                if _r.status_code == Constants.PULP_POST_ACCEPTED:
                    pub_query = '/repositories/%s-%s/actions/publish/' % (repo_name, env)
                    pub_data = {'id': 'yum_distributor'}

                    _r = self.connectors[env].post(pub_query, pub_data)

                    if _r.status_code == Constants.PULP_POST_ACCEPTED:
                        juicer.utils.Log.log_info("pruned repo `%s` in %s", repo_name, env)
                else:
                    _r.raise_for_status()

                # after pruning, remove orphaned packages
                _r = self.connectors[env].get(orphan_query)
                if _r.status_code is Constants.PULP_POST_OK:
                    if len(juicer.utils.load_json_str(_r.content)) > 0:
                        __r = self.connectors[env].delete(orphan_query)
                        if __r.status_code is Constants.PULP_DELETE_ACCEPTED:
                            juicer.utils.Log.log_debug("deleted orphaned rpms in %s." % env)
                        else:
                            juicer.utils.Log.log_error("unable to delete orphaned rpms in %s. a %s error was returned", (env, __r.status_code))
                else:
                    juicer.utils.Log.log_error("unable to get a list of orphaned rpms. encountered a %s error." % _r.status_code)
1355927
def _split_repo_str(repo):
    '''
    
    '''
    split = sourceslist.SourceEntry(repo)
    return split.type, split.architectures, split.uri, split.dist, split.comps
969538
def from_path(self, repo, path, name=None):
        
        if name is None:
            name = os.path.basename(path)
        #FIXME: hack, there has to be a better way
        return Item.from_string(repo=repo, name=name, string=open(path).read())
1161197
def create_repo(self, name):
        

        name = os.path.abspath(name)
        logger.debug("create_repo %s", name)

        self.safe_mkdir(name)

        udir = os.path.join(name, '_upkg')
        self.safe_mkdir(udir)

        ctx = {
            'pkg_name': os.path.basename(name),
        }

        for t in TMPLS:
            self.mk_tmpl(
                os.path.join(udir, t['name']),
                t['tmpl'],
                ctx,
                t.get('mode')
            )
1229289
def get_repos(self):
        
        url_parameters = dict()

        return github.PaginatedList.PaginatedList(
            contentClass=github.Repository.Repository,
            requester=self._requester,
            firstUrl="/installation/repositories",
            firstParams=url_parameters,
            headers=INTEGRATION_PREVIEW_HEADERS,
            list_item='repositories'
        )
1283829
def get_repo(repo, **kwargs):  # pylint: disable=unused-argument
    '''
    
    '''
    repos = list_repos()

    if repos:
        for source in six.itervalues(repos):
            for sub in source:
                if sub['name'] == repo:
                    return sub
    return {}
589884
def delete_repository(self, namespace, repository):
        """"""
        return self._http_call(self.REPO, delete,
                               namespace=namespace, repository=repository)
257542
def get_github_hostname_user_repo_from_url(url):
    
    parsed = parse.urlparse(url)
    if parsed.netloc == '':
        # Probably ssh
        host, sep, path = parsed.path.partition(":")
        if "@" in host:
            username, sep, host = host.partition("@")
    else:
        path = parsed.path[1:].rstrip('/')
        host = parsed.netloc
    user, repo = path.split("/", 1)
    return host, user, repo[:-4] if repo.endswith('.git') else repo
90161
def get_repository(name):
    '''
    
    '''
    # Putting quotes around the parameter protects against command injection
    cmd = 'Get-PSRepository "{0}"'.format(name)
    no_ret = _pshell(cmd)
    return name not in list_modules()
95518
public static String getRepoName(Properties repoProperties, RepositoryConnection repoConn) throws InstallException {
        String repoName = null;
        List<RepositoryConfig> configRepos = RepositoryConfigUtils.getRepositoryConfigs(repoProperties);

        if (!(repoConn instanceof DirectoryRepositoryConnection || repoConn instanceof ZipRepositoryConnection)) {
            if (RepositoryConfigUtils.isLibertyRepository((RestRepositoryConnection) repoConn, repoProperties))
                return WLP_REPO;
        }
        for (RepositoryConfig rc : configRepos) {
            if (rc.getUrl() != null) {
                if (rc.getUrl().toLowerCase().startsWith("file:") && (repoConn instanceof DirectoryRepositoryConnection || repoConn instanceof ZipRepositoryConnection)) {
                    String repoDir = rc.getUrl();
                    try {
                        URL fileURL = new URL(repoDir);
                        File repoFile = new File(fileURL.getPath());
                        if (repoFile.getAbsolutePath().equalsIgnoreCase(repoConn.getRepositoryLocation())) {
                            repoName = rc.getId();
                            break;
                        }
                    } catch (Exception e) {
                        throw new InstallException(RepositoryUtils.getMessage("ERROR_DIRECTORY_NOT_EXISTS", repoDir));
                    }
                } else {
                    if (rc.getUrl().equalsIgnoreCase(repoConn.getRepositoryLocation())) {
                        repoName = rc.getId();
                        break;
                    }
                }
            }
        }
        return repoName;
    }
348092
def _repo_name(self):
        

        if self._git_repo_name is not None:
            return self._git_repo_name
        else:
            reponame = self.repo.git_dir.split(os.sep)[-2]
            if reponame.strip() == '':
                return 'unknown_repo'
            return reponame
1054120
def del_repo(repo, **kwargs):
    '''
    
    '''

    try:
        _locate_repo_files(repo, rewrite=True)
    except IOError:
        return False
    else:
        return True
1165571
def get_repo_name(repo_dir):
    

    repo = git.Repo(repo_dir)
    url = repo.remotes.origin.url

    return url.split('/')[-1].split('.git')[0]
327555
public void removeRepository(Repository repo) throws GreenPepperServerException
    {
        if(!repositories.contains(repo))
        {
            throw new GreenPepperServerException( GreenPepperServerErrorKey.REPOSITORY_NOT_FOUND, "Repository not found");
        }

        repositories.remove(repo);
        repo.setProject(null);
    }
1080300
def ppa(state, host, name, present=True):
    '''
    
    '''

    if present:
        yield 'apt-add-repository -y "{0}"'.format(name)

    if not present:
        yield 'apt-add-repository -y --remove "{0}"'.format(name)
1177681
def delete_branch(self, repo, branch, prefix):
        
        # make sure that the name of the branch begins with pyup.
        assert branch.startswith(prefix)
        obj = repo.branches.get(branch)
        obj.delete()
1154324
def remove(cls, repo, name):
        
        repo.git.remote("rm", name)
        if isinstance(name, cls):
            name._clear_cache()
        return name