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

Method update_git_status

modules/commands.py:147–179  ·  view source on GitHub ↗

Update git repository status. Try to reduce the amount of information to retrieve via git by analysizng the variables defined in the template. Don't waste CPU time if the template is quite simple.

(self)

Source from the content-addressed store, hash-verified

145 self.show_diff_handler.run()
146
147 def update_git_status(self):
148 """Update git repository status.
149
150 Try to reduce the amount of information to retrieve via git by
151 analysizng the variables defined in the template. Don't waste CPU time
152 if the template is quite simple.
153 """
154 if self.status_bar.is_enabled():
155 if self.status_bar.has([
156 'remote', 'ahead', 'behind', 'added_files',
157 'deleted_files', 'modified_files', 'staged_files']):
158 # display branch name and stats
159 self.git_handler.git_branch_status().then(
160 lambda branch_status: self.status_bar.update(
161 repo=self.git_handler.repository_name,
162 compare=self.git_handler.format_compare_against(),
163 **branch_status
164 )
165 )
166 elif self.status_bar.has(['branch']):
167 # display the branch name in the statusbar
168 self.git_handler.git_branch_name().then(
169 lambda branch_name: self.status_bar.update(
170 repo=self.git_handler.repository_name,
171 compare=self.git_handler.format_compare_against(),
172 branch=branch_name
173 )
174 )
175 else:
176 # no global branch information to display in the statusbar
177 self.status_bar.update(
178 repo=self.git_handler.repository_name,
179 compare=self.git_handler.format_compare_against())
180
181
182class GitGutterBaseCommand(sublime_plugin.TextCommand):

Callers 1

runMethod · 0.95

Calls 7

hasMethod · 0.80
thenMethod · 0.80
git_branch_statusMethod · 0.80
git_branch_nameMethod · 0.80
is_enabledMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected