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


Python Jagare.update_ref方法代码示例

本文整理汇总了Python中ellen.repo.Jagare.update_ref方法的典型用法代码示例。如果您正苦于以下问题:Python Jagare.update_ref方法的具体用法?Python Jagare.update_ref怎么用?Python Jagare.update_ref使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ellen.repo.Jagare的用法示例。


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

示例1: update_ref

# 需要导入模块: from ellen.repo import Jagare [as 别名]
# 或者: from ellen.repo.Jagare import update_ref [as 别名]
 def update_ref(self, path, ref, newvalue):
     try:
         repo = Jagare(path)
         repo.update_ref(ref, newvalue)
         return True
     except Exception as e:
         raise ServiceUnavailable(repr(e))
开发者ID:tclh123,项目名称:jagare-rpc,代码行数:9,代码来源:jagare_handler.py

示例2: ProjectRepo

# 需要导入模块: from ellen.repo import Jagare [as 别名]
# 或者: from ellen.repo.Jagare import update_ref [as 别名]

#.........这里部分代码省略.........
    def get_temp_branch(self):
        commit = self.get_commit('HEAD')
        return 'patch_tmp' + time.strftime('%Y%m%d%H%M%S-') + commit.sha[10]

    def get_patch_file(self, ref, from_ref=None):
        return self.repo.format_patch(ref, from_ref)

    def get_diff_file(self, ref, from_ref=None):
        _raw_diff = self.get_raw_diff(ref, from_ref)
        if not _raw_diff:
            return ''
        return _raw_diff['diff'].patch

    def get_last_update_timestamp(self):
        commit = self.get_last_commit('HEAD')
        if not commit:
            return 0
        return int(commit.author_timestamp)

    @classmethod
    def init(cls, path, work_path=None, bare=True):
        return Jagare.init(path, work_path=work_path, bare=bare)

    @classmethod
    def mirror(cls, url, path, env=None):
        Jagare.mirror(url, path, env=env)

    def add_remote(self, name, url):
        return self.repo.add_remote(name, url)

    def add_remote_hub(self, name, url):
        self.add_remote('hub/%s' % name, url)

    def update_ref(self, ref, value):
        return self.repo.update_ref(ref, value)

    def sha(self, rev='HEAD'):
        return self.repo.sha(rev)

    def merge_base(self, to_sha, from_sha):
        return self.repo.merge_base(to_sha, from_sha)

    def remotes(self):
        return self.repo.remotes()

    def fetch_all(self):
        self.repo.fetch_all()

    def fetch(self, name):
        self.repo.fetch(name)

    def archive(self):
        super(ProjectRepo, self).archive(self.project.name)

    def get_latest_update_branches(self):
        refs = self.repo.listall_references()
        refs = filter(lambda r:r.startswith('refs/heads'), refs)
        current_time = time.time()
        latest_branches = []
        for ref in refs:
            commit_time = self.repo.lookup_reference(ref).get_object().commit_time
            delta = current_time - commit_time
            if delta < LATEST_UPDATE_REF_THRESHOLD:
                latest_branches.append((commit_time, ref.split('/')[-1]))
        return sorted(latest_branches, key=lambda r:r[0], reverse=True)
开发者ID:4T-Shirt,项目名称:code,代码行数:69,代码来源:repo.py

示例3: ProjectRepo

# 需要导入模块: from ellen.repo import Jagare [as 别名]
# 或者: from ellen.repo.Jagare import update_ref [as 别名]

#.........这里部分代码省略.........
    def commit_file(self, *w, **kw):
        return self.repo.commit_file(*w, **kw)

    def get_temp_branch(self):
        commit = self.get_commit("HEAD")
        return "patch_tmp" + time.strftime("%Y%m%d%H%M%S-") + commit.sha[10]

    def get_patch_file(self, ref, from_ref=None):
        return self.repo.format_patch(ref, from_ref)

    def get_diff_file(self, ref, from_ref=None):
        _raw_diff = self.get_raw_diff(ref, from_ref)
        if not _raw_diff:
            return ""
        patch = _raw_diff["diff"].patch
        if not patch:
            return ""
        return patch

    @classmethod
    def init(cls, path, work_path=None, bare=True):
        return Jagare.init(path, work_path=work_path, bare=bare)

    @classmethod
    def mirror(cls, url, path, env=None):
        Jagare.mirror(url, path, env=env)

    def add_remote(self, name, url):
        return self.repo.add_remote(name, url)

    def add_remote_hub(self, name, url):
        self.add_remote("hub/%s" % name, url)

    def update_ref(self, ref, value):
        result = None
        try:
            result = self.repo.update_ref(ref, value)
        except JagareError:
            # FIXME: logging
            # FIXME: more meaningful error (JagareError)
            pass
        return result

    def sha(self, rev="HEAD"):
        return self.repo.sha(rev)

    def merge_base(self, to_sha, from_sha):
        return self.repo.merge_base(to_sha, from_sha)

    @property
    def remotes(self):
        return self.repo.remotes

    def fetch_all(self):
        self.repo.fetch_all()

    def fetch(self, name):
        self.repo.fetch(name)

    def fetch_(self, *w, **kw):
        return self.repo.fetch_(*w, **kw)

    def get_latest_update_branches(self):
        refs = self.repo.listall_references()
        refs = filter(lambda r: r.startswith("refs/heads"), refs)
        current_time = time.time()
开发者ID:mozillazg,项目名称:code,代码行数:70,代码来源:repo.py


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