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


Python Repo.clone方法代码示例

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


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

示例1: init_project

# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import clone [as 别名]
def init_project(project_name):
    if os.path.exists(project_name):
        print 'File already exists: {}'.format(project_name)
        exit(1)

    if not project_exists(project_name):
        api.create_project(project_name)
        repo = Repo.clone(api.project_url(project_name), '.', project_name, author())


        # TODO this is a silly way to create an initial config, with file contents in a silly spot among the code
        with open(os.path.join(project_name, 'README.md'), 'w') as f:
            default_readme = '''# TODO
'''
            f.write(default_readme)

        with open(os.path.join(project_name, '.gitignore'), 'w') as f:
            default_gitignore = '''# Don't spill your environment - exclude IDE and OS files in your private .gitignore
'''
            f.write(default_gitignore)

        with open(os.path.join(project_name, '.editorconfig'), 'w') as f:
            default_editorconfig = '''root = true

# basic configuration
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
trim-trailing-whitespace = true
indent-style = space
indent-size = 2

# You can add your extension-specific rules here!
# [*.js]
# [*.py]
# [*.md]
'''
            f.write(default_editorconfig)

        repo.add()
        repo.commit("Initial commit")
        # TODO consider wrapping next three in tag - push first is important to not break tagging
        repo.push()
        repo._execute('tag 0.0.0')
        repo.push()  # just the tag
        repo.create_branch('tig-master')
        repo.push('tig-master')

    else:
        repo = Repo.clone(api.project_url(project_name), '.', project_name, author())
        repo.create_branch('tig-master')

    branch_name = 'tig-master' + '-' + NAME

    repo.pull('tig-master')
    repo.create_branch(branch_name, 'tig-master')
    repo.change_branch(branch_name)
开发者ID:berniszon,项目名称:tig-cli,代码行数:60,代码来源:tig.py

示例2: clone

# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import clone [as 别名]
def clone(cachedir, url, tag, todir):
    '''
    Fetches tag <tag> from git repository by URL <url> into directory <todir>
    (creating git repository there if needed).

    Uses <cachedir> as a directory to store cache.
    '''
    cachedir = cachedir / url.replace(':', '-').replace('/', '-').replace('.', '-')
    ref = 'refs/tags/%s' % tag

    todir.makedirs_p(0755)
    if cachedir.exists() and cachedir.isdir():
        cr = Repo(cachedir)
        r = cr.clone(todir, origin='cache', quiet=True)
    else:
        r = Repo.init(todir)

    origin = r.create_remote('origin', url)
    try:
        origin.fetch('+%s:%s' % (ref,ref), quiet=True)
    except AssertionError:
        raise UnableToFetchError(url, ref)

    if _has_head(r, 'build'):
        r.heads.build.ref = Tag(r, ref).commit
    else:
        r.create_head('build', Tag(r, ref).commit)
    r.heads.build.checkout(force=True)

    if cachedir.exists() and cachedir.isdir():
        r.remote('cache').push(ref, force=True)
    else:
        cachedir.makedirs_p(0755)
        cr = r.clone(cachedir, bare=True, quiet=True)
开发者ID:OpenInkpot-archive,项目名称:iplinux-ubuild,代码行数:36,代码来源:cachegit.py

示例3: _cloneRepository

# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import clone [as 别名]
def _cloneRepository(dirname):
      '''
      Clones given repository.
      '''

      repoPath = os.path.join(bareReposPath, dirname)
      try:
            repo = Repo(repoPath)
            if repo.bare:
                  repo.clone(os.path.join(clonedReposPath, dirname[:suffixLength]))
            else:
                  repo.clone(os.path.join(clonedReposPath, dirname))
            
            print "[CLONE] '%s' was cloned" % repoPath

      except InvalidGitRepositoryError:
            print "[SKIP] the '%s' is not repo" % repoPath
开发者ID:w32blaster,项目名称:documentation-collector,代码行数:19,代码来源:collectDocumentation.py

示例4: tmp_git

# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import clone [as 别名]
def tmp_git(url):
    from django.conf import settings
    repo = Repo(url)
    tmp_repo_path = os.path.join(
        settings.POOTLE_FS_PATH, "__tmp_git_src__")
    if os.path.exists(tmp_repo_path):
        shutil.rmtree(tmp_repo_path)
    tmp_repo = repo.clone(tmp_repo_path)
    yield tmp_repo_path, tmp_repo
    shutil.rmtree(tmp_repo_path)
开发者ID:translate,项目名称:pootle_fs_git,代码行数:12,代码来源:utils.py

示例5: get_repo

# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import clone [as 别名]
def get_repo():
    ''' Gets repository for the current user, cloned from the origin.
    '''
    user_dir = realpath(quote('repo-' + session.get('email', 'nobody')))
    
    if isdir(user_dir):
        user_repo = Repo(user_dir)
        user_repo.remotes.origin.fetch()
        return user_repo
    
    source_repo = Repo(_repo_path)
    user_repo = source_repo.clone(user_dir, bare=False)
    
    return user_repo
开发者ID:migurski,项目名称:git-jekyll-cms,代码行数:16,代码来源:app.py

示例6: clone_repo

# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import clone [as 别名]
def clone_repo(old_path, new_path):
    """
    Proxy to ``git clone command``. Ensure directory are properly created

    :param old_path: path of the repo to be cloned
    :param new_path: path of the target repo
    :return: the target repository encapsulated in a ``GitPython`` object.
    :rtype: Repo
    """
    if not os.path.isdir(new_path):
        os.makedirs(new_path, mode=0o777)
    old_repo = Repo(old_path)
    new_repo = old_repo.clone(new_path)
    return new_repo
开发者ID:josephcab,项目名称:zds-site,代码行数:16,代码来源:utils.py

示例7: remote

# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import clone [as 别名]
    def remote(self):
        """
        Clones the test case's repository and tracks it as a remote.

        Returns a ``git.Repo`` object.
        """
        if not self._remote:
            clonedir = mkdtemp()
            self._clone_dirs.append(clonedir)

            self._remote = Repo.clone(self.repo, clonedir)

        # Update in case the remote has changed
        self._remote.remotes[0].pull()
        return self._remote
开发者ID:Mondego,项目名称:pyreco,代码行数:17,代码来源:allPythonContent.py

示例8: __init__

# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import clone [as 别名]
class GitDistiller:
    def __init__(self, git_dir):
        pass
        self.org_repo = Repo(git_dir)

    def clone_repo(self, new_repo_path):
        self.new_repo = self.org_repo.clone(new_repo_path)

    def distille(self, new_repo_path, extensions):
        new_repo_path = os.path.abspath(new_repo_path)
        self.clone_repo(new_repo_path)
        git = self.new_repo.git
        execcmd = self.create_remove_command_find(extensions)
        # execcmd = self.create_remove_command_xargs(extensions)
        cmd = ['--tree-filter', execcmd]

        git.filter_branch(cmd)

    def prune_empty(self):
        git = self.new_repo.git
        kwargs = {'f': True, 'prune-empty': True}
        git.filter_branch(**kwargs)

    def create_remove_command_find(self, extensions):
        assert len(extensions) > 0
        cmd = ['find', '.', '\\!', '\\(']
        first_extension = extensions.pop(0)
        cmd.extend(['-name', '\'*.%s\'' % (first_extension)])
        for extension in extensions:
            cmd.extend(['-o', '-name', '\'*.%s\'' % (extension)])
        cmd.extend(['-o', '-type', 'd'])
        cmd.append('\\)')
        cmd.extend(['-exec', 'rm', '{}', '\;'])

        return ' '.join(cmd)

    def create_remove_command_xargs(self, extensions):
        assert len(extensions) > 0
        cmd = ['find', '.', '\\!', '\\(']
        first_extension = extensions.pop(0)
        cmd.extend(['-name', '\'*.%s\'' % (first_extension)])
        for extension in extensions:
            cmd.extend(['-o', '-name', '\'*.%s\'' % (extension)])
        cmd.extend(['-o', '-type', 'd'])
        cmd.append('\\)')
        cmd.extend(['-print0', '|', 'xargs', '-0', 'rm'])
        print(cmd)
        return ' '.join(cmd)
