本文整理汇总了Python中gittle.Gittle.init方法的典型用法代码示例。如果您正苦于以下问题:Python Gittle.init方法的具体用法?Python Gittle.init怎么用?Python Gittle.init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gittle.Gittle
的用法示例。
在下文中一共展示了Gittle.init方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init
# 需要导入模块: from gittle import Gittle [as 别名]
# 或者: from gittle.Gittle import init [as 别名]
def init(path):
try:
repo = Gittle.init(path)
return repo
except:
AgentGitHandler.log.exception("Initializing local repo at %r failed" % path)
raise Exception("Initializing local repo at %r failed" % path)
示例2: init_repo_if_empty
# 需要导入模块: from gittle import Gittle [as 别名]
# 或者: from gittle.Gittle import init [as 别名]
def init_repo_if_empty(self,repo_name):
repopath=os.path.join(self.view['repo'].base,repo_name)
self.g= Gittle.init(repopath,bare=False )
self.g.commit('name','email','initial commit')
self.view['repo'].text=repo_name
console.hud_alert('Repo {} created'.format(repo_name))
self.did_select_repo(self.view['repo'])
示例3: init_repo_if_empty
# 需要导入模块: from gittle import Gittle [as 别名]
# 或者: from gittle.Gittle import init [as 别名]
def init_repo_if_empty(self,repo_name,gitpath):
if not os.path.exists(gitpath):
self.g= Gittle.init(gitpath,bare=False )
self.g.commit('name','email','initial commit')
self.view['repo'].text=repo_name
console.hud_alert('Repo {} created'.format(repo_name))
self.refresh()
示例4: __init__
# 需要导入模块: from gittle import Gittle [as 别名]
# 或者: from gittle.Gittle import init [as 别名]
def __init__(self, path):
try:
self.gittle = Gittle(path)
except NotGitRepository:
self.gittle = Gittle.init(path)
# Dulwich repo
self.repo = self.gittle.repo
self.path = path
示例5: push_directory_to_repo
# 需要导入模块: from gittle import Gittle [as 别名]
# 或者: from gittle.Gittle import init [as 别名]
def push_directory_to_repo(directory, github_repo):
auth = FixedGittleAuth(pkey=open(settings.GITHUB_PRIVATE_KEY))
repo = Gittle.init(directory, auth=auth)
files = []
with work_in(directory):
for root, dirnames, filenames in os.walk("."):
# remove the leading './'
root = root[2:]
# skip .git directories
if ".git" in dirnames:
dirnames.remove(".git")
for f in filenames:
path = os.path.join(root, f)
files.append(str(path))
repo.commit(name="bakehouse", message="Hello world", files=files)
repo.push(github_repo.ssh_url, branch_name="master")
示例6: git_init
# 需要导入模块: from gittle import Gittle [as 别名]
# 或者: from gittle.Gittle import init [as 别名]
def git_init(args):
if len(args) == 1:
Gittle.init(args[0])
else:
print command_help['init']
示例7: get_transport_and_path
# 需要导入模块: from gittle import Gittle [as 别名]
# 或者: from gittle.Gittle import init [as 别名]
print repos.name
print repos.get_commits()[0].sha
repo_path = 'data'
repo_url = 'git://github.com/rhocode/axis.git'
try:
repo = Gittle.clone(repo_url, repo_path)
except OSError:
repo = Gittle.init(repo_path)
repo.switch_branch(b'gh-pages')
repo.pull()
# client, host_path = get_transport_and_path("https://github.com/rhocode/axis.git")
# r = Repo.init("test", mkdir=True)
# remote_refs = client.fetch(host_path, r,
# determine_wants=r.object_store.determine_wants_all,
# progress=sys.stdout.write)
# branches = client.fetch(host_path, r)
# r["HEAD"] = remote_refs["HEAD"]
示例8: init
# 需要导入模块: from gittle import Gittle [as 别名]
# 或者: from gittle.Gittle import init [as 别名]
def init(self, repoPath):
self.repo = Gittle.init(repoPath)
print("Created Repo")
示例9: mkdtemp
# 需要导入模块: from gittle import Gittle [as 别名]
# 或者: from gittle.Gittle import init [as 别名]
# -*- coding: utf8 -*-
import os
from gittle import Gittle
from tempfile import mkdtemp
path = mkdtemp()
fn = 'test.txt'
filename = os.path.join(path, fn)
name = 'Samy Pessé'
email = '[email protected]'
message = "C'est beau là bas"
def create_file():
fd = open(filename, 'w+')
fd.write('blabla\n BOOM BOOM\n à la montagne')
fd.close()
repo = Gittle.init(path)
create_file()
repo.stage(fn)
repo.commit(name=name, email=email, message=message)
print('COMMIT_INFO =', repo.commit_info())
print('PATH =', path)