MCPcopy
hub / github.com/jisaacks/GitGutter / set_compare_against

Method set_compare_against

modules/handler.py:244–269  ·  view source on GitHub ↗

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

(self, compare_against, refresh=False)

Source from the content-addressed store, hash-verified

242 return self.settings.get('compare_against', 'HEAD')
243
244 def set_compare_against(self, compare_against, refresh=False):
245 """Apply a new branch/commit/tag string the view is compared to.
246
247 If one of the settings 'focus_change_mode' or 'live_mode' is true,
248 the view, is automatically compared by 'on_activate' event when
249 returning from a quick panel and therefore the command 'git_gutter'
250 can be omitted. This assumption can be overridden by 'refresh' for
251 commands that do not show a quick panel.
252
253 Arguments:
254 compare_against (string): The branch, commit or tag as returned
255 from 'git show-ref' to compare the view against
256 refresh (bool): True to force git diff and update GUI
257 """
258 self._compare_against_mapping[self._git_tree] = compare_against
259 # force refresh if live_mode and focus_change_mode are disabled
260 refresh |= (not self.settings.get('live_mode') and
261 not self.settings.get('focus_change_mode'))
262 # set view id to ommit from evaluation
263 active_view_id = 0 if refresh else self.view.id()
264 # refresh all visible views
265 for window in sublime.windows():
266 for group in range(window.num_groups()):
267 view = window.active_view_in_group(group)
268 if view and view.id() != active_view_id:
269 view.run_command('git_gutter')
270
271 def format_compare_against(self):
272 """Format the compare against setting to use for display."""

Callers 3

on_doneFunction · 0.80
set_against_headFunction · 0.80
on_branch_nameFunction · 0.80

Calls 1

getMethod · 0.80

Tested by

no test coverage detected