本文整理汇总了Python中GitGutter.view_collection.ViewCollection.git_time方法的典型用法代码示例。如果您正苦于以下问题:Python ViewCollection.git_time方法的具体用法?Python ViewCollection.git_time怎么用?Python ViewCollection.git_time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GitGutter.view_collection.ViewCollection
的用法示例。
在下文中一共展示了ViewCollection.git_time方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_git_file
# 需要导入模块: from GitGutter.view_collection import ViewCollection [as 别名]
# 或者: from GitGutter.view_collection.ViewCollection import git_time [as 别名]
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
示例2: update_git_file
# 需要导入模块: from GitGutter.view_collection import ViewCollection [as 别名]
# 或者: from GitGutter.view_collection.ViewCollection import git_time [as 别名]
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
示例3: update_git_file
# 需要导入模块: from GitGutter.view_collection import ViewCollection [as 别名]
# 或者: from GitGutter.view_collection.ViewCollection import git_time [as 别名]
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