def update_git_file(self): # the git repo won't change that often # so we can easily wait 5 seconds # between updates for performance if ViewCollection.git_time(self.view) > 5: open(self.git_temp_file.name, 'w').close() if self.view.get_status('remote'): base_path = self.view.file_name() + '.base' if os.path.exists(base_path): shutil.copyfile(base_path, self.git_temp_file.name) return args = [ self.git_binary_path, '--git-dir=' + self.git_dir, '--work-tree=' + self.git_tree, 'show', ViewCollection.get_compare() + ':' + self.git_path, ] try: contents = self.run_command(args) contents = contents.replace(b'\r\n', b'\n') contents = contents.replace(b'\r', b'\n') f = open(self.git_temp_file.name, 'wb') f.write(contents) f.close() ViewCollection.update_git_time(self.view) except Exception: pass
def update_git_file(self): # the git repo won't change that often # so we can easily wait 5 seconds # between updates for performance if ViewCollection.git_time(self.view) > 5: with open(self.git_temp_file, 'w'): pass args = [ self.git_binary_path, '--git-dir=' + self.git_dir, '--work-tree=' + self.git_tree, 'show', ViewCollection.get_compare(self.view) + ':' + self.git_path, ] try: contents = self.run_command(args) contents = contents.replace(b'\r\n', b'\n') contents = contents.replace(b'\r', b'\n') with open(self.git_temp_file, 'wb') as f: f.write(contents) ViewCollection.update_git_time(self.view) except Exception: pass
def run(self, force_refresh=False): self.view = self.window.active_view() if not self.view: # View is not ready yet, try again later. sublime.set_timeout(self.run, 1) return self.clear_all() if ViewCollection.untracked(self.view): self.bind_files('untracked') elif ViewCollection.ignored(self.view): self.bind_files('ignored') else: # If the file is untracked there is no need to execute the diff # update if force_refresh: ViewCollection.clear_git_time(self.view) inserted, modified, deleted = ViewCollection.diff(self.view) self.lines_removed(deleted) self.bind_icons('inserted', inserted) self.bind_icons('changed', modified) if(ViewCollection.show_status(self.view) != "none"): if(ViewCollection.show_status(self.view) == 'all'): branch = ViewCollection.current_branch( self.view).decode("utf-8").strip() else: branch = "" self.update_status(len(inserted), len(modified), len(deleted), ViewCollection.get_compare(self.view), branch) else: self.update_status(0, 0, 0, "", "")
def update_git_file(self): # the git repo won't change that often # so we can easily wait 5 seconds # between updates for performance if ViewCollection.git_time(self.view) > 5: open(self.git_temp_file.name, 'w').close() if self.view.get_status('remote'): base_path = self.view.file_name() + '.base' if os.path.exists(base_path): shutil.copyfile(base_path, self.git_temp_file.name) return args = [ self.git_binary_path, '--git-dir=' + self.git_dir, '--work-tree=' + self.git_tree, 'show', ViewCollection.get_compare() + ':' + self.git_path, ] try: contents = self.run_command(args) contents = contents.replace(b'\r\n', b'\n') contents = contents.replace(b'\r', b'\n') f = open(self.git_temp_file.name, 'wb') f.write(contents) f.close() ViewCollection.update_git_time(self.view) except Exception: pass
def update_git_file(self): # the git repo won't change that often # so we can easily wait 5 seconds # between updates for performance if ViewCollection.git_time(self.view) > 5: with open(self.git_temp_file, 'w'): pass args = [ self.git_binary_path, '--git-dir=' + self.git_dir, '--work-tree=' + self.git_tree, 'show', ViewCollection.get_compare(self.view) + ':' + self.git_path, ] try: contents = self.run_command(args) contents = contents.replace(b'\r\n', b'\n') contents = contents.replace(b'\r', b'\n') with open(self.git_temp_file, 'wb') as f: f.write(contents) ViewCollection.update_git_time(self.view) except Exception: pass
def run(self, force_refresh=False): self.view = self.window.active_view() if not self.view: # View is not ready yet, try again later. sublime.set_timeout(self.run, 1) return self.clear_all() if ViewCollection.untracked(self.view): self.bind_files('untracked') elif ViewCollection.ignored(self.view): self.bind_files('ignored') else: # If the file is untracked there is no need to execute the diff # update if force_refresh: ViewCollection.clear_git_time(self.view) inserted, modified, deleted = ViewCollection.diff(self.view) self.lines_removed(deleted) self.bind_icons('inserted', inserted) self.bind_icons('changed', modified) if (ViewCollection.show_status(self.view) != "none"): if (ViewCollection.show_status(self.view) == 'all'): branch = ViewCollection.current_branch( self.view).decode("utf-8").strip() else: branch = "" self.update_status(len(inserted), len(modified), len(deleted), ViewCollection.get_compare(self.view), branch) else: self.update_status(0, 0, 0, "", "")
def run(self): comparing = ViewCollection.get_compare() sublime.message_dialog("GitGutter is comparing against: " + comparing)
def run(self): comparing = ViewCollection.get_compare() sublime.message_dialog("GitGutter is comparing against: " + comparing)
def run(self): self.view = self.window.active_view() comparing = ViewCollection.get_compare(self.view) sublime.message_dialog("GitGutter is comparing against: " + comparing)
def run(self): self.view = self.window.active_view() comparing = ViewCollection.get_compare(self.view) sublime.message_dialog("GitGutter is comparing against: " + comparing)