当前位置: 首页>>代码示例>>Python>>正文


Python repo.Repo类代码示例

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


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

示例1: get_text

    def get_text(self, sha=None):
        
        if self.chapter.tutorial:
            tutorial = self.chapter.tutorial
        else:
            tutorial = self.chapter.part.tutorial        
        repo = Repo(tutorial.get_path())

        # find hash code
        if sha is None:
            sha = tutorial.sha_draft
        
        manifest = get_blob(repo.commit(sha).tree, "manifest.json")
        tutorial_version = json_reader.loads(manifest)
        if "parts" in tutorial_version:
            for part in tutorial_version["parts"]:
                if "chapters" in part:
                    for chapter in part["chapters"]:
                        if "extracts" in chapter:
                            for extract in chapter["extracts"]:
                                if extract["pk"] == self.pk:
                                    path_ext = extract["text"]
                                    break 
        if "chapter" in tutorial_version:
            chapter = tutorial_version["chapter"]
            if "extracts" in chapter:
                for extract in chapter["extracts"]:
                    if extract["pk"] == self.pk:
                        path_ext = extract["text"]
                        break

        if path_ext:
            return get_blob(repo.commit(sha).tree, path_ext)
        else:
            return None
开发者ID:AlexRNL,项目名称:zds-site,代码行数:35,代码来源:models.py

示例2: get_latest_status

    def get_latest_status(self):
        """
            Property for viewing repository latest commit status message.
        """

        repo = Repo(Repo.get_repository_location(self.owner.username, self.name))
        return repo.get_latest_status()
开发者ID:Djacket,项目名称:djacket,代码行数:7,代码来源:models.py

示例3: _clone_repo

 def _clone_repo(repo_url):
     user_home = os.path.expanduser('~')
     # Assuming git url is of form [email protected]:user/git-repo.git
     repo_name = repo_url[repo_url.rfind('/') + 1: repo_url.rfind('.')]
     abs_local_path = os.path.join(user_home, repo_name)
     Repo.clone_from(repo_url, abs_local_path)
     return abs_local_path
开发者ID:bjoernbessert,项目名称:st2,代码行数:7,代码来源:download.py

示例4: load_json_for_public

    def load_json_for_public(self, sha=None):
        if sha is None:
            sha = self.sha_public
        repo = Repo(self.get_path())
        mantuto = get_blob(repo.commit(sha).tree, 'manifest.json')
        data = json_reader.loads(mantuto)

        return data
开发者ID:AlexRNL,项目名称:zds-site,代码行数:8,代码来源:models.py

示例5: update

def update(options, error, debug, info):
    path = getcwd()
    repo = Repo(path)

    if not repo.is_dirty():
        update_from_remote(debug, info, repo, 'origin')
        update_from_remote(debug, info, repo, 'upstream')
    else:
        error('Please commit or stash your changes before continuing.')
开发者ID:Ponginae,项目名称:release-tool,代码行数:9,代码来源:pavement.py

示例6: commits_stats

def commits_stats(request, username, repository):
    """
        Returns number of commits for the given repository.
    """

    repo = Repo(Repo.get_repository_location(username, repository))
    stats = GitStatistics(repo, repo.get_head())

    return HttpResponse(json.dumps({'weekly': stats.for_commits(weekly, js), 'monthly': stats.for_commits(monthly, js)}))
开发者ID:Djacket,项目名称:djacket,代码行数:9,代码来源:views.py

示例7: init_bare_repo_signal

def init_bare_repo_signal(sender, instance, created, **kwargs):
    """
        Initialize a bare git repository on server's deposit after it's creation.
    """

    if created:
        # Create repository folder under GIT_DEPOSIT_ROOT/username/repository.git and initialize it as bare.
        repository_location = Repo.get_repository_location(instance.owner.username, instance.name)
        repo = Repo(repository_location)
        repo.init_bare_repo()
开发者ID:Djacket,项目名称:djacket,代码行数:10,代码来源:signals.py

示例8: _clone_repo

    def _clone_repo(repo_url, verifyssl=True, branch='master'):
        user_home = os.path.expanduser('~')
        # Assuming git url is of form [email protected]:user/git-repo.git
        repo_name = repo_url[repo_url.rfind('/') + 1: repo_url.rfind('.')]
        abs_local_path = os.path.join(user_home, repo_name)

        # Disable SSL cert checking if explictly asked
        if not verifyssl:
            os.environ['GIT_SSL_NO_VERIFY'] = 'true'

        Repo.clone_from(repo_url, abs_local_path, branch=branch)
        return abs_local_path
开发者ID:bsyk,项目名称:st2,代码行数:12,代码来源:download.py

