Exemple #1
0
 def __init__(self,
              remote,
              path='puller',
              branch="master",
              *args,
              **kwargs):
     super().__init__(path)
     remotepath = "file://%s" % os.path.abspath(remote.path)
     self.gp = GitPuller(remotepath, path, branch=branch, *args, **kwargs)
Exemple #2
0
def main(repo, dest):
    print(repo, dest)
    question = 'confirm pulling\n    from ' + repo + '\n    into ' + dest
    reply = str(input(question + '\n (y/n): ')).lower().strip()
    if reply[:1] == 'y':
        gp = GitPuller(repo, "master", dest)

        try:
            for line in gp.pull():
                print(line)  # print log output from actions taken
        except Exception as e:
            print(e)
class Puller:
    def __init__(self, remote, path='puller'):
        self.path = path
        self.gp = GitPuller(remote.path, 'master', path)

    def __enter__(self):
        for line in self.gp.pull():
            print(line)
        return self

    def __exit__(self, *args):
        shutil.rmtree(self.path)

    def git(self, *args):
        return sp.check_output(['git'] + list(args),
                               cwd=self.path,
                               stderr=sp.STDOUT).decode().strip()

    def write_file(self, path, content):
        with open(os.path.join(self.path, path), 'w') as f:
            f.write(content)

    def read_file(self, path):
        with open(os.path.join(self.path, path)) as f:
            return f.read()
Exemple #4
0
class Puller(Repository):
    def __init__(self, remote, path='puller', *args, **kwargs):
        super().__init__(path)
        remotepath = "file://%s" % os.path.abspath(remote.path)
        self.gp = GitPuller(remotepath, 'master', path, *args, **kwargs)

    def pull_all(self):
        for l in self.gp.pull():
            print('{}: {}'.format(self.path, l.rstrip()))

    def __enter__(self):
        print()
        self.pull_all()
        return self
 def __init__(self, remote, path='puller'):
     self.path = path
     self.gp = GitPuller(remote.path, 'master', path)
Exemple #6
0
# This simple pattern does what nbgitpuller does on
# https://jupyterhub.cs.tufts.edu for someone who is
# running their own server instead.

# you must run
#     pip install nbgitpuller
# for this to work

# For details, browse to
#     https://github.com/jupyterhub/nbgitpuller/blob/master/docs/index.md

# enter your repository location as a path on your hard disk.
# an absolute path is recommended. The example path is in Windows.
MY_REPO = '/c/Users/acouch/Documents/GitHub/comp205'

from nbgitpuller import GitPuller
gp = GitPuller("https://github.com/prof-couch/comp205", "master", MY_REPO)

try:
    for line in gp.pull():
        print(line)  # print log output from actions taken
except Exception as e:
    print(e)
Exemple #7
0
from nbgitpuller import GitPuller
gp = GitPuller('https://github.com/steven-wolfman/ubc-cpsc103-2019W1-syzygy-distro', 'master', './cs103')
output = []
[output.append(line) for line in gp.pull()]
gp.repo_is_dirty()