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', 'HEAD:' + 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: open(self.git_temp_file.name, "w").close() args = ["git", "--git-dir=" + self.git_dir, "--work-tree=" + self.git_tree, "show", "HEAD:" + 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: open(self.git_temp_file.name, 'w').close() args = [ git_helper.git_command(self.view), '--git-dir=' + self.git_dir, '--work-tree=' + self.git_tree, 'show', 'HEAD:' + 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: open(self.git_temp_file.name, 'w').close() args = [ 'git', '--git-dir=' + self.git_dir, '--work-tree=' + self.git_tree, 'show', 'HEAD:' + 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