Example #1
0
 def remote(self, name='origin'):
     """:return: Remote with the specified name
     :raise ValueError:  if no remote with such a name exists"""
     r = Remote(self, name)
     if not r.exists():
         raise ValueError("Remote named '%s' didn't exist" % name)
     return r
Example #2
0
 def remote(self, name='origin'):
     """:return: Remote with the specified name
     :raise ValueError:  if no remote with such a name exists"""
     r = Remote(self, name)
     if not r.exists():
         raise ValueError("Remote named '%s' didn't exist" % name)
     return r
Example #3
0
 def fetch_repo(self, url, branch):
     if os.path.exists(".git"):
         gc.collect()
         repo = git.Repo(getcwd())
         repo.git.clear_cache()
         rmtree(repo.git_dir)
     self.repo = git.Repo.init(getcwd())
     r = Remote(self.repo, name="origin")
     if r in Remote.list_items(self.repo):
         self.repo.delete_remote(r)
     self.repo.git.remote("add", "origin", url)
     self.repo.git.fetch("origin", "-t")
     remote_branch = self.check_remote_branch()
     if not remote_branch:
         print("Fetch tag failed, just fetch all the source code")
         self.repo.git.fetch("origin")
         remote_branch = self.check_remote_branch()
         if not remote_branch:
             print("No branch found in the remote repo, patch failed")
             shutil.rmtree(".git")
             return False
     self.repo.git.checkout(remote_branch, "--force", b="master")
     print(
         "Branch 'master' set up to track remote branch '{}' from 'origin'".
         format(remote_branch))
     self.check_commit()
     self.repo.git.checkout(self.commit, "--force", b=branch)
     print("Switched to a new branch '{}'".format(branch))
Example #4
0
    def create_remote(self, name, url, **kwargs):
        """Create a new remote.

        For more information, please see the documentation of the Remote.create
        methods

        :return: Remote reference"""
        return Remote.create(self, name, url, **kwargs)
Example #5
0
    def create_remote(self, name, url, **kwargs):
        """Create a new remote.

        For more information, please see the documentation of the Remote.create
        methods

        :return: Remote reference"""
        return Remote.create(self, name, url, **kwargs)
Example #6
0
 def delete_remote(self, remote):
     """Delete the given remote."""
     return Remote.remove(self, remote)
Example #7
0
 def remotes(self):
     """A list of Remote objects allowing to access and manipulate remotes
     :return: ``git.IterableList(Remote, ...)``"""
     return Remote.list_items(self)
Example #8
0
 def delete_remote(self, remote):
     """Delete the given remote."""
     return Remote.remove(self, remote)
Example #9
0
 def remotes(self):
     """A list of Remote objects allowing to access and manipulate remotes
     :return: ``git.IterableList(Remote, ...)``"""
     return Remote.list_items(self)
Example #10
0
    def remote(self, name='origin'):
        """:return: Remote with the specified name
		:raise ValueError:  if no remote with such a name exists"""
        return Remote(self, name)
 def delete_remote(self, remote: 'Remote') -> str:
     """Delete the given remote."""
     return Remote.remove(self, remote)