예제 #1
0
 def on_branch_name(branch_name):
     if branch_name:
         settings.set_compare_against(
             self.git_handler.git_dir,
             'origin/%s' % branch_name.decode("utf-8").strip())
         self.git_handler.clear_git_time()
         self.view.run_command('git_gutter')  # refresh ui
예제 #2
0
 def _on_select(self, results, selected):
     if 0 > selected < len(results):
         return
     item = results[selected]
     commit = self.item_to_commit(item)
     settings.set_compare_against(commit)
     self.git_handler.clear_git_time()
     self.view.run_command('git_gutter')  # refresh ui
예제 #3
0
    def set_compare_against(self, compare_against, refresh=False):
        """Apply a new branch/commit/tag string the view is compared to.

        If one of the settings 'focus_change_mode' or 'live_mode' is true,
        the view, is automatically compared by 'on_activate' event when
        returning from a quick panel and therefore the command 'git_gutter'
        can be omitted. This assumption can be overridden by 'refresh' for
        commands that do not show a quick panel.

        Arguments:
            compare_against (string): The branch, commit or tag as returned
                from 'git show-ref' to compare the view against
            refresh (bool): True to force git diff and update GUI
        """
        settings.set_compare_against(self._git_tree, compare_against)
        self.invalidate_git_file()
        if refresh or not any(
                settings.get(key, True)
                for key in ('focus_change_mode', 'live_mode')):
            self.view.run_command('git_gutter')  # refresh UI
예제 #4
0
 def run(self):
     settings.set_compare_against('HEAD')
     self.git_handler.clear_git_time()
     self.view.run_command('git_gutter')  # refresh ui