示例9: __init__

    def __init__(self, database):
        logging.info("Initializing GitSync.")

        self.database = database
        self.charts = dict()
        self.url = DEFAULT_GITREPO

        try:
            self.repo = Repo(REPO_DIRECTORY)
        except InvalidGitRepositoryError:
            logging.info("Cloning repository in %s", REPO_DIRECTORY)
            self.repo = Repo.clone_from(self.url, REPO_DIRECTORY)
开发者ID:harbur,项目名称:elastickube,代码行数:12,代码来源:repo.py

示例10: _setup_repo

    def _setup_repo(self, already_cloned):
        if already_cloned:
            self._git_repo = Repo(self.repo_dir_path)
        else:
            _log.info('Cloning repo from %s into %s' % (
                self._github_repo_url, self.repo_dir_path))
            self._git_repo = Repo.clone_from(
                self._github_repo_url, self.repo_dir_path)
            _log.info('-Done-')

        if self.branch:
            self._git_repo.git.checkout(self.branch)
开发者ID:patrickwestphal,项目名称:dl-learner-regression-stats,代码行数:12,代码来源:dllearnerrepo.py

示例11: get_conclusion

    def get_conclusion(self, sha=None):
        # find hash code
        if sha is None:
            sha = self.sha_draft
        repo = Repo(self.get_path())
        
        manifest = get_blob(repo.commit(sha).tree, "manifest.json")
        tutorial_version = json_reader.loads(manifest)
        if "introduction" in tutorial_version:
            path_tuto = tutorial_version["conclusion"]

        if path_tuto:
            return get_blob(repo.commit(sha).tree, path_tuto)
开发者ID:AlexRNL,项目名称:zds-site,代码行数:13,代码来源:models.py

示例12: detect_from_commits_list

 def detect_from_commits_list(self, args):
     historage = Repo(args.historage_dir)
     extract_method_information = []
     try:
         for a_commit_hash, b_commit_hash in csv.reader(open(args.commits_list)):
             a_commit = historage.commit(a_commit_hash)
             b_commit = historage.commit(b_commit_hash)
             extract_method_information.extend(detect_extract_method_from_commit(a_commit, b_commit))
     except ValueError:
         print "Invalid input."
         return
     except BadObject, name:
         print "Invalid hash of the commit:", name.message
开发者ID:niwatolli3,项目名称:kenja,代码行数:13,代码来源:refactoring_detection.py

示例13: _clone_repo

    def _clone_repo(repo_url, verifyssl=True, branch="master"):
        user_home = os.path.expanduser("~")
        # Assuming git url is of form [email protected]:user/git-repo.git
        repo_name = DownloadGitRepoAction._eval_repo_name(repo_url)
        abs_local_path = os.path.join(user_home, repo_name)

        # Disable SSL cert checking if explictly asked
        if not verifyssl:
            os.environ["GIT_SSL_NO_VERIFY"] = "true"
        # Shallow clone the repo to avoid getting all the metadata. We only need HEAD of a
        # specific branch so save some download time.
        Repo.clone_from(repo_url, abs_local_path, branch=branch, depth=1)
        return abs_local_path
开发者ID:rlugojr,项目名称:st2,代码行数:13,代码来源:download.py

示例14: detect_from_commits_list

 def detect_from_commits_list(self, args):
     historage = Repo(args.historage_dir)
     results = []
     try:
         for a_commit_hash, b_commit_hash in csv.reader(open(args.commits_list)):
             a_commit = historage.commit(a_commit_hash)
             b_commit = historage.commit(b_commit_hash)
             results.extend(detect_shingle_pullup_method(a_commit, b_commit))
     except ValueError:
         print("Invalid input.")
         return
     except BadObject, name:
         print("Invalid hash of the commit:", name.message)
开发者ID:daiki1217,项目名称:kenja,代码行数:13,代码来源:pull_up_method.py

示例15: _clone_repo

    def _clone_repo(repo_url, verifyssl=True, branch='master'):
        user_home = os.path.expanduser('~')
        # Assuming git url is of form [email protected]:user/git-repo.git
        repo_name = repo_url[repo_url.rfind('/') + 1: repo_url.rfind('.')]
        abs_local_path = os.path.join(user_home, repo_name)

        # Disable SSL cert checking if explictly asked
        if not verifyssl:
            os.environ['GIT_SSL_NO_VERIFY'] = 'true'
        # Shallow clone the repo to avoid getting all the metadata. We only need HEAD of a
        # specific branch so save some download time.
        Repo.clone_from(repo_url, abs_local_path, branch=branch, depth=1)
        return abs_local_path
开发者ID:ipv1337,项目名称:st2,代码行数:13,代码来源:download.py


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