예제 #1
0
파일: cmds.py 프로젝트: achernet/git-cola
    def do(self):
        if not self.filenames:
            return
        filename = self.filenames[0]
        if not core.exists(filename):
            return
        editor = prefs.editor()
        opts = []

        if self.line_number is None:
            opts = self.filenames
        else:
            # Single-file w/ line-numbers (likely from grep)
            editor_opts = {
                    '*vim*': ['+'+self.line_number, filename],
                    '*emacs*': ['+'+self.line_number, filename],
                    '*textpad*': ['%s(%s,0)' % (filename, self.line_number)],
                    '*notepad++*': ['-n'+self.line_number, filename],
            }

            opts = self.filenames
            for pattern, opt in editor_opts.items():
                if fnmatch(editor, pattern):
                    opts = opt
                    break

        try:
            core.fork(utils.shell_split(editor) + opts)
        except Exception as e:
            message = (N_('Cannot exec "%s": please configure your editor') %
                       editor)
            Interaction.critical(N_('Error Editing File'),
                                 message, str(e))
예제 #2
0
파일: cmds.py 프로젝트: ab0de/git-cola
    def do(self):
        if not self.filenames:
            return
        filename = self.filenames[0]
        if not core.exists(filename):
            return
        editor = prefs.editor()
        opts = []

        if self.line_number is None:
            opts = self.filenames
        else:
            # Single-file w/ line-numbers (likely from grep)
            editor_opts = {
                "*vim*": ["+" + self.line_number, filename],
                "*emacs*": ["+" + self.line_number, filename],
                "*textpad*": ["%s(%s,0)" % (filename, self.line_number)],
                "*notepad++*": ["-n" + self.line_number, filename],
            }

            opts = self.filenames
            for pattern, opt in editor_opts.items():
                if fnmatch(editor, pattern):
                    opts = opt
                    break

        try:
            core.fork(utils.shell_split(editor) + opts)
        except Exception as e:
            message = N_('Cannot exec "%s": please configure your editor') % editor
            details = core.decode(e.strerror)
            Interaction.critical(N_("Error Editing File"), message, details)
예제 #3
0
    def do(self):
        if not self.filenames:
            return
        filename = self.filenames[0]
        if not core.exists(filename):
            return
        editor = prefs.editor()
        opts = []

        if self.line_number is None:
            opts = self.filenames
        else:
            # Single-file w/ line-numbers (likely from grep)
            editor_opts = {
                    '*vim*': ['+'+self.line_number, filename],
                    '*emacs*': ['+'+self.line_number, filename],
                    '*textpad*': ['%s(%s,0)' % (filename, self.line_number)],
                    '*notepad++*': ['-n'+self.line_number, filename],
            }

            opts = self.filenames
            for pattern, opt in editor_opts.items():
                if fnmatch(editor, pattern):
                    opts = opt
                    break

        try:
            core.fork(utils.shell_split(editor) + opts)
        except Exception as e:
            message = (N_('Cannot exec "%s": please configure your editor')
                       % editor)
            details = core.decode(e.strerror)
            Interaction.critical(N_('Error Editing File'), message, details)
예제 #4
0
파일: cmds.py 프로젝트: Plenoge/git-cola
    def do(self):
        status = 1
        out = ''
        err = ''
        args, kwargs = self.prepare_arguments()
        upstream_title = self.upstream or '@{upstream}'
        with GitXBaseContext(
                GIT_EDITOR=prefs.editor(),
                GIT_XBASE_TITLE=N_('Rebase onto %s') % upstream_title,
                GIT_XBASE_ACTION=N_('Rebase')):
            status, out, err = self.model.git.rebase(*args, **kwargs)

        Interaction.log_status(status, out, err)
        self.model.update_status()
        return status, out, err
예제 #5
0
    def do(self):
        status = 1
        out = ''
        err = ''
        args, kwargs = self.prepare_arguments()
        upstream_title = self.upstream or '@{upstream}'
        with GitXBaseContext(GIT_EDITOR=prefs.editor(),
                             GIT_XBASE_TITLE=N_('Rebase onto %s') %
                             upstream_title,
                             GIT_XBASE_ACTION=N_('Rebase')):
            status, out, err = self.model.git.rebase(*args, **kwargs)

        Interaction.log_status(status, out, err)
        self.model.update_status()
        return status, out, err
예제 #6
0
파일: cmds.py 프로젝트: lucianosb/git-cola
 def do(self):
     branch = self.branch
     if not branch:
         return
     status = 1
     out = ''
     err = ''
     with GitXBaseContext(GIT_EDITOR=prefs.editor(),
                          GIT_XBASE_TITLE=N_('Rebase onto %s') % branch,
                          GIT_XBASE_ACTION=N_('Rebase')):
         status, out, err = self.model.git.rebase(branch,
                                                  interactive=True,
                                                  autosquash=True)
     Interaction.log_status(status, out, err)
     self.model.update_status()
     return status, out, err
예제 #7
0
파일: cmds.py 프로젝트: etsrepo/git-cola
 def do(self):
     branch = self.branch
     if not branch:
         return
     status = 1
     out = ''
     err = ''
     with GitXBaseContext(
             GIT_EDITOR=prefs.editor(),
             GIT_XBASE_TITLE=N_('Rebase onto %s') % branch,
             GIT_XBASE_ACTION=N_('Rebase')):
         status, out, err = self.model.git.rebase(branch,
                                                  interactive=True,
                                                  autosquash=True)
     Interaction.log_status(status, out, err)
     self.model.update_status()
     return status, out, err
예제 #8
0
 def do(self):
     branch = self.branch
     if not branch:
         return
     status = 1
     out = ''
     err = ''
     extra = {}
     if self.capture_output:
         extra['_stderr'] = None
         extra['_stdout'] = None
     with GitXBaseContext(GIT_EDITOR=prefs.editor(),
                          GIT_XBASE_TITLE=N_('Rebase onto %s') % branch,
                          GIT_XBASE_ACTION=N_('Rebase')):
         status, out, err = self.model.git.rebase(branch,
                                                  interactive=True,
                                                  autosquash=True,
                                                  **extra)
     Interaction.log_status(status, out, err)
     self.model.update_status()
     return status, out, err
예제 #9
0
파일: cmds.py 프로젝트: achernet/git-cola
 def do(self):
     branch = self.branch
     if not branch:
         return
     status = 1
     out = ''
     err = ''
     extra = {}
     if self.capture_output:
         extra['_stderr'] = None
         extra['_stdout'] = None
     with GitXBaseContext(
             GIT_EDITOR=prefs.editor(),
             GIT_XBASE_TITLE=N_('Rebase onto %s') % branch,
             GIT_XBASE_ACTION=N_('Rebase')):
         status, out, err = self.model.git.rebase(branch,
                                                  interactive=True,
                                                  autosquash=True,
                                                  **extra)
     Interaction.log_status(status, out, err)
     self.model.update_status()
     return status, out, err
예제 #10
0
 def __init__(self, **kwargs):
     self.env = {'GIT_EDITOR': prefs.editor()}
     self.env.update(kwargs)
예제 #11
0
파일: cmds.py 프로젝트: transmixer/git-cola
 def __init__(self, **kwargs):
     self.env = {'GIT_EDITOR': prefs.editor()}
     self.env.update(kwargs)