Beispiel #1
0
    def do(self):
        # Create the commit message file
        msg = self.strip_comments(self.msg)
        tmpfile = utils.tmp_filename('commit-message')
        try:
            core.write(tmpfile, msg)

            # Run 'git commit'
            status, out, err = self.model.git.commit(F=tmpfile,
                                                     v=True,
                                                     gpg_sign=self.sign,
                                                     amend=self.amend,
                                                     no_verify=self.no_verify)
        finally:
            core.unlink(tmpfile)

        if status == 0:
            ResetMode.do(self)
            self.model.set_commitmsg(self.new_commitmsg)
            msg = N_('Created commit: %s') % out
        else:
            msg = N_('Commit failed: %s') % out
        Interaction.log_status(status, msg, err)

        return status, out, err
Beispiel #2
0
    def do(self):
        # Create the commit message file
        msg = self.strip_comments(self.msg)
        tmpfile = utils.tmp_filename('commit-message')
        try:
            core.write(tmpfile, msg)

            # Run 'git commit'
            status, out, err = self.model.git.commit(F=tmpfile,
                                                     v=True,
                                                     gpg_sign=self.sign,
                                                     amend=self.amend,
                                                     no_verify=self.no_verify)
        finally:
            core.unlink(tmpfile)

        if status == 0:
            ResetMode.do(self)
            self.model.set_commitmsg(self.new_commitmsg)
            msg = N_('Created commit: %s') % out
        else:
            msg = N_('Commit failed: %s') % out
        Interaction.log_status(status, msg, err)

        return status, out, err
Beispiel #3
0
def abort_merge():
    """Abort a merge by reading the tree at HEAD."""
    # Reset the worktree
    git.read_tree('HEAD', reset=True, u=True, v=True)
    # remove MERGE_HEAD
    merge_head = git.git_path('MERGE_HEAD')
    if core.exists(merge_head):
        core.unlink(merge_head)
    # remove MERGE_MESSAGE, etc.
    merge_msg_path = merge_message_path()
    while merge_msg_path:
        core.unlink(merge_msg_path)
        merge_msg_path = merge_message_path()
Beispiel #4
0
def abort_merge():
    """Abort a merge by reading the tree at HEAD."""
    # Reset the worktree
    git.read_tree("HEAD", reset=True, u=True, v=True)
    # remove MERGE_HEAD
    merge_head = git.git_path("MERGE_HEAD")
    if core.exists(merge_head):
        core.unlink(merge_head)
    # remove MERGE_MESSAGE, etc.
    merge_msg_path = merge_message_path()
    while merge_msg_path:
        core.unlink(merge_msg_path)
        merge_msg_path = merge_message_path()
Beispiel #5
0
    def commit_with_msg(self, msg, tmpfile, amend=False):
        """Creates a git commit."""

        if not msg.endswith('\n'):
            msg += '\n'

        # Create the commit message file
        core.write(tmpfile, msg)

        # Run 'git commit'
        status, out, err = self.git.commit(F=tmpfile, v=True, amend=amend)
        core.unlink(tmpfile)
        return (status, out, err)
Beispiel #6
0
    def commit_with_msg(self, msg, tmpfile, amend=False):
        """Creates a git commit."""

        if not msg.endswith('\n'):
            msg += '\n'

        # Create the commit message file
        core.write(tmpfile, msg)

        # Run 'git commit'
        status, out, err = self.git.commit(F=tmpfile, v=True, amend=amend)
        core.unlink(tmpfile)
        return (status, out, err)