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

Function run_blame

modules/blame.py:25–59  ·  view source on GitHub ↗

Call git blame for the requested or active row and add phantom. Arguments: git_gutter (GitGutterCommand): The main command object, which represents GitGutter. kwargs (dict): The arguments received from the `run_command`. This argument is decla

(git_gutter, **kwargs)

Source from the content-addressed store, hash-verified

23
24
25def run_blame(git_gutter, **kwargs):
26 """Call git blame for the requested or active row and add phantom.
27
28 Arguments:
29 git_gutter (GitGutterCommand):
30 The main command object, which represents GitGutter.
31 kwargs (dict):
32 The arguments received from the `run_command`.
33 This argument is declared to create a common interface being used
34 by the GitGutterCommand object.
35
36 Valid kwargs are:
37 line (int):
38 The zero based line number to run the git blame command for.
39 point (int):
40 The text point to use in order to calculate the line to run the
41 git blame command for.
42 """
43 # check if feature is enabled
44 is_command = not kwargs.get('is_event')
45 show_inline = is_command or git_gutter.line_annotation.is_enabled()
46 status_bar = git_gutter.status_bar
47 show_status = status_bar.is_enabled() and status_bar.has(BLAME_VARIABLES)
48 if not show_inline and not show_status:
49 return None
50
51 # ignore empty lines as cursor jumps off
52 view = git_gutter.view
53 line = line_from_kwargs(view, kwargs)
54 if not view.line(view.text_point(line, 0)):
55 return None
56
57 # run git blame and print its output to the desired targets
58 return git_gutter.git_handler.git_blame(line).then(
59 partial(_render_blame, git_gutter, show_inline, show_status))
60
61
62def _render_blame(git_gutter, show_inline, show_status, contents):

Callers

nothing calls this directly

Calls 6

line_from_kwargsFunction · 0.85
getMethod · 0.80
hasMethod · 0.80
thenMethod · 0.80
git_blameMethod · 0.80
is_enabledMethod · 0.45

Tested by

no test coverage detected