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


Python Gittle.pull方法代码示例

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


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

示例1: gitPull

# 需要导入模块: from gittle import Gittle [as 别名]
# 或者: from gittle.Gittle import pull [as 别名]
def gitPull():
    logging.info('*** Pulling changed files from remote repository ***')
    destinations = [dataDestination, PDFdestination]
    remotes = ['dataRemote', 'PDFRemote']
    for d, r in zip(destinations, remotes):
        repo = Gittle(d, origin_uri=config.get('Git', r))
        repo.pull()
开发者ID:a-berish,项目名称:asExportIncremental,代码行数:9,代码来源:asExportIncremental.py

示例2: git_pull

# 需要导入模块: from gittle import Gittle [as 别名]
# 或者: from gittle.Gittle import pull [as 别名]
		def git_pull(args):
			if len(args) <= 1:
				repo = Gittle('.')
				url = args[0] if len(args)==1 else repo.remotes.get('origin','')
				if url:
					repo.pull(origin_uri=url)
				else:
					print 'No pull URL.'
			else:
				print command_help['git pull']
开发者ID:Gerzer,项目名称:shellista,代码行数:12,代码来源:shellista.py

示例3: update_repo

# 需要导入模块: from gittle import Gittle [as 别名]
# 或者: from gittle.Gittle import pull [as 别名]
def update_repo(cookie):
    # TODO: add commit info to the CookieCutter model
    if not os.path.isdir(cookie.repo_path):
        repo = Gittle.clone(cookie.url, cookie.repo_path)
    else:
        repo = Gittle(cookie.repo_path, cookie.url)
        repo.pull()

    cookie.options = {'repo_name': 'your repo'}
    options_file = os.path.join(cookie.repo_path, 'cookiecutter.json')

    if os.path.isfile(options_file):
        cookie.options.update(json.load(open(options_file)))

    cookie.save()
开发者ID:DjangoLover,项目名称:ROLL-studio,代码行数:17,代码来源:tasks.py

示例4: __init__

# 需要导入模块: from gittle import Gittle [as 别名]
# 或者: from gittle.Gittle import pull [as 别名]
class GPassGit:

    #Creates a Git object
    def __init__(self, repoPath):
        self.repoPath = repoPath
        self.repo = None
        if self.isRepoSet():
            self.repo = Gittle(self.repoPath)

    #Check For Git Repo
    def isRepoSet(self):
        if os.path.isfile(self.repoPath + '/.git/config'):
            return True
        return False

    def init(self, repoPath):
    	self.repo = Gittle.init(repoPath)
    	print("Created Repo")

    def add(self, filePath):
    	self.repo.stage([filePath])

    def commit(self, user, em, msg):
    	self.repo.commit(
            name=user,
            email=em,
            message=msg
        )

    # Authentication with RSA private key
    def auth(self, key):
        key_file = open(key)
        repo.auth(pkey=key_file)

    def push(self, key):
        self.auth(key)
        self.repo.push()

    def pull(self, key):
        self.auth(key)
        self.repo.pull()

    def acp(self, filepath, user, em, msg):
    	self.add(filepath)
    	self.commit(user, em, msg)
    	self.push(key)
        
开发者ID:cmo8,项目名称:gpass-python,代码行数:48,代码来源:_gPassGit.py

示例5: Git

