Display repo github path
513686
def remote(ctx):
    
    with command():
        m = RepoManager(ctx.obj['agile'])
        click.echo(m.github_repo().repo_path)
467173
def guess_github_repo():
    
    p = subprocess.run(['git', 'ls-remote', '--get-url', 'origin'],
        stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=False)
    if p.stderr or p.returncode:
        return False

    url = p.stdout.decode('utf-8').strip()
    m = GIT_URL.fullmatch(url)
    if not m:
        return False
    return m.group(1)
839886
def _get_repo_file_url(namespace, filename):
    
    return '{base_url}{namespace}/{filename}'.format(base_url=_get_repo_url(),
                                                     namespace=namespace,
                                                     filename=filename)
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'
        )
450630
function getGitFolder() {
	// Based on logic in Module._nodeModulePaths at
	// https://github.com/joyent/node/blob/master/lib/module.js
	var from = path.resolve('.'),
		parts = from.split(process.platform === 'win32' ? /[\/\\]/ : /\//),
		tip, dir

	for (tip = parts.length - 1; tip >= 0; tip--) {
		dir = parts.slice(0, tip + 1).concat('.git').join(path.sep)
		try {
			if (fs.statSync(dir).isDirectory()) {
				// Found a valid .git directory
				return dir
			}
		} catch (e) {
			// Let 'for' iterate
		}
	}
	return ''
}
378828
def get_repos(self):
        
        return github.PaginatedList.PaginatedList(
            github.Repository.Repository,
            self._requester,
            self.url + "/repos",
            None
        )
1225624
def _get_repos(self):
        
        result = {}
        for xmlpath in self.installed:
            repo = RepositorySettings(self, xmlpath)
            result[repo.name.lower()] = repo

        return result
1093398
def find_repo_root_by_path(path):
    """"""
    repo = git.Repo(path, search_parent_directories=True)
    repo_path = repo.git.rev_parse('--show-toplevel')
    logging.info('Repository: {}'.format(repo_path))
    return repo_path
1262024
def format_repo_status(repo):
    
    commit = repo.commit()
    return {
        'name': os.path.basename(repo.working_dir),
        'commit': commit.hexsha,
        'timestamp': datetime.fromtimestamp(
            commit.committed_date).isoformat(),
    }
833471
function resolveRepositoryPath(options, owner, repo) {
  let repPath = path.resolve(options.repoRoot, owner, repo);

  if (options.virtualRepos[owner] && options.virtualRepos[owner][repo]) {
    repPath = path.resolve(options.virtualRepos[owner][repo].path);
  }
  return repPath;
}
237074
def _get_configured_repos(root=None):
    '''
    
    '''

    repos = os.path.join(root, os.path.relpath(REPOS, os.path.sep)) if root else REPOS
    repos_cfg = configparser.ConfigParser()
    if os.path.exists(repos):
        repos_cfg.read([repos + '/' + fname for fname in os.listdir(repos) if fname.endswith(".repo")])
    else:
        log.warning('Repositories not found in %s', repos)

    return repos_cfg
650232
def _prime_install_map(self):
        """"""
        url = "{}/app/installations".format(self.api_url)
        headers = self._get_app_auth_headers()
        LOGGER.debug("Fetching installations for GitHub app")

        response = requests.get(url, headers=headers)
        response.raise_for_status()

        data = response.json()

        for install in data:
            install_id = install.get("id")
            token = self._get_installation_key(project=None, install_id=install_id)
            headers = {
                "Accept": PREVIEW_JSON_ACCEPT,
                "Authorization": "token {}".format(token),
            }

            url = "{}/installation/repositories?per_page=100".format(self.api_url)
            while url:
                LOGGER.debug("Fetching repos for installation %s", install_id)
                response = requests.get(url, headers=headers)
                response.raise_for_status()
                repos = response.json()

                # Store all projects in the installation map
                for repo in repos.get("repositories", []):
                    # TODO (fschmidt): Store the installation's
                    # permissions (could come in handy for later features)
                    project_name = repo["full_name"]
                    self.installation_map[project_name] = {
                        "installation_id": install_id,
                        "default_branch": repo["default_branch"],
                    }

                # Check if we need to do further page calls
                url = response.links.get("next", {}).get("url")
1165571
def get_repo_name(repo_dir):
    

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

    return url.split('/')[-1].split('.git')[0]
946190
function githubRepo (options) {
  try {
    const url = options.data.root.package.repository.url
    const match = url.match(/.*?(:\/\/|@)github\.com[/:](.*?)(#.*?)?$/)
    if (match) {
      return match[2].replace(/\.git$/, '')
    } else {
      return null
    }
  } catch (e) {
    // No repositor-url exists
    return null
  }
}
1174101
def sbo_search_pkg(name):
    
    repo = Repo().default_repository()["sbo"]
    sbo_url = "{0}{1}/".format(repo, slack_ver())
    SLACKBUILDS_TXT = Utils().read_file(
        _meta_.lib_path + "sbo_repo/SLACKBUILDS.TXT")
    for line in SLACKBUILDS_TXT.splitlines():
        if line.startswith("SLACKBUILD LOCATION"):
            sbo_name = (line[23:].split("/")[-1].replace("\n", "")).strip()
            if name == sbo_name:
                return (sbo_url + line[23:].strip() + "/")
    return ""
1235004
def _load_github_repo():
    
    if 'TRAVIS' in os.environ:
        raise RuntimeError('Detected that we are running in Travis. '
                           'Stopping to prevent infinite loops.')
    try:
        with open(os.path.join(config_dir, 'repo'), 'r') as f:
            return f.read()
    except (OSError, IOError):
        raise RuntimeError('Could not find your repository. '
                           'Have you ran `trytravis --repo`?')
345523
def is_git_directory(path='.'):
    
    try:
        dulwich.repo.Repo.discover(path)
    except dulwich.errors.NotGitRepository:
        return False

    return True