Beispiel #1
0
 def run(self):
     working_dir = git_root(self.get_working_dir())
     config_file = os.path.join(working_dir, '.git/config')
     if os.path.exists(config_file):
         self.window.open_file(config_file)
     else:
         sublime.status_message("No config found")
Beispiel #2
0
 def run(self):
     working_dir = git_root(self.get_working_dir())
     config_file = os.path.join(working_dir, '.git/config')
     if os.path.exists(config_file):
         self.window.open_file(config_file)
     else:
         sublime.status_message("No config found")
Beispiel #3
0
    def panel_followup(self, picked_status, picked_file, picked_index):
        # split out solely so I can override it for laughs

        s = sublime.load_settings("Git.sublime-settings")
        root = git_root(self.get_working_dir())
        if picked_status == '??' or s.get('status_opens_file') or self.force_open:
            if(os.path.isfile(os.path.join(root, picked_file))):
                self.window.open_file(os.path.join(root, picked_file))
        else:
            self.run_command(['git', 'diff', '--no-color', '--', picked_file.strip('"')],
                self.diff_done, working_dir=root)
 def run(self, view):
     # If the annotations are already running, we dont have to create a new
     # tmpfile
     if hasattr(self, "tmp"):
         self.compare_tmp(None)
         return
     self.tmp = tempfile.NamedTemporaryFile()
     self.active_view().settings().set('live_git_annotations', True)
     root = git_root(self.get_working_dir())
     repo_file = os.path.relpath(self.view.file_name(), root)
     self.run_command(['git', 'show', 'HEAD:{0}'.format(repo_file)], show_status=False, no_save=True, callback=self.compare_tmp, stdout=self.tmp)
Beispiel #5
0
 def run(self, view):
     # If the annotations are already running, we dont have to create a new
     # tmpfile
     if hasattr(self, "tmp"):
         self.compare_tmp(None)
         return
     self.tmp = tempfile.NamedTemporaryFile()
     self.active_view().settings().set('live_git_annotations', True)
     root = git_root(self.get_working_dir())
     repo_file = os.path.relpath(self.view.file_name(), root)
     self.run_command(['git', 'show', 'HEAD:{0}'.format(repo_file)],
                      show_status=False,
                      no_save=True,
                      callback=self.compare_tmp,
                      stdout=self.tmp)
Beispiel #6
0
    def diff_done(self, result):
        if not result.strip():
            self.panel("No output")
            return
        s = sublime.load_settings("Git.sublime-settings")
        if s.get('diff_panel'):
            view = self.panel(result)
        else:
            view = self.scratch(result, title="Git Diff")

        view.set_syntax_file('Packages/Git/word-diff.tmLanguage')        

        # Store the git root directory in the view so we can resolve relative paths
        # when the user wants to navigate to the source file.
        view.settings().set("git_root_dir", git_root(self.get_working_dir()))
Beispiel #7
0
    def panel_followup(self, picked_status, picked_file, picked_index):
        working_dir = git_root(self.get_working_dir())

        if picked_index == 0:
            command = ['git', 'add', '--update']
        elif picked_index == 1:
            command = ['git', 'add', '--all']
        else:
            command = ['git']
            picked_file = picked_file.strip('"')
            if os.path.isfile(working_dir + "/" + picked_file):
                command += ['add']
            else:
                command += ['rm']
            command += ['--', picked_file]

        self.run_command(command, self.rerun, working_dir=working_dir)
Beispiel #8
0
    def panel_followup(self, picked_status, picked_file, picked_index):
        working_dir = git_root(self.get_working_dir())

        if picked_index == 0:
            command = ['git', 'add', '--update']
        elif picked_index == 1:
            command = ['git', 'add', '--all']
        else:
            command = ['git']
            picked_file = picked_file.strip('"')
            if os.path.isfile(working_dir + "/" + picked_file):
                command += ['add']
            else:
                command += ['rm']
            command += ['--', picked_file]

        self.run_command(command, self.rerun,
            working_dir=working_dir)
Beispiel #9
0
    def diff_done(self, result):
        if not result.strip():
            self.panel("No output")
            return
        s = sublime.load_settings("Git.sublime-settings")
        if s.get('diff_panel'):
            view = self.panel(result)
        else:
            view = self.scratch(result, title="Git Diff")

        lines_inserted = view.find_all(r'^\+[^+]{2} ')
        lines_deleted = view.find_all(r'^-[^-]{2} ')

        view.add_regions("inserted", lines_inserted, "markup.inserted.diff", "dot", sublime.HIDDEN)
        view.add_regions("deleted", lines_deleted, "markup.deleted.diff", "dot", sublime.HIDDEN)

        # Store the git root directory in the view so we can resolve relative paths
        # when the user wants to navigate to the source file.
        view.settings().set("git_root_dir", git_root(self.get_working_dir()))