# 需要导入模块: from gittle import Gittle [as 别名]
# 或者: from gittle.Gittle import pull [as 别名]
class Git(Base):
    '''
    a git vcs object
    '''

    def __init__(self, repo_url, repo_path):
        super(Git, self).__init__(repo_url, repo_path)
        self._cloned = path.exists(repo_path)

    def clone(self, key_file=None, username=None, password=None):
        '''
        clone the git repo

        :param key_file: string : None
        location of private key if you want to connect using RSA
        :param username: string : None
        username if you wnat to connect using basic authentication
        :param password: string : None
        password if you wnat to connect using basic authentication
        '''
        if self._cloned is False:
            if key_file is not None:
                # Authentication with RSA private key
                key_file = open(key_file)
                Gittle.clone(self.repo_url, self.repo_path, auth=GittleAuth(pkey=key_file))
            elif username is not None and password is not None:
                # With username and password
                Gittle.clone(self.repo_url, self.repo_path,
                             auth=GittleAuth(username=username, password=password))
            else:
                # Without anything , is it even possible?
                Gittle.clone(self.repo_url, self.repo_path)

    def pull(self):
        '''
        pull the latest version
        '''
        self.clone()
        self.repo = Gittle(self.repo_path, origin_uri=self.repo_url)
        self.repo.pull()

    def push(self):
        '''
        push to the remote repository
        '''
        raise NotImplementedError
开发者ID:abzcoding,项目名称:rostam,代码行数:48,代码来源:git.py

示例6: handle

# 需要导入模块: from gittle import Gittle [as 别名]
# 或者: from gittle.Gittle import pull [as 别名]
    def handle(self, *args, **options):
        projects = Project.objects.all()

        for project in projects:
            print('Checking {0} for new commits'.format(project))
            if project.git_url:
                repo_path = '/tmp/' + project.slug
                try:
                    repo = Gittle(repo_path, project.git_url)
                    repo.pull()
                except:
                    try:
                        repo = Gittle.clone(project.git_url, repo_path)
                    except:
                        # put some logging here
                        repo = None
                if repo:
                    new_commits = []
                    for commit in repo.commit_info():
                        try:
                            prev_commit = repo.get_previous_commit(commit['sha'])
                            time = (datetime.fromtimestamp(commit['time']) + timedelta(hours=commit['timezone']/(60*60))).replace(tzinfo=pytz.utc)
                            try:
                                user_author = get_user_model().objects.get(email=commit['author']['email'])
                                string_author = None
                            except:
                                string_author = commit['author']['name']
                                user_author = None

                            summary = commit['message'].split('\n')[0][:45]
                            pcommit = ProjectCommit.objects.create(
                                project=project,
                                chash=commit['sha'],
                                message=commit['message'],
                                summary=summary,
                                user_author=user_author,
                                string_author=string_author,
                                created=time,
                                time=time,
                                diff=repo.diff(commit['sha'], prev_commit).next()['diff']
                            )
                            print(pcommit, ' added.')
                            new_commits.append(pcommit)
                        except:
                            pass
开发者ID:Code4Maine,项目名称:beehve,代码行数:47,代码来源:update_project_repos.py

示例7: Gittle

# 需要导入模块: from gittle import Gittle [as 别名]
# 或者: from gittle.Gittle import pull [as 别名]
from gittle import Gittle

from config import repo_path, repo_url, key_file

# Gittle repo
g = Gittle(repo_path, origin_uri=repo_url)

# Authentication
g.auth(pkey=key_file)

# Do pull
g.pull()
开发者ID:0asa,项目名称:gittle,代码行数:14,代码来源:pull.py

示例8: Gittle

# 需要导入模块: from gittle import Gittle [as 别名]
# 或者: from gittle.Gittle import pull [as 别名]
# /usr/bin/python
# coding=utf-8
'''help me to git add changes '''
from gittle import Gittle
import  sys

conf = [
    ['/home/zhang/www/php', '[email protected]:tianyunchong/php.git']
]
for con in conf:
	repo = Gittle(con[0], con[1])
	#拉取远程代码到本地
	key_file = open("/home/zhang/.ssh/id_rsa")
	repo.auth(key_file)
	repo.pull(con[1], "origin/master")
	sys.exit()
	untracks = repo.untracked_files
	if not untracks:
		print "暂时没有文件新增!"
	changes = repo.modified_files
	print changes
开发者ID:tianyunchong,项目名称:python,代码行数:23,代码来源:git.py


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