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


Python Repo.commits方法代码示例

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


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

示例1: info

# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import commits [as 别名]
def info(request):
    path = os.path.abspath(os.path.join(BASE_DIR, '.git'))
    repo = Repo(path)
    return HttpResponse(json.dumps({
        'branch': repo.active_branch,
        'commit': repo.commits(repo.active_branch)[0].id,
    }))
开发者ID:tumani1,项目名称:vsevi,代码行数:9,代码来源:views.py

示例2: get_git_sha1

# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import commits [as 别名]
def get_git_sha1():
    try:
        from git import Repo
    except ImportError:
        print >> sys.stderr, "could not import gitpython"
        return None
    repo = Repo(os.path.dirname(__file__))
    sha1 = repo.commits()[0].id
    return sha1
开发者ID:yarden,项目名称:hmm,代码行数:11,代码来源:setup.py

示例3: get_git_commit

# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import commits [as 别名]
def get_git_commit(fail_silently=True):
    """Returns the current git commit hash for the project.
       NOTE: This depends on GitPython being available."""
    try:
        from git import Repo
        repo = Repo(settings.ROOT)
        return repo.commits(repo.active_branch, max_count=1)[0].id_abbrev
    except:
        if fail_silently:
            return 'Unknown'
        raise
开发者ID:obeattie,项目名称:dj_deploy,代码行数:13,代码来源:vcs.py

示例4: check_state_commits

# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import commits [as 别名]
def check_state_commits(state):
    repo = Repo('..')
    data = {}
    commits = repo.commits(path='scripts/'+state, max_count=1000)
    if commits:
        data['num_commits'] = len(commits)
        data['latest_commit'] = time.strftime('%Y-%m-%d', commits[0].committed_date)
        authors = set()
        for c in commits:
            authors.add(c.author.name)
        data['authors'] = ', '.join(authors)
    return data
开发者ID:HughP,项目名称:fiftystates,代码行数:14,代码来源:status_report.py

示例5: Repo

# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import commits [as 别名]

# Begin main body

# Parse arguments
username = sys.argv[1]  # bob
password = sys.argv[2]  # foobar
ftpsite = sys.argv[3]  # example.com
base = sys.argv[4]  # /www/www (must already exist!)
reposite = sys.argv[5]  # /home/bob/website

# Windows doesn't like env
Git.git_binary = "git"

repo = Repo(reposite)
commit = repo.commits("master", 1)[0]
tree = commit.tree
ftp = ftplib.FTP(ftpsite, username, password)

# Check revision
hashFile = cStringIO.StringIO()
try:
    ftp.retrbinary("RETR " + base + "/git-rev.txt", hashFile.write)
    hash = hashFile.getvalue()
except ftplib.error_perm:
    hash = 0

if not hash:
    # Perform full upload
    uploadAll(tree, ftp, base)
else:
开发者ID:dawehner,项目名称:dereine_config,代码行数:32,代码来源:git-ftp.py

示例6: Repo

# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import commits [as 别名]
import datetime

repo = Repo(".")
current_day = 0
current_month = 0
current_year = 0
commits = {}

summup = {}

markers = ["#", "*", "/", "$", "="]

authors_marker_mapping = {}
print repo.commit_count()

for commit in repo.commits(max_count=repo.commit_count()):
    print dir(commit)
    break

    author = str(commit.author)

    if not authors_marker_mapping.has_key(author):
        marker = markers.pop()
        authors_marker_mapping[author] = marker

    commit_date = commit.committed_date
    new_day = commit_date.tm_mday
    new_month = commit_date.tm_mon
    new_year = commit_date.tm_year

    if not summup.has_key(new_year):
开发者ID:feth,项目名称:conf_files,代码行数:33,代码来源:gitgraph.py


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