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)
| 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 | |
| 182 | class GitGutterBaseCommand(sublime_plugin.TextCommand): |
no test coverage detected