Esempio n. 1
0
    def stash_save(self):
        """Saves the worktree in a stash

        This prompts the user for a stash name and creates
        a git stash named accordingly.
        """
        stash_name, ok = qtutils.prompt('Save Stash',
                                        'Enter a name for the stash')
        if not ok or not stash_name:
            return

        # Sanitize the stash name
        stash_name = utils.sanitize(stash_name)

        if stash_name in self.model.stash_names:
            qtutils.critical('Oops!',
                             'A stash named "%s" already exists' % stash_name)
            return

        args = []
        if self.view.keep_index.isChecked():
            args.append('--keep-index')
        args.append(stash_name)

        qtutils.log(*self.model.git.stash('save',
                                          with_stderr=True,
                                          with_status=True,
                                          *args))
        self.view.accept()
        cola.notifier().broadcast(signals.rescan)
Esempio n. 2
0
    def stash_save(self):
        """Saves the worktree in a stash

        This prompts the user for a stash name and creates
        a git stash named accordingly.

        """
        stash_name, ok = qtutils.prompt("Save Stash", "Enter a name for the stash")
        if not ok or not stash_name:
            return
        # Sanitize the stash name
        stash_name = utils.sanitize(stash_name)
        if stash_name in self.names:
            qtutils.critical("Oops!", 'A stash named "%s" already exists' % stash_name)
            return

        keep_index = self.keep_index.isChecked()
        self.emit(SIGNAL(save_stash), stash_name, keep_index)
        self.accept()
        self.emit(SIGNAL(rescan))
Esempio n. 3
0
    def stash_save(self):
        """Saves the worktree in a stash

        This prompts the user for a stash name and creates
        a git stash named accordingly.

        """
        stash_name, ok = qtutils.prompt(N_('Save Stash'),
                                        N_('Enter a name for the stash'))
        if not ok or not stash_name:
            return
        # Sanitize the stash name
        stash_name = utils.sanitize(stash_name)
        if stash_name in self.names:
            qtutils.critical(N_('Error: Stash exists'),
                             N_('A stash named "%s" already exists') % stash_name)
            return

        keep_index = self.keep_index.isChecked()
        cmds.do(SaveStash, stash_name, keep_index)
        self.accept()
        cmds.do(cmds.Rescan)
Esempio n. 4
0
    def stash_save(self):
        """Saves the worktree in a stash

        This prompts the user for a stash name and creates
        a git stash named accordingly.
        """
        if not qtutils.question(self.view,
                                'Stash Changes?',
                                'This will stash your current '
                                'changes away for later use.\n'
                                'Continue?'):
            return

        stash_name, ok = qtutils.prompt('Enter a name for this stash')
        if not ok:
            return
        while stash_name in self.model.stash_list:
            qtutils.information('Oops!',
                                'That name already exists.  '
                                'Please enter another name.')
            stash_name, ok = qtutils.prompt('Enter a name for this stash')
            if not ok:
                return

        if not stash_name:
            return

        # Sanitize the stash name
        stash_name = utils.sanitize(stash_name)
        args = []
        if self.model.keep_index:
            args.append('--keep-index')
        args.append(stash_name)

        qtutils.log(*self.model.git.stash('save',
                                          with_stderr=True,
                                          with_status=True,
                                          *args))
        self.view.accept()
Esempio n. 5
0
    def stash_save(self):
        """Saves the worktree in a stash

        This prompts the user for a stash name and creates
        a git stash named accordingly.

        """
        stash_name, ok = qtutils.prompt('Save Stash',
                                        'Enter a name for the stash')
        if not ok or not stash_name:
            return
        # Sanitize the stash name
        stash_name = utils.sanitize(stash_name)
        if stash_name in self.names:
            qtutils.critical('Oops!',
                             'A stash named "%s" already exists' % stash_name)
            return

        keep_index = self.keep_index.isChecked()
        cmds.do(SaveStash, stash_name, keep_index)
        self.accept()
        cmds.do(cmds.Rescan)