本文整理汇总了Python中cola.diffparse.DiffParser.process_diff_selection方法的典型用法代码示例。如果您正苦于以下问题:Python DiffParser.process_diff_selection方法的具体用法?Python DiffParser.process_diff_selection怎么用?Python DiffParser.process_diff_selection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cola.diffparse.DiffParser
的用法示例。
在下文中一共展示了DiffParser.process_diff_selection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do
# 需要导入模块: from cola.diffparse import DiffParser [as 别名]
# 或者: from cola.diffparse.DiffParser import process_diff_selection [as 别名]
def do(self):
if self.model.mode == self.model.mode_branch:
# We're applying changes from a different branch!
parser = DiffParser(self.model,
filename=self.model.filename,
cached=False,
branch=self.model.head)
status, output = \
parser.process_diff_selection(self.selected,
self.offset,
self.selection,
apply_to_worktree=True)
else:
# The normal worktree vs index scenario
parser = DiffParser(self.model,
filename=self.model.filename,
cached=self.staged,
reverse=self.apply_to_worktree)
status, output = \
parser.process_diff_selection(self.selected,
self.offset,
self.selection,
apply_to_worktree=
self.apply_to_worktree)
_notifier.broadcast(signals.log_cmd, status, output)
# Redo the diff to show changes
if self.staged:
diffcmd = DiffStaged([self.model.filename])
else:
diffcmd = Diff([self.model.filename])
diffcmd.do()
self.model.update_file_status()
示例2: do
# 需要导入模块: from cola.diffparse import DiffParser [as 别名]
# 或者: from cola.diffparse.DiffParser import process_diff_selection [as 别名]
def do(self):
# The normal worktree vs index scenario
parser = DiffParser(self.model,
filename=self.model.filename,
cached=self.staged,
reverse=self.apply_to_worktree)
status, out, err = \
parser.process_diff_selection(self.offset,
self.selection_text,
apply_to_worktree=self.apply_to_worktree)
Interaction.log_status(status, out, err)
self.model.update_file_status(update_index=True)
示例3: do
# 需要导入模块: from cola.diffparse import DiffParser [as 别名]
# 或者: from cola.diffparse.DiffParser import process_diff_selection [as 别名]
def do(self):
# The normal worktree vs index scenario
parser = DiffParser(
self.model, filename=self.model.filename, cached=self.staged, reverse=self.apply_to_worktree
)
status, output = parser.process_diff_selection(
self.selected, self.offset, self.selection, apply_to_worktree=self.apply_to_worktree
)
_notifier.broadcast(signals.log_cmd, status, output)
# Redo the diff to show changes
if self.staged:
diffcmd = DiffStaged([self.model.filename])
else:
diffcmd = Diff([self.model.filename])
diffcmd.do()
self.model.update_file_status()