使用Github Desktop修改二进制差异
Github Desktop似乎没有直接从界面执行此操作的能力。您要做的是另外安装git,按照本文中的说明操作,然后从Github桌面单击Repository>在资源管理器中显示,然后右键单击文件夹并在此处选择Git GUI,您可以使用它查看差异。
KTM项目中粒度更改的外部文件
当您查看KTM项目文件(.fpr)的xml内容时,您会看到项目中的脚本,以及项目定义的所有内部内容。有些可能像fields一样可以理解,但其他许多可能无法理解。无论哪种方式,您都无法有选择地合并更改(如本文所述)。因此,在其核心,您仍然需要为每个更改签入整个项目。如果你想变得更精细,你可以考虑用一种不同的方法来代替,甚至是在文章建议的基础上。
Project Builder允许您将特定定位器的配置导出/导入到文件中。您将无法对这些进行差异或合并,但是,如果您确定某个定位器在某个更改后产生了更糟糕的结果,您可以从以前的签入中导入特定定位器,而不是恢复整个项目。
可以调用下面的脚本函数为包含类脚本的每个类导出文件,也可以导出每个定位器脚本的导出定位器无法导出,但它们也没有太多配置:它们后面的脚本包含在它们的类脚本中。您可以根据需要运行该函数,但为了简单起见,我建议每次在Project Builder中测试文档时都运行该函数。因此,每当您测试提取文档时,这些外部文件都是最新的,可以提交任何更改。
Public Sub Design_ExportScriptAndLocators()
Dim ClassIndex As Long
Dim Path As String
' You could hard code a path if you did not want to use script variables
Path=Project.ScriptVariables("Dev_ExportPath")
' Make sure you've added the Microsoft Scripting Runtime reference
Dim fso As New Scripting.FileSystemObject
If Not fso.FolderExists(Path) Then Exit Sub
' Here we use class index -1 to represent the special case of the project class
For ClassIndex=-1 To Project.ClassCount-1
Dim KTMClass As CscClass, ClassName As String, ScriptCode As String
' Get the script of this class
If ClassIndex=-1 Then
Set KTMClass=Project.RootClass
ScriptCodPe=Project.ScriptCode
Else
Set KTMClass=Project.ClassByIndex(ClassIndex)
ScriptCode=KTMClass.ScriptCode
End If
' Get the name of the class
ClassName=IIf(ClassIndex=-1,"Project",KTMClass.Name)
' Export script to file
Dim ScriptFile As TextStream
Set ScriptFile=fso.CreateTextFile(Path & "\Script-" & ClassName & ".txt",True,False)
ScriptFile.Write(ScriptCode)
ScriptFile.Close()
' Export locators (same as from Project Builder menus)
Dim FileName As String
Dim LocatorIndex As Integer
For LocatorIndex=0 To KTMClass.Locators.Count-1
If Not KTMClass.Locators.ItemByIndex(LocatorIndex).LocatorMethod Is Nothing Then
FileName="\" & ClassName & "-" & KTMClass.Locators.ItemByIndex(LocatorIndex).Name & ".loc"
KTMClass.Locators.ItemByIndex(LocatorIndex).ExportLocatorMethod(Path & FileName,Path)
End If
Next
Next
End Sub
在Project Builder中测试文档提取时的示例调用:
Private Sub Document_AfterExtract(ByVal pXDoc As CASCADELib.CscXDocument)
' Only when run in Project Builder...
If Project.ScriptExecutionMode=CscScriptExecutionMode.CscScriptModeServerDesign Then
' Update external script and locator files added to source control
Design_ExportScriptAndLocators()
End If
End Sub