예제 #1
0
파일: git.py 프로젝트: crazyscot/muddle
    def _shallow_not_allowed(self, options):
        """Checks to see if the current checkout is shallow, and refuses if so.

        Must only be called from the checkout directory.
        """
        if options.get('shallow_checkout'):
            if os.path.exists('.git/shallow'):
                raise utils.Unsupported('Shallow checkouts cannot push to'
                                        ' their upstream repositories.')
예제 #2
0
    def goto_branch(self, branch, verbose=False):
        """
        Make the named branch the current branch.

        Will be called in the actual checkout's directory.

        Raises Unsupported if the VCS does not support this operation.

        Raises GiveUp if there is no existing branch of that name.
        """
        raise utils.Unsupported("VCS '%s' cannot goto a different branch"
                                " of a checkout" % self.long_name)
예제 #3
0
    def create_branch(self, branch, verbose=False):
        """
        Create a (new) branch of the given name.

        Will be called in the actual checkout's directory.

        Raises Unsupported if the VCS does not support this operation.

        Raises GiveUp if a branch of that name already exists.
        """
        raise utils.Unsupported("VCS '%s' cannot create a new current branch"
                                " of a checkout" % self.long_name)
예제 #4
0
    def branch_exists(self, branch):
        """
        Returns True if a branch of that name exists.

        This allowed to be conservative - e.g., in git the existence of a
        remote branch with the given name can be counted as True.

        Will be called in the actual checkout's directory.

        Raises Unsupported if the VCS does not support this operation.
        """
        raise utils.Unsupported("VCS '%s' cannot goto a different branch"
                                " of a checkout" % self.long_name)
예제 #5
0
    def get_current_branch(self):
        """
        Return the name of the current branch.

        Will be called in the actual checkout's directory.

        Returns the name of the branch, or None if there is no current branch.
        Note that the master branch is thus returned as "master", *not* as None.

        Raises Unsupported if the VCS does not support this operation.
        """
        raise utils.Unsupported("VCS '%s' cannot determine the current branch"
                                " of a checkout" % self.long_name)
예제 #6
0
    def goto_revision(self, revision, branch=None, repo=None, verbose=False):
        """
        Make the specified revision current.

        Note that this may leave the working data (the actual checkout
        directory) in an odd state, in which it is not sensible to
        commit, depending on the VCS and the revision.

        Will be called in the actual checkout's directory.

        If the VCS supports it, may also take a branch name.

        Raises Unsupported if the VCS does not support this operation.

        Raises GiveUp if there is no such revision.
        """
        raise utils.Unsupported("VCS '%s' cannot goto a different revision"
                                " of a checkout" % self.long_name)