开发者ID:daiki1217,项目名称:kenja,代码行数:50,代码来源:distiller.py

示例9: get_repo

# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import clone [as 别名]
def get_repo(flask_app):
    ''' Gets repository for the current user, cloned from the origin.
    '''
    dir_name = 'repo-' + session.get('email', 'nobody')
    user_dir = realpath(join(flask_app.config['WORK_PATH'], quote(dir_name)))
    
    if isdir(user_dir):
        user_repo = Repo(user_dir)
        user_repo.git.reset(hard=True)
        user_repo.remotes.origin.fetch()
        return user_repo
    
    source_repo = Repo(flask_app.config['REPO_PATH'])
    user_repo = source_repo.clone(user_dir, bare=False)
    
    return user_repo
开发者ID:MrMaksimize,项目名称:bizarro-cms,代码行数:18,代码来源:app.py

示例10: __init__

# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import clone [as 别名]
    def __init__(self, actor, task_id, default_id, origin_dirname, working_dirname, start_point=None):
        '''

            start_point: task ID or commit SHA.
        '''
        self.actor = actor
        self.task_id = task_id
        self.default_id = default_id

        # Prepare a clone directory.
        origin = Repo(origin_dirname)
        user_dirname = _calculate_dirname(self.actor, origin)
        clone_dirname = join(realpath(working_dirname), user_dirname)

        self._lock(clone_dirname)

        if isdir(clone_dirname):
            self.repo = Repo(clone_dirname)
            self.repo.git.checkout('zelig')
            self.repo.git.reset('origin/master', hard=True)
        else:
            # Clone origin to local checkout.
            self.repo = origin.clone(clone_dirname)
            self.repo.git.checkout('zelig', orphan=True)
            self.repo.git.reset('origin/master', hard=True)

        # Fetch all branches from origin.
        self.repo.git.fetch('origin')

        # Determine if a start-point was passed or needs to be inferred.
        if start_point is None:
            start_point = task_id
            self._writeable = False

        # Figure out what start_point is.
        if 'origin/{}'.format(start_point) in self.repo.refs:
            branch = self.repo.refs['origin/{}'.format(start_point)]
            self.commit_sha = branch.commit.hexsha
        else:
            self.commit_sha = start_point

        # Point local zelig to start_point.
        self.repo.git.reset(self.commit_sha, hard=True)
开发者ID:cdvillard,项目名称:chime,代码行数:45,代码来源:user_task.py

示例11: test_init_repo_object

# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import clone [as 别名]
    def test_init_repo_object(self, rw_dir):
        # [1-test_init_repo_object]
        from git import Repo
        join = os.path.join

        # rorepo is a a Repo instance pointing to the git-python repository.
        # For all you know, the first argument to Repo is a path to the repository
        # you want to work with
        repo = Repo(self.rorepo.working_tree_dir)
        assert not repo.bare
        # ![1-test_init_repo_object]

        # [2-test_init_repo_object]
        bare_repo = Repo.init(join(rw_dir, 'bare-repo'), bare=True)
        assert bare_repo.bare
        # ![2-test_init_repo_object]

        # [3-test_init_repo_object]
        repo.config_reader()             # get a config reader for read-only access
        cw = repo.config_writer()        # get a config writer to change configuration
        cw.release()                     # call release() to be sure changes are written and locks are released
        # ![3-test_init_repo_object]

        # [4-test_init_repo_object]
        assert not bare_repo.is_dirty()  # check the dirty state
        repo.untracked_files             # retrieve a list of untracked files
        # ['my_untracked_file']
        # ![4-test_init_repo_object]

        # [5-test_init_repo_object]
        cloned_repo = repo.clone(join(rw_dir, 'to/this/path'))
        assert cloned_repo.__class__ is Repo     # clone an existing repository
        assert Repo.init(join(rw_dir, 'path/for/new/repo')).__class__ is Repo
        # ![5-test_init_repo_object]

        # [6-test_init_repo_object]
        repo.archive(open(join(rw_dir, 'repo.tar'), 'wb'))
        # ![6-test_init_repo_object]

        # repository paths
        # [7-test_init_repo_object]
        assert os.path.isdir(cloned_repo.working_tree_dir)                    # directory with your work files
        assert cloned_repo.git_dir.startswith(cloned_repo.working_tree_dir)   # directory containing the git repository
        assert bare_repo.working_tree_dir is None                             # bare repositories have no working tree
        # ![7-test_init_repo_object]

        # heads, tags and references
        # heads are branches in git-speak
        # [8-test_init_repo_object]
        assert repo.head.ref == repo.heads.master                   # head is a symbolic reference pointing to master
        assert repo.tags['0.3.5'] == repo.tag('refs/tags/0.3.5')    # you can access tags in various ways too
        assert repo.refs.master == repo.heads['master']             # .refs provides access to all refs, i.e. heads ...
        assert repo.refs['origin/master'] == repo.remotes.origin.refs.master  # ... remotes ...
        assert repo.refs['0.3.5'] == repo.tags['0.3.5']             # ... and tags
        # ![8-test_init_repo_object]

        # create a new head/branch
        # [9-test_init_repo_object]
        new_branch = cloned_repo.create_head('feature')               # create a new branch ...
        assert cloned_repo.active_branch != new_branch                # which wasn't checked out yet ...
        assert new_branch.commit == cloned_repo.active_branch.commit  # and which points to the checked-out commit
        # It's easy to let a branch point to the previous commit, without affecting anything else
        # Each reference provides access to the git object it points to, usually commits
        assert new_branch.set_commit('HEAD~1').commit == cloned_repo.active_branch.commit.parents[0]
        # ![9-test_init_repo_object]

        # create a new tag reference
        # [10-test_init_repo_object]
        past = cloned_repo.create_tag('past', ref=new_branch,
                                      message="This is a tag-object pointing to %s" % new_branch.name)
        assert past.commit == new_branch.commit        # the tag points to the specified commit
        assert past.tag.message.startswith("This is")  # and its object carries the message provided

        now = cloned_repo.create_tag('now')            # This is a tag-reference. It may not carry meta-data
        assert now.tag is None
        # ![10-test_init_repo_object]

        # Object handling
        # [11-test_init_repo_object]
        assert now.commit.message != past.commit.message
        # You can read objects directly through binary streams, no working tree required
        assert (now.commit.tree / 'VERSION').data_stream.read().decode('ascii').startswith('0')

        # You can traverse trees as well to handle all contained files of a particular commit
        file_count = 0
        tree_count = 0
        tree = past.commit.tree
        for item in tree.traverse():
            file_count += item.type == 'blob'
            tree_count += item.type == 'tree'
        assert file_count and tree_count                        # we have accumulated all directories and files
        assert len(tree.blobs) + len(tree.trees) == len(tree)   # a tree is iterable itself to traverse its children
        # ![11-test_init_repo_object]

        # remotes allow handling push, pull and fetch operations
        # [12-test_init_repo_object]
        from git import RemoteProgress

        class MyProgressPrinter(RemoteProgress):
            def update(self, op_code, cur_count, max_count=None, message=''):
#.........这里部分代码省略.........
开发者ID:dbaxa,项目名称:GitPython,代码行数:103,代码来源:test_docs.py

示例12: initialize_release

# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import clone [as 别名]
def initialize_release(version, path, top_level):
    """
    Clone the Flocker repo and install a new virtual environment for
    a release.

    :param bytes version: The version to release.
    :param FilePath path: The path in which the release branch
        will be created.
    :param FilePath top_level: The top-level of the flocker repository.

    """
    REMOTE_URL = "https://github.com/ClusterHQ/flocker"
    release_path = path.child("flocker-release-{}".format(version))
    sys.stdout.write("Cloning repo in {}...\n".format(release_path.path))

    release_repo = Repo.clone(
        release_path.path,
        reference=top_level.path,
        dissociate=True,
    )
    release_origin = release_repo.create_remote('origin', REMOTE_URL)
    release_origin.fetch()

    sys.stdout.write("Checking out master...\n")
    release_repo.git.checkout("master")

    sys.stdout.write("Updating repo...\n")
    release_repo.git.pull("origin", "master")

    sys.stdout.write(
        "Creating release branch for version {}...\n".format(version))
    release_repo.active_branch.checkout(b="release/flocker-{}".format(version))

    sys.stdout.write("Creating virtual environment...\n")
    virtualenv.create_environment(
        release_path.child("flocker-{}".format(version)).path,
        site_packages=False
    )

    sys.stdout.write("Activating virtual environment...\n")
    virtualenv_file = release_path.child("flocker-{}".format(version))
    virtualenv_file = virtualenv_file.child("bin").child("activate_this.py")
    execfile(virtualenv_file.path, dict(__file__=virtualenv_file.path))

    sys.stdout.write("Installing dependencies...\n")
    os.chdir(release_path.path)
    if _platform == "darwin":
        brew_openssl = check_output(["brew", "--prefix", "openssl"])
        os.environ["LDFLAGS"] = '-L{}/lib" CFLAGS="-I{}/include'.format(
            brew_openssl, brew_openssl)
    check_call(
        ["pip install -e .[dev]"], shell=True,
        stdout=open(os.devnull, 'w'))

    sys.stdout.write("Updating LICENSE file...\n")
    update_license_file(list(), top_level)

    sys.stdout.write("Committing result (no push)...\n")
    try:
        release_repo.git.commit(
            a=True, m="'Updated copyright in LICENSE file'"
        )
    except GitCommandError:
        # This will happen when the LICENSE file has not changed, so we'll
        # ignore the error.
        pass

    sys.stdout.write(
        "\nCompleted.\n\nPlease copy and paste the following commands "
        "in your shell to enter the release environment and continue "
        "the pre-tag release process:\n\n"
        "export VERSION={};\ncd {};\nsource flocker-{}/bin/activate;\n\n"
        .format(version, release_path.path, version)
    )
开发者ID:james-w,项目名称:flocker,代码行数:76,代码来源:release.py

示例13: Repo

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

try:
    repo = Repo("btcnet_info")
except:
    repo = Repo.init("btcnet_info")
    repo = repo.clone("git://github.com/c00w/btcnet_info.git")
    origin = repo.create_remote('origin', 'git://github.com/c00w/btcnet_info.git')
    
origin = repo.remotes.origin
origin.fetch()
origin.pull('master')

import btcnet_info
开发者ID:amrando,项目名称:bitHopper,代码行数:16,代码来源:btcnet_wrapper.py

示例14: GitHandler

# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import clone [as 别名]
class GitHandler(object):
    """Handles interactions with a Git repo.

    It should handle the following steps:
    started - Post constructor setup, this is largely to delegate to the ProcessHandler
    clone_repo - clone the repository at repo_url into the local_path/repo directory
    retrieve_files - pull the changes files from commit a and any corresponding files from commit b, storing them in path a and path b respectively
    """

    def __init__(self,
                 process_handler: ProcessHandler,
                 repo_url: str,
                 sha1_a: str,
                 sha1_b: str,
                 local_path: Optional[str] = None):
        """
        :param process_handler: The ProcessHandler to delegate to for IO handling
        :param repo_url: The URL of the repository to clone
        :param sha1_a: The sha1 in hex format of the commit to compare with
        :param sha1_b: The sha1 in hex format of the commit to compare against
        :param local_path: The local path to store the cloned repository and the files pulled from the commits
        :return:
        """

        self.process_handler = process_handler  # type: ProcessHandler
        self.repo_url = repo_url
        self.remote = urlparse(repo_url).scheme != ""  # type: bool
        self.uuid = process_handler.uuid
        self.sha1_a = sha1_a  # type: str
        self.sha1_b = sha1_b  # type: str
        self.commit_a = None  # type: Optional[Commit]
        self.commit_b = None  # type: Optional[Commit]
        self.repo = None  # type: Optional[Repo]
        self.files = []  # type: List[str]
        self.local_path = local_path if local_path else tempfile.mkdtemp()  # type: str
        return

    def __del__(self):
        shutil.rmtree(self.local_path)

    @property
    def a_path(self):
        """The directory where files from commit a will be stored.

        :return:
        """

        return os.path.join(self.local_path, 'a')

    @property
    def b_path(self):
        """The directory where files from commit b will be stored.

        :return:
        """

        return os.path.join(self.local_path, 'b')

    @property
    def cloned_repo_path(self):
        """The directory where the cloned repo will be stored.

        :return:
        """

        return os.path.join(self.local_path, 'repo')

    def started(self):
        """Stub function to handle notification of delegates.

        This is a stub function. It should be called after object creation so
        that any actual setup can be done and it allows the process handler to
        notify its delegates that the process has started.

        :return:
        """

        self.process_handler.started()
        return

    def clone_repo(self):
        """Clones a git repo and locates the last merge and previous commit.

        It will clone the repo into the local_path/repo.

        :return:
        """

        self.process_handler.clone_repo(self.local_path, self.cloned_repo_path, self.a_path, self.b_path)

        if self.remote:
            self.repo = Repo.clone_from(url=self.repo_url, to_path=self.cloned_repo_path)
        else:
            self.repo = Repo(path=self.repo_url)
            self.repo.clone(path=self.cloned_repo_path)

        self.commit_a = self.repo.commit(self.sha1_a)
        self.commit_b = self.repo.commit(self.sha1_b)
        return

#.........这里部分代码省略.........
开发者ID:mkirby111,项目名称:lintable,代码行数:103,代码来源:git_handler.py

示例15: Project

# 需要导入模块: from git import Repo [as 别名]
# 或者: from git.Repo import clone [as 别名]
class Project(object):
    def __init__(self, config, projectId):
        self.__repoPath = os.path.join(config.GIT_REPO_DIRECTORY, projectId)
        self.repo = Repo(self.__repoPath )
        self.projectId = projectId
 
    def getFields(self):
        projectInfoBlob = self.__getProjectInfoBlob()
        if projectInfoBlob == None:
            raise Exception("No projectinfo file in repo")
    
        #jsonString = binascii.b2a_qp(projectInfoBlob.data_stream.read())
        jsonString = projectInfoBlob.data_stream.read().decode('utf-8')

        obj = json.loads(jsonString)
        return {"lastAccess": self.repo.head.commit.committed_date,
                "projectName": obj["projectName"],
                "projectId": self.projectId}
                       
    def __getProjectInfoBlob(self):
        for blob in self.repo.tree().blobs:
            if blob.name == ".projectinfo.json":
                return blob
                
        return None
                
    def getFiles(self):
        pass
        
    def getNotes(self):
        try:
            notes = []
            noteTree = self.repo.tree().join("notes")
            for blob in noteTree.blobs:
                notes.append(Note(blob))
            
            return notes
        except KeyError:
            return []
            
        
    def putFile(self, path, contents, binary=True):
        localRepo = self.checkout()
        fullPath = os.path.join(localRepo.working_dir, path)
        fullFolder = os.path.dirname(fullPath)
        
        if not os.path.exists(fullFolder):
            os.makedirs(fullFolder)
        
        if binary:
            with open(fullPath, "w") as outfile:
                outfile.write(contents)
        else:
            with codecs.open(fullPath, "w", "utf-8") as outfile:
                outfile.write(contents)
            
        localRepo.index.add([fullPath])
        localRepo.index.commit("Updated " + os.path.basename(path))
        
        self.checkin(localRepo)
        
    def putNote(self, path, contents):
        self.putFile(os.path.join("notes", path), contents, False)
 
    def checkout(self):
        tmpPath = tempfile.mkdtemp()
        return self.repo.clone(tmpPath)

    def checkin(self, cloned_repo):
        #cloned_repo.remotes.origin.pull()
        cloned_repo.remotes.origin.push()
        
        
    

            
        

        
        
开发者ID:nojan1,项目名称:project-portal,代码行数:73,代码来源:project.py


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