1. TortoiseHg
  2. TortoiseHg
  3. thg-winbuild

Commits

Steve Borho  committed e77b6b1

take latest diff scripts from TSVN

  • Participants
  • Parent commits 2bce053
  • Branches default

Comments (0)

Files changed (9)

File contrib/diff-scripts/diff-dll.vbs

View file
-' extensions: dll;exe
-'
-' TortoiseSVN Diff script for dll and exe files
-'
-' Copyright (C) 2010 the TortoiseSVN team
-' This file is distributed under the same license as TortoiseSVN
-'
-' Last commit by:
-' $Author$
-' $Date$
-' $Rev$
-'
-' Authors:
-' Casey Barton, 2010
-'
-dim objArgs, objScript, sBaseVer, sNewVer, sMessage
-
-Set objArgs = WScript.Arguments
-num = objArgs.Count
-if num < 2 then
-   MsgBox "Usage: [CScript | WScript] compare.vbs base.doc new.doc", vbExclamation, "Invalid arguments"
-   WScript.Quit 1
-end if
-
-sBaseDoc = objArgs(0)
-sNewDoc = objArgs(1)
-
-Set objScript = CreateObject("Scripting.FileSystemObject")
-If objScript.FileExists(sBaseDoc) = False Then
-    MsgBox "File " + sBaseDoc +" does not exist.  Cannot compare the files.", vbExclamation, "File not found"
-    Wscript.Quit 1
-End If
-If objScript.FileExists(sNewDoc) = False Then
-    MsgBox "File " + sNewDoc +" does not exist.  Cannot compare the files.", vbExclamation, "File not found"
-    Wscript.Quit 1
-End If
-
-sBaseVer = objScript.GetFileVersion(sBaseDoc)
-sNewVer = objScript.GetFileVersion(sNewDoc)
-
-if sBaseVer = sNewVer then
-    sMessage = "Versions are identical: " + sBaseVer
-else
-    sMessage = "Versions differ:" + vbCrLf + vbCrLf _
-        + "Base" + vbCrLf _
-        + "  File: " + sBaseDoc + vbCrLf _
-        + "  Version: " + sBaseVer + vbCrLf + vbCrLf _
-        + "New" + vbCrLf _
-        + "  File: " + sNewDoc + vbCrLf _
-        + "  Version: " + sNewVer
-        
-end if
-
-MsgBox sMessage, vbInformation, "DLL Version Comparison"
-
-Wscript.Quit
+' extensions: dll;exe
+'
+' TortoiseSVN Diff script for binary files
+'
+' Copyright (C) 2010 the TortoiseSVN team
+' This file is distributed under the same license as TortoiseSVN
+'
+' Last commit by:
+' $Author: tortoisesvn $
+' $Date: 2011-03-31 14:18:05 -0500 (Thu, 31 Mar 2011) $
+' $Rev: 21089 $
+'
+' Authors:
+' Casey Barton, 2010
+' Hans-Emil Skogh, 2011
+'
+dim objArgs, objFileSystem, sBaseVer, sNewVer, sMessage, sBaseMessage, sNewMessage, bDiffers
+
+bDiffers = False
+
+Set objArgs = WScript.Arguments
+num = objArgs.Count
+if num < 2 then
+   MsgBox "Usage: [CScript | WScript] compare.vbs base.doc new.doc", vbCritical, "Invalid arguments"
+   WScript.Quit 1
+end if
+
+sBaseDoc = objArgs(0)
+sNewDoc = objArgs(1)
+
+Set objFileSystem = CreateObject("Scripting.FileSystemObject")
+If objFileSystem.FileExists(sBaseDoc) = False Then
+    MsgBox "File " + sBaseDoc +" does not exist.  Cannot compare the files.", vbCritical, "File not found"
+    Wscript.Quit 1
+End If
+If objFileSystem.FileExists(sNewDoc) = False Then
+    MsgBox "File " + sNewDoc +" does not exist.  Cannot compare the files.", vbCritical, "File not found"
+    Wscript.Quit 1
+End If
+
+' Compare file size
+dim fBaseFile, fNewFile
+Set fBaseFile = objFileSystem.GetFile(sBaseDoc)
+Set fNewFile = objFileSystem.GetFile(sNewDoc)
+
+If fBaseFile.size <> fNewFile.size Then
+	bDiffers = True
+	sBaseMessage = sBaseMessage + "  Size: " + CStr(fBaseFile.Size) + " bytes" + vbCrLf
+	sNewMessage = sNewMessage + "  Size: " + CStr(fNewFile.Size) + " bytes" + vbCrLf
+Else
+	sMessage = sMessage + "File sizes: " + CStr(fNewFile.Size) + " bytes" + vbCrLf
+End If
+
+' Compare files using fc.exe
+If bDiffers = False Then
+	Set WshShell = WScript.CreateObject("WScript.Shell")
+	exitStatus = WshShell.Run("fc.exe "+sBaseDoc+" "+sNewDoc, 0, True)
+	If exitStatus = 1 Then
+		bDiffers = True
+		sMessage = sMessage + "File content differs!" + vbCrLf
+	ElseIf exitStatus > 1 Then
+		' Todo: Handle error!
+	End If
+End If
+
+' Only compare versions if we are comparing exe:s or dll:s
+If LCase(Right(sBaseDoc, 3)) = "exe" or LCase(Right(sNewDoc, 3)) = "exe" or _
+	LCase(Right(sBaseDoc, 3)) = "dll" or LCase(Right(sNewDoc, 3)) = "dll" Then
+
+	' Compare version
+	sBaseVer = objFileSystem.GetFileVersion(sBaseDoc)
+	sNewVer = objFileSystem.GetFileVersion(sNewDoc)
+
+	If Len(sBaseVer) = 0 and Len(sNewVer) = 0 Then
+		  sMessage = sMessage + "No version information available."
+	ElseIf sBaseVer = sNewVer Then
+		sMessage = sMessage + "Version: " + sBaseVer
+	Else
+		sBaseMessage = sBaseMessage + "  Version: " + sBaseVer + vbCrLf
+		sNewMessage = sNewMessage + "  Version: " + sNewVer + vbCrLf
+	End If
+End If
+
+' Generate result message
+sBaseMessage = "Base" + vbCrLf _
+    + "  File: " + sBaseDoc + vbCrLf _
+	+ sBaseMessage
+sNewMessage = + "New" + vbCrLf _
+    + "  File: " + sNewDoc + vbCrLf _
+	+ sNewMessage
+
+If bDiffers = True Then
+    sMessage = "Files differ!" + vbCrLf _
+		+ vbCrLf _
+        + sBaseMessage + vbCrLf _
+        + sNewMessage + vbCrLf _
+		+ sMessage
+
+	MsgBox sMessage, vbExclamation, "File Comparison - Differs"
+Else
+	sMessage = "Files are identical" + vbCrLf _
+		+ vbCrLf _
+		+ sMessage
+
+	MsgBox sMessage, vbInformation, "File Comparison - Identical"
+End If
+
+Wscript.Quit

File contrib/diff-scripts/diff-doc.js

View file
-// extensions: doc;docx;docm
-//
-// TortoiseSVN Diff script for Word Doc files
-//
-// Copyright (C) 2004-2008 the TortoiseSVN team
-// This file is distributed under the same license as TortoiseSVN
-//
-// Last commit by:
-// $Author$
-// $Date$
-// $Rev$
-//
-// Authors:
-// Jared Silva, 2008
-// Davide Orlandi and Hans-Emil Skogh, 2005
-//
-
-var objArgs,num,sBaseDoc,sNewDoc,sTempDoc,objScript,word,destination;
-// Microsoft Office versions for Microsoft Windows OS
-var vOffice2000 = 9;
-var vOffice2002 = 10;
-var vOffice2003 = 11;
-var vOffice2007 = 12;
-// WdCompareTarget
-var wdCompareTargetSelected = 0;
-var wdCompareTargetCurrent = 1;
-var wdCompareTargetNew = 2;
-// WdViewType
-var wdMasterView = 5;
-var wdNormalView = 1;
-var wdOutlineView = 2;
-// WdSaveOptions
-var wdDoNotSaveChanges = 0;
-var wdPromptToSaveChanges = -2;
-var wdSaveChanges = -1;
-
-objArgs = WScript.Arguments;
-num = objArgs.length;
-if (num < 2)
-{
-   WScript.Echo("Usage: [CScript | WScript] diff-doc.js base.doc new.doc");
-   WScript.Quit(1);
-}
-
-sBaseDoc = objArgs(0);
-sNewDoc = objArgs(1);
-
-objScript = new ActiveXObject("Scripting.FileSystemObject");
-if ( ! objScript.FileExists(sBaseDoc))
-{
-    WScript.Echo("File " + sBaseDoc + " does not exist.  Cannot compare the documents.");
-    WScript.Quit(1);
-}
-if ( ! objScript.FileExists(sNewDoc))
-{
-    WScript.Echo("File " + sNewDoc + " does not exist.  Cannot compare the documents.");
-    WScript.Quit(1);
-}
-
-try
-{
-   word = WScript.CreateObject("Word.Application");
-}
-catch(e)
-{
-	// before giving up, try with OpenOffice
-	try
-	{
-		var OO;
-		OO = WScript.CreateObject("com.sun.star.ServiceManager");
-	}
-	catch(e)
-	{
-		WScript.Echo("You must have Microsoft Word or OpenOffice installed to perform this operation.");
-		WScript.Quit(1);
-	}
-	// yes, OO is installed - do the diff with that one instead
-	var objFile = objScript.GetFile(sNewDoc);
-	if ((objFile.Attributes & 1)==1)
-	{
-		// reset the readonly attribute
-		objFile.Attributes = objFile.Attributes & (~1);
-	}
-	//Create the DesktopSet 
-	var objDesktop = OO.createInstance("com.sun.star.frame.Desktop");
-	var objUriTranslator = OO.createInstance("com.sun.star.uri.ExternalUriReferenceTranslator");
-	//Adjust the paths for OO
-	sBaseDoc = sBaseDoc.replace(/\\/g, "/");
-	sBaseDoc = sBaseDoc.replace(/:/g, "|");
-	sBaseDoc = sBaseDoc.replace(/ /g, "%20");
-	sBaseDoc="file:///" + sBaseDoc;
-	sBaseDoc=objUriTranslator.translateToInternal(sBaseDoc);
-	sNewDoc = sNewDoc.replace(/\\/g, "/");
-	sNewDoc = sNewDoc.replace(/:/g, "|");
-	sNewDoc = sNewDoc.replace(/ /g, "%20");
-	sNewDoc="file:///" + sNewDoc;
-	sNewDoc=objUriTranslator.translateToInternal(sNewDoc);
-
-	//Open the %base document
-	var oPropertyValue = new Array();
-	oPropertyValue[0] = OO.Bridge_GetStruct("com.sun.star.beans.PropertyValue");
-	oPropertyValue[0].Name = "ShowTrackedChanges";
-	oPropertyValue[0].Value = true;
-	var objDocument=objDesktop.loadComponentFromURL(sNewDoc,"_blank", 0, oPropertyValue);
-	
-	//Set the frame
-	var Frame = objDesktop.getCurrentFrame();
-	
-	var dispatcher=OO.CreateInstance("com.sun.star.frame.DispatchHelper");
-	
-	//Execute the comparison
-	dispatcher.executeDispatch(Frame, ".uno:ShowTrackedChanges", "", 0, oPropertyValue);
-	oPropertyValue[0].Name = "URL";
-	oPropertyValue[0].Value = sBaseDoc;
-	dispatcher.executeDispatch(Frame, ".uno:CompareDocuments", "", 0, oPropertyValue);
-	WScript.Quit(0);
-}
-
-if (parseInt(word.Version) >= vOffice2007)
-{
-	sTempDoc = sNewDoc;
-	sNewDoc = sBaseDoc;
-	sBaseDoc = sTempDoc;
-}
-
-objScript = null;
-
-word.visible = true;
-
-// Open the new document
-try
-{
-    destination = word.Documents.Open(sNewDoc, true, true);
-}
-catch(e)
-{
-    WScript.Echo("Error opening " + sNewDoc);
-    // Quit
-    WScript.Quit(1);
-}
-
-// If the Type property returns either wdOutlineView or wdMasterView and the Count property returns zero, the current document is an outline.
-if (((destination.ActiveWindow.View.Type == wdOutlineView) || (destination.ActiveWindow.View.Type == wdMasterView)) && (destination.Subdocuments.Count == 0))
-{
-    // Change the Type property of the current document to normal
-    destination.ActiveWindow.View.Type = wdNormalView;
-}
-
-// Compare to the base document
-if (parseInt(word.Version) <= vOffice2000)
-{
-    // Compare for Office 2000 and earlier
-    try
-    {
-        destination.Compare(sBaseDoc);
-    }
-    catch(e)
-    {
-        WScript.Echo("Error comparing " + sBaseDoc + " and " + sNewDoc);
-        // Quit
-        WScript.Quit(1);
-    }
-}
-else
-{
-    // Compare for Office XP (2002) and later
-    try
-    {
-        destination.Compare(sBaseDoc, "Comparison", wdCompareTargetNew, true, true);
-    }
-    catch(e)
-    {
-        WScript.Echo("Error comparing " + sBaseDoc + " and " + sNewDoc);
-        // Close the first document and quit
-        destination.Close(wdDoNotSaveChanges);
-        WScript.Quit(1);
-    }
-}
-    
-// Show the comparison result
-if (parseInt(word.Version) < vOffice2007)
-{
-	word.ActiveDocument.Windows(1).Visible = 1;
-}
-    
-// Mark the comparison document as saved to prevent the annoying
-// "Save as" dialog from appearing.
-word.ActiveDocument.Saved = 1;
-    
-// Close the first document
-if (parseInt(word.Version) >= vOffice2002)
-{
-    destination.Close(wdDoNotSaveChanges);
-}
+// extensions: doc;docx;docm
+//
+// TortoiseSVN Diff script for Word Doc files
+//
+// Copyright (C) 2004-2008 the TortoiseSVN team
+// This file is distributed under the same license as TortoiseSVN
+//
+// Last commit by:
+// $Author: tortoisesvn $
+// $Date: 2011-04-01 15:28:10 -0500 (Fri, 01 Apr 2011) $
+// $Rev: 21095 $
+//
+// Authors:
+// Stefan Kueng, 2011
+// Jared Silva, 2008
+// Davide Orlandi and Hans-Emil Skogh, 2005
+//
+
+var objArgs,num,sBaseDoc,sNewDoc,sTempDoc,objScript,word,destination;
+// Microsoft Office versions for Microsoft Windows OS
+var vOffice2000 = 9;
+var vOffice2002 = 10;
+var vOffice2003 = 11;
+var vOffice2007 = 12;
+// WdCompareTarget
+var wdCompareTargetSelected = 0;
+var wdCompareTargetCurrent = 1;
+var wdCompareTargetNew = 2;
+// WdViewType
+var wdMasterView = 5;
+var wdNormalView = 1;
+var wdOutlineView = 2;
+// WdSaveOptions
+var wdDoNotSaveChanges = 0;
+var wdPromptToSaveChanges = -2;
+var wdSaveChanges = -1;
+
+objArgs = WScript.Arguments;
+num = objArgs.length;
+if (num < 2)
+{
+   WScript.Echo("Usage: [CScript | WScript] diff-doc.js base.doc new.doc");
+   WScript.Quit(1);
+}
+
+sBaseDoc = objArgs(0);
+sNewDoc = objArgs(1);
+
+objScript = new ActiveXObject("Scripting.FileSystemObject");
+if ( ! objScript.FileExists(sBaseDoc))
+{
+    WScript.Echo("File " + sBaseDoc + " does not exist.  Cannot compare the documents.");
+    WScript.Quit(1);
+}
+if ( ! objScript.FileExists(sNewDoc))
+{
+    WScript.Echo("File " + sNewDoc + " does not exist.  Cannot compare the documents.");
+    WScript.Quit(1);
+}
+
+try
+{
+   word = WScript.CreateObject("Word.Application");
+}
+catch(e)
+{
+	// before giving up, try with OpenOffice
+	try
+	{
+		var OO;
+		OO = WScript.CreateObject("com.sun.star.ServiceManager");
+	}
+	catch(e)
+	{
+		WScript.Echo("You must have Microsoft Word or OpenOffice installed to perform this operation.");
+		WScript.Quit(1);
+	}
+	// yes, OO is installed - do the diff with that one instead
+	var objFile = objScript.GetFile(sNewDoc);
+	if ((objFile.Attributes & 1)==1)
+	{
+		// reset the readonly attribute
+		objFile.Attributes = objFile.Attributes & (~1);
+	}
+	//Create the DesktopSet 
+	var objDesktop = OO.createInstance("com.sun.star.frame.Desktop");
+	var objUriTranslator = OO.createInstance("com.sun.star.uri.ExternalUriReferenceTranslator");
+	//Adjust the paths for OO
+	sBaseDoc = sBaseDoc.replace(/\\/g, "/");
+	sBaseDoc = sBaseDoc.replace(/:/g, "|");
+	sBaseDoc = sBaseDoc.replace(/ /g, "%20");
+	sBaseDoc="file:///" + sBaseDoc;
+	sBaseDoc=objUriTranslator.translateToInternal(sBaseDoc);
+	sNewDoc = sNewDoc.replace(/\\/g, "/");
+	sNewDoc = sNewDoc.replace(/:/g, "|");
+	sNewDoc = sNewDoc.replace(/ /g, "%20");
+	sNewDoc="file:///" + sNewDoc;
+	sNewDoc=objUriTranslator.translateToInternal(sNewDoc);
+
+	//Open the %base document
+	var oPropertyValue = new Array();
+	oPropertyValue[0] = OO.Bridge_GetStruct("com.sun.star.beans.PropertyValue");
+	oPropertyValue[0].Name = "ShowTrackedChanges";
+	oPropertyValue[0].Value = true;
+	var objDocument=objDesktop.loadComponentFromURL(sNewDoc,"_blank", 0, oPropertyValue);
+	
+	//Set the frame
+	var Frame = objDesktop.getCurrentFrame();
+	
+	var dispatcher=OO.CreateInstance("com.sun.star.frame.DispatchHelper");
+	
+	//Execute the comparison
+	dispatcher.executeDispatch(Frame, ".uno:ShowTrackedChanges", "", 0, oPropertyValue);
+	oPropertyValue[0].Name = "URL";
+	oPropertyValue[0].Value = sBaseDoc;
+	dispatcher.executeDispatch(Frame, ".uno:CompareDocuments", "", 0, oPropertyValue);
+	WScript.Quit(0);
+}
+
+if (parseInt(word.Version) >= vOffice2007)
+{
+	sTempDoc = sNewDoc;
+	sNewDoc = sBaseDoc;
+	sBaseDoc = sTempDoc;
+}
+
+objScript = null;
+
+word.visible = true;
+
+// Open the new document
+try
+{
+    destination = word.Documents.Open(sNewDoc, true, true);
+}
+catch(e)
+{
+    try
+    {
+        // open empty document to prevent bug where first Open() call fails
+        word.Documents.Add();
+        destination = word.Documents.Open(sNewDoc, true, true);
+    }
+    catch(e)
+    {
+        WScript.Echo("Error opening " + sNewDoc);
+        // Quit
+        WScript.Quit(1);
+    }
+}
+
+// If the Type property returns either wdOutlineView or wdMasterView and the Count property returns zero, the current document is an outline.
+if (((destination.ActiveWindow.View.Type == wdOutlineView) || (destination.ActiveWindow.View.Type == wdMasterView)) && (destination.Subdocuments.Count == 0))
+{
+    // Change the Type property of the current document to normal
+    destination.ActiveWindow.View.Type = wdNormalView;
+}
+
+// Compare to the base document
+if (parseInt(word.Version) <= vOffice2000)
+{
+    // Compare for Office 2000 and earlier
+    try
+    {
+        destination.Compare(sBaseDoc);
+    }
+    catch(e)
+    {
+        WScript.Echo("Error comparing " + sBaseDoc + " and " + sNewDoc);
+        // Quit
+        WScript.Quit(1);
+    }
+}
+else
+{
+    // Compare for Office XP (2002) and later
+    try
+    {
+        destination.Compare(sBaseDoc, "Comparison", wdCompareTargetNew, true, true);
+    }
+    catch(e)
+    {
+        WScript.Echo("Error comparing " + sBaseDoc + " and " + sNewDoc);
+        // Close the first document and quit
+        destination.Close(wdDoNotSaveChanges);
+        WScript.Quit(1);
+    }
+}
+    
+// Show the comparison result
+if (parseInt(word.Version) < vOffice2007)
+{
+	word.ActiveDocument.Windows(1).Visible = 1;
+}
+    
+// Mark the comparison document as saved to prevent the annoying
+// "Save as" dialog from appearing.
+word.ActiveDocument.Saved = 1;
+    
+// Close the first document
+if (parseInt(word.Version) >= vOffice2002)
+{
+    destination.Close(wdDoNotSaveChanges);
+}

File contrib/diff-scripts/diff-nb.vbs

View file
 """" + Replace(sBaseDoc,"\","\\") + """," + vbCrLf + _
 """" + Replace(sNewDoc,"\","\\") + """" + vbCrLf + _
 "]])]], NotebookDefault]" + vbCrLf + _
-"}, Saveable->False, Editable->False, WindowToolbars->{}, WindowFrame->ModelessDialog, WindowElements->{}, WindowFrameElements->CloseBox, WindowTitle->""Diff"", ShowCellBracket->False, WindowSize->{Fit,Fit}]"
+"}, Saveable->False, Editable->False, Selectable->False, WindowToolbars->{}, WindowFrame->ModelessDialog, WindowElements->{}, WindowFrameElements->CloseBox, WindowTitle->""Diff"", ShowCellBracket->False, WindowSize->{Fit,Fit}]"
 
 
 objDiffNotebook.Close

File contrib/diff-scripts/diff-odt.vbs

View file
-' extensions: odt;ods
-'
-' TortoiseSVN Diff script for Open Office Text files
-'
-' Copyright (C) 2004-2009 the TortoiseSVN team
-' This file is distributed under the same license as TortoiseSVN
-'
-' Last commit by:
-' $Author$
-' $Date$
-' $Rev$
-'
-' Authors:
-' Jonathan Ashley, 2007
-' Stefan Küng, 2006, 2009
-'
-dim objArgs,num,sBaseDoc,sNewDoc,objScript,word,destination
-
-Set objArgs = WScript.Arguments
-num = objArgs.Count
-if num < 2 then
-   MsgBox "Usage: [CScript | WScript] diff-odt.vbs base.odt new.odt", vbExclamation, "Invalid arguments"
-   WScript.Quit 1
-end if
-
-sBaseDoc=objArgs(0)
-sNewDoc=objArgs(1)
-
-Set objScript = CreateObject("Scripting.FileSystemObject")
-If objScript.FileExists(sBaseDoc) = False Then
-    MsgBox "File " + sBaseDoc +" does not exist.  Cannot compare the documents.", vbExclamation, "File not found"
-    Wscript.Quit 1
-End If
-If objScript.FileExists(sNewDoc) = False Then
-    MsgBox "File " + sNewDoc +" does not exist.  Cannot compare the documents.", vbExclamation, "File not found"
-    Wscript.Quit 1
-End If
-'remove the file write protection
-objScript.GetFile(sBaseDoc).Attributes = objScript.GetFile(sBaseDoc).Attributes And Not 1
-objScript.GetFile(sNewDoc).Attributes = objScript.GetFile(sNewDoc).Attributes And Not 1
-
-Set objScript = Nothing
-
-On Error Resume Next
-'The service manager is always the starting point
-'If there is no office running then an office is started
-Set objServiceManager= Wscript.CreateObject("com.sun.star.ServiceManager")
-If Err.Number <> 0 Then
-   Wscript.Echo "You must have OpenOffice installed to perform this operation."
-   Wscript.Quit 1
-End If
-
-On Error Goto 0
-
-'Because this is a diff, TortoiseSVN marks the files as read-only.
-'However, OpenOffice will not compare any file with that flag set.
-'Make sure we un-set that flag.
-Set objFSO = CreateObject("Scripting.FileSystemObject")
-Set objFile = objFSO.GetFile(sNewDoc)
-If (objFile.Attributes AND 1)=1 Then
-    objFile.Attributes = objFile.Attributes XOR 1 
-End If
-
-'Create the DesktopSet 
-Set objDesktop = objServiceManager.createInstance("com.sun.star.frame.Desktop")
-Set objUriTranslator = objServiceManager.createInstance("com.sun.star.uri.ExternalUriReferenceTranslator")
-'Adjust the paths for OO
-sBaseDoc=Replace(sBaseDoc, "\", "/")
-sBaseDoc=Replace(sBaseDoc, ":", "|")
-sBaseDoc=Replace(sBaseDoc, "%", "%25")
-sBaseDoc=Replace(sBaseDoc, " ", "%20")
-sBaseDoc="file:///"&sBaseDoc
-sBaseDoc=objUriTranslator.translateToInternal(sBaseDoc)
-sNewDoc=Replace(sNewDoc, "\", "/")
-sNewDoc=Replace(sNewDoc, ":", "|")
-sNewDoc=Replace(sNewDoc, "%", "%25")
-sNewDoc=Replace(sNewDoc, " ", "%20")
-sNewDoc="file:///"&sNewDoc
-sNewDoc=objUriTranslator.translateToInternal(sNewDoc)
-
-'Open the %base document
-Dim oPropertyValue(0)
-Set oPropertyValue(0) = objServiceManager.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
-oPropertyValue(0).Name = "ShowTrackedChanges"
-oPropertyValue(0).Value = true
-Set objDocument=objDesktop.loadComponentFromURL(sNewDoc,"_blank", 0, oPropertyValue)
-
-'Set the frame
-Set Frame = objDesktop.getCurrentFrame
-
-Set dispatcher=objServiceManager.CreateInstance("com.sun.star.frame.DispatchHelper")
-
-'Execute the comparison
-dispatcher.executeDispatch Frame, ".uno:ShowTrackedChanges", "", 0, oPropertyValue
-oPropertyValue(0).Name = "URL"
-oPropertyValue(0).Value = sBaseDoc
-dispatcher.executeDispatch Frame, ".uno:CompareDocuments", "", 0, oPropertyValue
-
-
-
+' extensions: odt;ods
+'
+' TortoiseSVN Diff script for Open Office Text files
+'
+' Copyright (C) 2004-2009 the TortoiseSVN team
+' This file is distributed under the same license as TortoiseSVN
+'
+' Last commit by:
+' $Author: tortoisesvn $
+' $Date: 2009-10-18 02:25:24 -0500 (Sun, 18 Oct 2009) $
+' $Rev: 17472 $
+'
+' Authors:
+' Jonathan Ashley, 2007
+' Stefan Küng, 2006, 2009
+'
+dim objArgs,num,sBaseDoc,sNewDoc,objScript,word,destination
+
+Set objArgs = WScript.Arguments
+num = objArgs.Count
+if num < 2 then
+   MsgBox "Usage: [CScript | WScript] diff-odt.vbs base.odt new.odt", vbExclamation, "Invalid arguments"
+   WScript.Quit 1
+end if
+
+sBaseDoc=objArgs(0)
+sNewDoc=objArgs(1)
+
+Set objScript = CreateObject("Scripting.FileSystemObject")
+If objScript.FileExists(sBaseDoc) = False Then
+    MsgBox "File " + sBaseDoc +" does not exist.  Cannot compare the documents.", vbExclamation, "File not found"
+    Wscript.Quit 1
+End If
+If objScript.FileExists(sNewDoc) = False Then
+    MsgBox "File " + sNewDoc +" does not exist.  Cannot compare the documents.", vbExclamation, "File not found"
+    Wscript.Quit 1
+End If
+'remove the file write protection
+objScript.GetFile(sBaseDoc).Attributes = objScript.GetFile(sBaseDoc).Attributes And Not 1
+objScript.GetFile(sNewDoc).Attributes = objScript.GetFile(sNewDoc).Attributes And Not 1
+
+Set objScript = Nothing
+
+On Error Resume Next
+'The service manager is always the starting point
+'If there is no office running then an office is started
+Set objServiceManager= Wscript.CreateObject("com.sun.star.ServiceManager")
+If Err.Number <> 0 Then
+   Wscript.Echo "You must have OpenOffice installed to perform this operation."
+   Wscript.Quit 1
+End If
+
+On Error Goto 0
+
+'Because this is a diff, TortoiseSVN marks the files as read-only.
+'However, OpenOffice will not compare any file with that flag set.
+'Make sure we un-set that flag.
+Set objFSO = CreateObject("Scripting.FileSystemObject")
+Set objFile = objFSO.GetFile(sNewDoc)
+If (objFile.Attributes AND 1)=1 Then
+    objFile.Attributes = objFile.Attributes XOR 1 
+End If
+
+'Create the DesktopSet 
+Set objDesktop = objServiceManager.createInstance("com.sun.star.frame.Desktop")
+Set objUriTranslator = objServiceManager.createInstance("com.sun.star.uri.ExternalUriReferenceTranslator")
+'Adjust the paths for OO
+sBaseDoc=Replace(sBaseDoc, "\", "/")
+sBaseDoc=Replace(sBaseDoc, ":", "|")
+sBaseDoc=Replace(sBaseDoc, "%", "%25")
+sBaseDoc=Replace(sBaseDoc, " ", "%20")
+sBaseDoc="file:///"&sBaseDoc
+sBaseDoc=objUriTranslator.translateToInternal(sBaseDoc)
+sNewDoc=Replace(sNewDoc, "\", "/")
+sNewDoc=Replace(sNewDoc, ":", "|")
+sNewDoc=Replace(sNewDoc, "%", "%25")
+sNewDoc=Replace(sNewDoc, " ", "%20")
+sNewDoc="file:///"&sNewDoc
+sNewDoc=objUriTranslator.translateToInternal(sNewDoc)
+
+'Open the %base document
+Dim oPropertyValue(0)
+Set oPropertyValue(0) = objServiceManager.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
+oPropertyValue(0).Name = "ShowTrackedChanges"
+oPropertyValue(0).Value = true
+Set objDocument=objDesktop.loadComponentFromURL(sNewDoc,"_blank", 0, oPropertyValue)
+
+'Set the frame
+Set Frame = objDesktop.getCurrentFrame
+
+Set dispatcher=objServiceManager.CreateInstance("com.sun.star.frame.DispatchHelper")
+
+'Execute the comparison
+dispatcher.executeDispatch Frame, ".uno:ShowTrackedChanges", "", 0, oPropertyValue
+oPropertyValue(0).Name = "URL"
+oPropertyValue(0).Value = sBaseDoc
+dispatcher.executeDispatch Frame, ".uno:CompareDocuments", "", 0, oPropertyValue
+
+
+

File contrib/diff-scripts/diff-ppt.js

View file
-// extensions: ppt;pptx;pptm
-//
-// TortoiseSVN Diff script for Powerpoint files
-//
-// Copyright (C) 2004-2009 the TortoiseSVN team
-// This file is distributed under the same license as TortoiseSVN
-//
-// Last commit by:
-// $Author$
-// $Date$
-// $Rev$
-//
-// Authors:
-// Arne Moor, 2006
-//
-
-/*
-This script starts PowerPoint and compares the two given presentations.
-To better see the changes and get the highlighting feature of PowerPoint
-click on "Apply all changes to the presentation" on the reviewing toolbar.
-*/
-
-function PptAppMajorVersion(PowerPoint)
-{
-    var pptVersion;
-    try
-    {
-        pptVersion = PowerPoint.Version.toString();
-        if (pptVersion.indexOf(".") > 0) 
-        {
-            pptVersion = pptVersion.substr(0, pptVersion.indexOf("."));
-        }
-        if (pptVersion == "")
-            return 0;
-        else
-            return parseInt(pptVersion);
-    }
-    catch(e)
-    {
-        return 0;
-    }    
-}
-
-var objArgs,num,sBasePpt,sNewPpt,objScript,powerpoint,source;
-
-objArgs = WScript.Arguments;
-num = objArgs.length;
-if (num < 2)
-{
-   WScript.Echo("Usage: [CScript | WScript] diff-ppt.js base.ppt new.ppt");
-   WScript.Quit(1);
-}
-
-sBasePpt = objArgs(0);
-sNewPpt = objArgs(1);
-
-objScript = new ActiveXObject("Scripting.FileSystemObject");
-if ( ! objScript.FileExists(sBasePpt))
-{
-    WScript.Echo("File " + sBasePpt + " does not exist.  Cannot compare the presentations.");
-    WScript.Quit(1);
-}
-if ( ! objScript.FileExists(sNewPpt))
-{
-    WScript.Echo("File " + sNewPpt +" does not exist.  Cannot compare the presentations.");
-    WScript.Quit(1);
-}
-
-objScript = null;
-
-try
-{
-   powerpoint = WScript.CreateObject("Powerpoint.Application");
-}
-catch(e)
-{
-   WScript.Echo("You must have Microsoft Powerpoint installed to perform this operation.");
-   WScript.Quit(1);
-}
-
-if (PptAppMajorVersion(powerpoint) >= 12) 
-{
-    WScript.Echo("Microsoft Powerpoint 2007 doesn't provide the DIFF features any more. Sorry!\r\nYou can try diffing with OpenOffice...");
-    WScript.Quit(1);
-}
-else 
-{
-    powerpoint.visible = true;
-
-    // Open the original (base) document
-    source = powerpoint.Presentations.Open(sBasePpt);
-
-    // Merge the new document, to show the changes
-    source.Merge(sNewPpt);
-
-    // Mark the comparison presentation as saved to prevent the annoying
-    // "Save as" dialog from appearing.
-    powerpoint.ActivePresentation.Saved = 1;
+// extensions: ppt;pptx;pptm
+//
+// TortoiseSVN Diff script for Powerpoint files
+//
+// Copyright (C) 2004-2009 the TortoiseSVN team
+// This file is distributed under the same license as TortoiseSVN
+//
+// Last commit by:
+// $Author: tortoisesvn $
+// $Date: 2010-08-07 09:09:56 -0500 (Sat, 07 Aug 2010) $
+// $Rev: 19994 $
+//
+// Authors:
+// Arne Moor, 2006
+//
+
+/*
+This script starts PowerPoint and compares the two given presentations.
+To better see the changes and get the highlighting feature of PowerPoint
+click on "Apply all changes to the presentation" on the reviewing toolbar.
+*/
+
+function PptAppMajorVersion(PowerPoint)
+{
+    var pptVersion;
+    try
+    {
+        pptVersion = PowerPoint.Version.toString();
+        if (pptVersion.indexOf(".") > 0) 
+        {
+            pptVersion = pptVersion.substr(0, pptVersion.indexOf("."));
+        }
+        if (pptVersion == "")
+            return 0;
+        else
+            return parseInt(pptVersion);
+    }
+    catch(e)
+    {
+        return 0;
+    }    
+}
+
+var objArgs,num,sBasePpt,sNewPpt,objScript,powerpoint,source;
+
+objArgs = WScript.Arguments;
+num = objArgs.length;
+if (num < 2)
+{
+   WScript.Echo("Usage: [CScript | WScript] diff-ppt.js base.ppt new.ppt");
+   WScript.Quit(1);
+}
+
+sBasePpt = objArgs(0);
+sNewPpt = objArgs(1);
+
+objScript = new ActiveXObject("Scripting.FileSystemObject");
+if ( ! objScript.FileExists(sBasePpt))
+{
+    WScript.Echo("File " + sBasePpt + " does not exist.  Cannot compare the presentations.");
+    WScript.Quit(1);
+}
+if ( ! objScript.FileExists(sNewPpt))
+{
+    WScript.Echo("File " + sNewPpt +" does not exist.  Cannot compare the presentations.");
+    WScript.Quit(1);
+}
+
+objScript = null;
+
+try
+{
+   powerpoint = WScript.CreateObject("Powerpoint.Application");
+}
+catch(e)
+{
+   WScript.Echo("You must have Microsoft Powerpoint installed to perform this operation.");
+   WScript.Quit(1);
+}
+
+if (PptAppMajorVersion(powerpoint) == 12) 
+{
+    WScript.Echo("Microsoft Powerpoint 2007 doesn't provide the DIFF features any more. Sorry!");
+    WScript.Quit(1);
+}
+else 
+{
+    powerpoint.visible = true;
+
+    // Open the original (base) document
+    source = powerpoint.Presentations.Open(sBasePpt);
+
+    // Merge the new document, to show the changes
+    source.Merge(sNewPpt);
+
+    // Mark the comparison presentation as saved to prevent the annoying
+    // "Save as" dialog from appearing.
+    powerpoint.ActivePresentation.Saved = 1;
 }

File contrib/diff-scripts/diff-sxw.vbs

View file
-'
-' TortoiseSVN Diff script for Open Office Calc files
-'
-' Copyright (C) 2004-2008 the TortoiseSVN team
-' This file is distributed under the same license as TortoiseSVN
-'
-' Last commit by:
-' $Author$
-' $Date$
-' $Rev$
-'
-' Authors:
-' Jonathan Ashley, 2007
-' Stefan Küng, 2006
-'
-dim objArgs,num,sBaseDoc,sNewDoc,objScript,word,destination
-
-Set objArgs = WScript.Arguments
-num = objArgs.Count
-if num < 2 then
-   MsgBox "Usage: [CScript | WScript] compare.vbs base.doc new.doc", vbExclamation, "Invalid arguments"
-   WScript.Quit 1
-end if
-
-sBaseDoc=objArgs(0)
-sNewDoc=objArgs(1)
-
-Set objScript = CreateObject("Scripting.FileSystemObject")
-If objScript.FileExists(sBaseDoc) = False Then
-    MsgBox "File " + sBaseDoc +" does not exist.  Cannot compare the documents.", vbExclamation, "File not found"
-    Wscript.Quit 1
-End If
-If objScript.FileExists(sNewDoc) = False Then
-    MsgBox "File " + sNewDoc +" does not exist.  Cannot compare the documents.", vbExclamation, "File not found"
-    Wscript.Quit 1
-End If
-
-Set objScript = Nothing
-
-On Error Resume Next
-'The service manager is always the starting point
-'If there is no office running then an office is started
-Set objServiceManager= Wscript.CreateObject("com.sun.star.ServiceManager")
-If Err.Number <> 0 Then
-   Wscript.Echo "You must have OpenOffice installed to perform this operation."
-   Wscript.Quit 1
-End If
-
-On Error Goto 0
-'Create the DesktopSet 
-Set objDesktop = objServiceManager.createInstance("com.sun.star.frame.Desktop")
-'Adjust the paths for OO
-sBaseDoc=Replace(sBaseDoc, "\", "/")
-sBaseDoc=Replace(sBaseDoc, ":", "|")
-sBaseDoc=Replace(sBaseDoc, "%", "%25")
-sBaseDoc=Replace(sBaseDoc, " ", "%20")
-sBaseDoc="file:///"&sBaseDoc
-sNewDoc=Replace(sNewDoc, "\", "/")
-sNewDoc=Replace(sNewDoc, ":", "|")
-sNewDoc=Replace(sNewDoc, "%", "%25")
-sNewDoc=Replace(sNewDoc, " ", "%20")
-sNewDoc="file:///"&sNewDoc
-
-'Open the %base document
-Dim oPropertyValue(0)
-Set oPropertyValue(0) = objServiceManager.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
-oPropertyValue(0).Name = "ShowTrackedChanges"
-oPropertyValue(0).Value = true
-Set objDocument=objDesktop.loadComponentFromURL(sNewDoc,"_blank", 0, oPropertyValue)
-Set objDocument2=objDesktop.loadComponentFromURL(sBaseDoc,"_blank",0, oPropertyValue)
-
+'
+' TortoiseSVN Diff script for Open Office Calc files
+'
+' Copyright (C) 2004-2008 the TortoiseSVN team
+' This file is distributed under the same license as TortoiseSVN
+'
+' Last commit by:
+' $Author: tortoisesvn $
+' $Date: 2008-06-16 14:36:28 -0500 (Mon, 16 Jun 2008) $
+' $Rev: 13285 $
+'
+' Authors:
+' Jonathan Ashley, 2007
+' Stefan Küng, 2006
+'
+dim objArgs,num,sBaseDoc,sNewDoc,objScript,word,destination
+
+Set objArgs = WScript.Arguments
+num = objArgs.Count
+if num < 2 then
+   MsgBox "Usage: [CScript | WScript] compare.vbs base.doc new.doc", vbExclamation, "Invalid arguments"
+   WScript.Quit 1
+end if
+
+sBaseDoc=objArgs(0)
+sNewDoc=objArgs(1)
+
+Set objScript = CreateObject("Scripting.FileSystemObject")
+If objScript.FileExists(sBaseDoc) = False Then
+    MsgBox "File " + sBaseDoc +" does not exist.  Cannot compare the documents.", vbExclamation, "File not found"
+    Wscript.Quit 1
+End If
+If objScript.FileExists(sNewDoc) = False Then
+    MsgBox "File " + sNewDoc +" does not exist.  Cannot compare the documents.", vbExclamation, "File not found"
+    Wscript.Quit 1
+End If
+
+Set objScript = Nothing
+
+On Error Resume Next
+'The service manager is always the starting point
+'If there is no office running then an office is started
+Set objServiceManager= Wscript.CreateObject("com.sun.star.ServiceManager")
+If Err.Number <> 0 Then
+   Wscript.Echo "You must have OpenOffice installed to perform this operation."
+   Wscript.Quit 1
+End If
+
+On Error Goto 0
+'Create the DesktopSet 
+Set objDesktop = objServiceManager.createInstance("com.sun.star.frame.Desktop")
+'Adjust the paths for OO
+sBaseDoc=Replace(sBaseDoc, "\", "/")
+sBaseDoc=Replace(sBaseDoc, ":", "|")
+sBaseDoc=Replace(sBaseDoc, "%", "%25")
+sBaseDoc=Replace(sBaseDoc, " ", "%20")
+sBaseDoc="file:///"&sBaseDoc
+sNewDoc=Replace(sNewDoc, "\", "/")
+sNewDoc=Replace(sNewDoc, ":", "|")
+sNewDoc=Replace(sNewDoc, "%", "%25")
+sNewDoc=Replace(sNewDoc, " ", "%20")
+sNewDoc="file:///"&sNewDoc
+
+'Open the %base document
+Dim oPropertyValue(0)
+Set oPropertyValue(0) = objServiceManager.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
+oPropertyValue(0).Name = "ShowTrackedChanges"
+oPropertyValue(0).Value = true
+Set objDocument=objDesktop.loadComponentFromURL(sNewDoc,"_blank", 0, oPropertyValue)
+Set objDocument2=objDesktop.loadComponentFromURL(sBaseDoc,"_blank",0, oPropertyValue)
+

File contrib/diff-scripts/diff-xls.vbs

View file
-' extensions: xls;xlsx;xlsm;xlsb;xlam
-'
-' TortoiseSVN Diff script for Excel files
-'
-' Copyright (C) 2004-2008 the TortoiseSVN team
-' This file is distributed under the same license as TortoiseSVN
-'
-' Last commit by:
-' $Author$
-' $Date$
-' $Rev$
-'
-' Authors:
-' Michael Joras <michael@joras.net>, 2008
-' Suraj Barkale, 2006
-'
-
-dim objExcelApp, objArgs, objScript, objBaseDoc, objNewDoc, objWorkSheet, i
-
-Set objArgs = WScript.Arguments
-num = objArgs.Count
-if num < 2 then
-   MsgBox "Usage: [CScript | WScript] compare.vbs base.doc new.doc", vbExclamation, "Invalid arguments"
-   WScript.Quit 1
-end if
-
-sBaseDoc = objArgs(0)
-sNewDoc = objArgs(1)
-
-Set objScript = CreateObject("Scripting.FileSystemObject")
-If objScript.FileExists(sBaseDoc) = False Then
-    MsgBox "File " + sBaseDoc +" does not exist.  Cannot compare the documents.", vbExclamation, "File not found"
-    Wscript.Quit 1
-End If
-If objScript.FileExists(sNewDoc) = False Then
-    MsgBox "File " + sNewDoc +" does not exist.  Cannot compare the documents.", vbExclamation, "File not found"
-    Wscript.Quit 1
-End If
-
-Set objScript = Nothing
-
-On Error Resume Next
-Set objExcelApp = Wscript.CreateObject("Excel.Application")
-If Err.Number <> 0 Then
-   Wscript.Echo "You must have Excel installed to perform this operation."
-   Wscript.Quit 1
-End If
-
-'Open base excel sheet
-objExcelApp.Workbooks.Open sBaseDoc
-'Open new excel sheet
-objExcelApp.Workbooks.Open sNewDoc
-'Show Excel window
-objExcelApp.Visible = True
-'Create a compare side by side view
-objExcelApp.Windows.CompareSideBySideWith(objExcelApp.Windows(2).Caption)
-If Err.Number <> 0 Then
-	objExcelApp.Application.WindowState = xlMaximized
-	objExcelApp.Windows.Arrange(-4128)
-End If
-
-'Mark differences in sNewDoc red
-i = 1
-
-For Each objWorkSheet In objExcelApp.Workbooks(2).Worksheets
-
-		objworksheet.Cells.FormatConditions.Delete
-
-		objExcelApp.Workbooks(1).Sheets(i).Copy ,objExcelApp.Workbooks(2).Sheets(objExcelApp.Workbooks(2).Sheets.Count)
-
-		objExcelApp.Workbooks(2).Sheets(objExcelApp.Workbooks(2).Sheets.Count).Name = "Dummy_for_Comparison" & i
-
-		objworksheet.Activate
-		'To create a local formula the cell A1 is used
-		original_content = objworksheet.Cells(1,1).Formula
-		String sFormula
-		'objworksheet.Cells(1,1).Formula = "=INDIRECT(""" & objExcelApp.Workbooks(2).Sheets(i).name & " (2)"& "!""&ADDRESS(ROW(),COLUMN()))"
-		objworksheet.Cells(1,1).Formula = "=INDIRECT(""Dummy_for_Comparison" & i & "!""&ADDRESS(ROW(),COLUMN()))" 
-		sFormula = objworksheet.Cells(1,1).FormulaLocal
-
-		objworksheet.Cells(1,1).Formula = original_content
-		'with the local formula the conditional formatting is used to mark the cells that are different
-		const xlCellValue = 1
-		const xlNotEqual = 4
-		objworksheet.Cells.FormatConditions.Add xlCellValue, xlNotEqual, sFormula
-		objworksheet.Cells.FormatConditions(1).Interior.ColorIndex = 3
-
-	i = i + 1 
-next
+' extensions: xls;xlsx;xlsm;xlsb;xlam
+'
+' TortoiseSVN Diff script for Excel files
+'
+' Copyright (C) 2004-2008 the TortoiseSVN team
+' This file is distributed under the same license as TortoiseSVN
+'
+' Last commit by:
+' $Author: tortoisesvn $
+' $Date: 2009-10-18 02:25:24 -0500 (Sun, 18 Oct 2009) $
+' $Rev: 17472 $
+'
+' Authors:
+' Michael Joras <michael@joras.net>, 2008
+' Suraj Barkale, 2006
+'
+
+dim objExcelApp, objArgs, objScript, objBaseDoc, objNewDoc, objWorkSheet, i
+
+Set objArgs = WScript.Arguments
+num = objArgs.Count
+if num < 2 then
+   MsgBox "Usage: [CScript | WScript] compare.vbs base.doc new.doc", vbExclamation, "Invalid arguments"
+   WScript.Quit 1
+end if
+
+sBaseDoc = objArgs(0)
+sNewDoc = objArgs(1)
+
+Set objScript = CreateObject("Scripting.FileSystemObject")
+If objScript.FileExists(sBaseDoc) = False Then
+    MsgBox "File " + sBaseDoc +" does not exist.  Cannot compare the documents.", vbExclamation, "File not found"
+    Wscript.Quit 1
+End If
+If objScript.FileExists(sNewDoc) = False Then
+    MsgBox "File " + sNewDoc +" does not exist.  Cannot compare the documents.", vbExclamation, "File not found"
+    Wscript.Quit 1
+End If
+
+Set objScript = Nothing
+
+On Error Resume Next
+Set objExcelApp = Wscript.CreateObject("Excel.Application")
+If Err.Number <> 0 Then
+   Wscript.Echo "You must have Excel installed to perform this operation."
+   Wscript.Quit 1
+End If
+
+'Open base excel sheet
+objExcelApp.Workbooks.Open sBaseDoc
+'Open new excel sheet
+objExcelApp.Workbooks.Open sNewDoc
+'Show Excel window
+objExcelApp.Visible = True
+'Create a compare side by side view
+objExcelApp.Windows.CompareSideBySideWith(objExcelApp.Windows(2).Caption)
+If Err.Number <> 0 Then
+	objExcelApp.Application.WindowState = xlMaximized
+	objExcelApp.Windows.Arrange(-4128)
+End If
+
+'Mark differences in sNewDoc red
+i = 1
+
+For Each objWorkSheet In objExcelApp.Workbooks(2).Worksheets
+
+		objworksheet.Cells.FormatConditions.Delete
+
+		objExcelApp.Workbooks(1).Sheets(i).Copy ,objExcelApp.Workbooks(2).Sheets(objExcelApp.Workbooks(2).Sheets.Count)
+
+		objExcelApp.Workbooks(2).Sheets(objExcelApp.Workbooks(2).Sheets.Count).Name = "Dummy_for_Comparison" & i
+
+		objworksheet.Activate
+		'To create a local formula the cell A1 is used
+		original_content = objworksheet.Cells(1,1).Formula
+		String sFormula
+		'objworksheet.Cells(1,1).Formula = "=INDIRECT(""" & objExcelApp.Workbooks(2).Sheets(i).name & " (2)"& "!""&ADDRESS(ROW(),COLUMN()))"
+		objworksheet.Cells(1,1).Formula = "=INDIRECT(""Dummy_for_Comparison" & i & "!""&ADDRESS(ROW(),COLUMN()))" 
+		sFormula = objworksheet.Cells(1,1).FormulaLocal
+
+		objworksheet.Cells(1,1).Formula = original_content
+		'with the local formula the conditional formatting is used to mark the cells that are different
+		const xlCellValue = 1
+		const xlNotEqual = 4
+		objworksheet.Cells.FormatConditions.Add xlCellValue, xlNotEqual, sFormula
+		objworksheet.Cells.FormatConditions(1).Interior.ColorIndex = 3
+
+	i = i + 1 
+next

File contrib/diff-scripts/merge-doc.js

View file
-// extensions: doc;docx;docm
-//
-// TortoiseSVN Merge script for Word Doc files
-//
-// Copyright (C) 2004-2008 the TortoiseSVN team
-// This file is distributed under the same license as TortoiseSVN
-//
-// Last commit by:
-// $Author$
-// $Date$
-// $Rev$
-//
-// Authors:
-// Dan Sheridan, 2008
-// Davide Orlandi and Hans-Emil Skogh, 2005
-//
-
-var objArgs,num,sTheirDoc,sMyDoc,sBaseDoc,sMergedDoc,objScript,word,baseDoc,WSHShell;
-
-// Microsoft Office versions for Microsoft Windows OS
-var vOffice2000 = 9;
-var vOffice2002 = 10;
-var vOffice2003 = 11;
-var vOffice2007 = 12;
-// WdCompareTarget
-var wdCompareTargetSelected = 0;
-var wdCompareTargetCurrent = 1;
-var wdCompareTargetNew = 2;
-
-objArgs = WScript.Arguments;
-num = objArgs.length;
-if (num < 4)
-{
-   WScript.Echo("Usage: [CScript | WScript] merge-doc.js merged.doc theirs.doc mine.doc base.doc");
-   WScript.Quit(1);
-}
-
-sMergedDoc=objArgs(0);
-sTheirDoc=objArgs(1);
-sMyDoc=objArgs(2);
-sBaseDoc=objArgs(3);
-
-objScript = new ActiveXObject("Scripting.FileSystemObject")
-if ( ! objScript.FileExists(sTheirDoc))
-{
-    WScript.Echo("File " + sTheirDoc +" does not exist.  Cannot compare the documents.", vbExclamation, "File not found");
-    WScript.Quit(1);
-}
-if ( ! objScript.FileExists(sMergedDoc))
-{
-    WScript.Echo("File " + sMergedDoc +" does not exist.  Cannot compare the documents.", vbExclamation, "File not found");
-    WScript.Quit(1);
-}
-
-objScript = null
-
-try
-{
-	word = WScript.CreateObject("Word.Application");
-}
-catch(e)
-{
-   WScript.Echo("You must have Microsoft Word installed to perform this operation.");
-   WScript.Quit(1);
-}
-
-word.visible = true
-
-// Open the base document
-baseDoc = word.Documents.Open(sTheirDoc);
-
-// Merge into the "My" document
-if (parseInt(word.Version) < vOffice2000)
-{
-        baseDoc.Compare(sMergedDoc);
-}
-else if (parseInt(word.Version) < vOffice2007)
-{
-        baseDoc.Compare(sMergedDoc, "Comparison", wdCompareTargetNew, true, true);
-} else {
-	baseDoc.Merge(sMergedDoc);
-}
-
-// Show the merge result
-if (parseInt(word.Version) < 12)
-{
-	word.ActiveDocument.Windows(1).Visible = 1;
-}
-
-// Close the first document
-if (parseInt(word.Version) >= 10)
-{
-   baseDoc.Close();
-}
-
-// Show usage hint message
-WSHShell = WScript.CreateObject("WScript.Shell");
-if(WSHShell.Popup("You have to accept or reject the changes before\nsaving the document to prevent future problems.\n\nWould you like to see a help page on how to do this?", 0, "TSVN Word Merge", 4 + 64) == 6)
-{
-    WSHShell.Run("http://office.microsoft.com/en-us/assistance/HP030823691033.aspx");
-}
+// extensions: doc;docx;docm
+//
+// TortoiseSVN Merge script for Word Doc files
+//
+// Copyright (C) 2004-2008, 2011 the TortoiseSVN team
+// This file is distributed under the same license as TortoiseSVN
+//
+// Last commit by:
+// $Author: tortoisesvn $
+// $Date: 2011-11-07 11:22:20 -0600 (Mon, 07 Nov 2011) $
+// $Rev: 22247 $
+//
+// Authors:
+// Dan Sheridan, 2008
+// Davide Orlandi and Hans-Emil Skogh, 2005
+// Richard Horton, 2011
+//
+
+var objArgs,num,sTheirDoc,sMyDoc,sBaseDoc,sMergedDoc,objScript,word,baseDoc,myDoc,theirDoc,WSHShell;
+
+// Microsoft Office versions for Microsoft Windows OS
+var vOffice2000 = 9;
+var vOffice2002 = 10;
+var vOffice2003 = 11;
+var vOffice2007 = 12;
+var vOffice2010 = 14;
+// WdCompareTarget
+var wdCompareTargetSelected = 0;
+var wdCompareTargetCurrent = 1;
+var wdCompareTargetNew = 2;
+var wdMergeTargetCurrent = 1;
+
+objArgs = WScript.Arguments;
+num = objArgs.length;
+if (num < 4)
+{
+   WScript.Echo("Usage: [CScript | WScript] merge-doc.js merged.doc theirs.doc mine.doc base.doc");
+   WScript.Quit(1);
+}
+
+sMergedDoc=objArgs(0);
+sTheirDoc=objArgs(1);
+sMyDoc=objArgs(2);
+sBaseDoc=objArgs(3);
+
+objScript = new ActiveXObject("Scripting.FileSystemObject")
+if ( ! objScript.FileExists(sTheirDoc))
+{
+    WScript.Echo("File " + sTheirDoc +" does not exist.  Cannot compare the documents.", vbExclamation, "File not found");
+    WScript.Quit(1);
+}
+if ( ! objScript.FileExists(sMergedDoc))
+{
+    WScript.Echo("File " + sMergedDoc +" does not exist.  Cannot compare the documents.", vbExclamation, "File not found");
+    WScript.Quit(1);
+}
+
+objScript = null
+
+try
+{
+	word = WScript.CreateObject("Word.Application");
+}
+catch(e)
+{
+   WScript.Echo("You must have Microsoft Word installed to perform this operation.");
+   WScript.Quit(1);
+}
+
+word.visible = true
+
+// Open the base document
+baseDoc = word.Documents.Open(sTheirDoc);
+
+// Merge into the "My" document
+if (parseInt(word.Version) < vOffice2000)
+{
+        baseDoc.Compare(sMergedDoc);
+}
+else if (parseInt(word.Version) < vOffice2007)
+{
+        baseDoc.Compare(sMergedDoc, "Comparison", wdCompareTargetNew, true, true);
+}
+else if (parseInt(word.Version) < vOffice2010)
+{
+        baseDoc.Merge(sMergedDoc);
+}
+else //2010 - handle slightly differently as the basic merge isn't that good
+//note this is designed specifically for svn 3 way merges, during the commit conflict resolution process
+{
+        theirDoc = baseDoc;
+        baseDoc = word.Documents.Open(sBaseDoc);
+        myDoc = word.Documents.Open(sMyDoc);
+
+        baseDoc.Activate(); //required otherwise it compares the wrong docs !!!
+        baseDoc.Compare(sTheirDoc, "theirs", wdCompareTargetSelected, true, true);
+
+        baseDoc.Activate(); //required otherwise it compares the wrong docs !!!
+        baseDoc.Compare(sMyDoc, "mine", wdCompareTargetSelected, true, true);
+
+        //theirDoc.Save();
+        //myDoc.Save();
+        myDoc.Activate(); //required? just in case
+        myDoc.Merge(sTheirDoc, wdMergeTargetCurrent);
+}
+
+// Show the merge result
+if (parseInt(word.Version) < vOffice2007)
+{
+	word.ActiveDocument.Windows(1).Visible = 1;
+}
+
+// Close the first document
+if ((parseInt(word.Version) >= vOffice2002)&&(parseInt(word.Version) < vOffice2010))
+{
+        baseDoc.Close();
+}
+
+// Show usage hint message
+WSHShell = WScript.CreateObject("WScript.Shell");
+if(WSHShell.Popup("You have to accept or reject the changes before\nsaving the document to prevent future problems.\n\nWould you like to see a help page on how to do this?", 0, "TSVN Word Merge", 4 + 64) == 6)
+{
+    WSHShell.Run("http://office.microsoft.com/en-us/assistance/HP030823691033.aspx");
+}

File contrib/diff-scripts/merge-ods.vbs

View file
-' extensions: ods;odt;sxw
-'
-' TortoiseSVN Merge script for Open Office Calc files
-'
-' Copyright (C) 2004-2009 the TortoiseSVN team
-' This file is distributed under the same license as TortoiseSVN
-'
-' Last commit by:
-' $Author$
-' $Date$
-' $Rev$
-'
-' Authors:
-' Jonathan Ashley, 2007
-' Stefan Küng, 2006, 2009
-'
-dim objArgs,num,sBaseDoc,sMergedDoc,sTheirDoc,sMyDoc,objScript,word,destination
-
-Set objArgs = WScript.Arguments
-num = objArgs.Count
-if num < 4 then
-   MsgBox "Usage: [CScript | WScript] merge-ods.vbs %merged %theirs %mine %base", vbExclamation, "Invalid arguments"
-   WScript.Quit 1
-end if
-
-sMergedDoc=objArgs(0)
-sTheirDoc=objArgs(1)
-sMyDoc=objArgs(2)
-sBaseDoc=objArgs(3)
-
-Set objScript = CreateObject("Scripting.FileSystemObject")
-If objScript.FileExists(sMyDoc) = False Then
-    MsgBox "File " + sMyDoc +" does not exist.  Cannot compare the documents.", vbExclamation, "File not found"
-    Wscript.Quit 1
-End If
-If objScript.FileExists(sTheirDoc) = False Then
-    MsgBox "File " + sTheirDoc +" does not exist.  Cannot compare the documents.", vbExclamation, "File not found"
-    Wscript.Quit 1
-End If
-'remove the file write protection
-objScript.GetFile(sMyDoc).Attributes = objScript.GetFile(sMyDoc).Attributes And Not 1
-objScript.GetFile(sTheirDoc).Attributes = objScript.GetFile(sTheirDoc).Attributes And Not 1
-
-Set objScript = Nothing
-
-On Error Resume Next
-'The service manager is always the starting point
-'If there is no office running then an office is started
-Set objServiceManager= Wscript.CreateObject("com.sun.star.ServiceManager")
-If Err.Number <> 0 Then
-   Wscript.Echo "You must have OpenOffice installed to perform this operation."
-   Wscript.Quit 1
-End If
-
-On Error Goto 0
-'Create the DesktopSet 
-Set objDesktop = objServiceManager.createInstance("com.sun.star.frame.Desktop")
-'Adjust the paths for OO
-sMyDoc=Replace(sMyDoc, "\", "/")
-sMyDoc=Replace(sMyDoc, ":", "|")
-sMyDoc=Replace(sMyDoc, "%", "%25")
-sMyDoc=Replace(sMyDoc, " ", "%20")
-sMyDoc="file:///"&sMyDoc
-sTheirDoc=Replace(sTheirDoc, "\", "/")
-sTheirDoc=Replace(sTheirDoc, ":", "|")
-sTheirDoc=Replace(sTheirDoc, "%", "%25")
-sTheirDoc=Replace(sTheirDoc, " ", "%20")
-sTheirDoc="file:///"&sTheirDoc
-
-'Open the %mine document
-Dim oPropertyValue(0)
-Set oPropertyValue(0) = objServiceManager.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
-oPropertyValue(0).Name = "ShowTrackedChanges"
-oPropertyValue(0).Value = true
-Set objDocument=objDesktop.loadComponentFromURL(sMyDoc,"_blank", 0, oPropertyValue)
-
-'Set the frame
-Set Frame = objDesktop.getCurrentFrame
-
-Set dispatcher=objServiceManager.CreateInstance("com.sun.star.frame.DispatchHelper")
-
-'Execute the comparison
-Dispatcher.executeDispatch Frame, ".uno:ShowTrackedChanges", "", 0, oPropertyValue
-oPropertyValue(0).Name = "URL"
-oPropertyValue(0).Value = sTheirDoc
-Dispatcher.executeDispatch Frame, ".uno:CompareDocuments", "", 0, oPropertyValue
-
+' extensions: ods;odt;sxw
+'
+' TortoiseSVN Merge script for Open Office Calc files
+'
+' Copyright (C) 2004-2009 the TortoiseSVN team
+' This file is distributed under the same license as TortoiseSVN
+'
+' Last commit by:
+' $Author: tortoisesvn $
+' $Date: 2009-10-18 02:25:24 -0500 (Sun, 18 Oct 2009) $
+' $Rev: 17472 $
+'
+' Authors:
+' Jonathan Ashley, 2007
+' Stefan Küng, 2006, 2009
+'
+dim objArgs,num,sBaseDoc,sMergedDoc,sTheirDoc,sMyDoc,objScript,word,destination
+
+Set objArgs = WScript.Arguments
+num = objArgs.Count
+if num < 4 then
+   MsgBox "Usage: [CScript | WScript] merge-ods.vbs %merged %theirs %mine %base", vbExclamation, "Invalid arguments"
+   WScript.Quit 1
+end if
+
+sMergedDoc=objArgs(0)
+sTheirDoc=objArgs(1)
+sMyDoc=objArgs(2)
+sBaseDoc=objArgs(3)
+
+Set objScript = CreateObject("Scripting.FileSystemObject")
+If objScript.FileExists(sMyDoc) = False Then
+    MsgBox "File " + sMyDoc +" does not exist.  Cannot compare the documents.", vbExclamation, "File not found"
+    Wscript.Quit 1
+End If
+If objScript.FileExists(sTheirDoc) = False Then
+    MsgBox "File " + sTheirDoc +" does not exist.  Cannot compare the documents.", vbExclamation, "File not found"
+    Wscript.Quit 1
+End If
+'remove the file write protection
+objScript.GetFile(sMyDoc).Attributes = objScript.GetFile(sMyDoc).Attributes And Not 1
+objScript.GetFile(sTheirDoc).Attributes = objScript.GetFile(sTheirDoc).Attributes And Not 1
+
+Set objScript = Nothing
+
+On Error Resume Next
+'The service manager is always the starting point
+'If there is no office running then an office is started
+Set objServiceManager= Wscript.CreateObject("com.sun.star.ServiceManager")
+If Err.Number <> 0 Then
+   Wscript.Echo "You must have OpenOffice installed to perform this operation."
+   Wscript.Quit 1
+End If
+
+On Error Goto 0
+'Create the DesktopSet 
+Set objDesktop = objServiceManager.createInstance("com.sun.star.frame.Desktop")
+'Adjust the paths for OO
+sMyDoc=Replace(sMyDoc, "\", "/")
+sMyDoc=Replace(sMyDoc, ":", "|")
+sMyDoc=Replace(sMyDoc, "%", "%25")
+sMyDoc=Replace(sMyDoc, " ", "%20")
+sMyDoc="file:///"&sMyDoc
+sTheirDoc=Replace(sTheirDoc, "\", "/")
+sTheirDoc=Replace(sTheirDoc, ":", "|")
+sTheirDoc=Replace(sTheirDoc, "%", "%25")
+sTheirDoc=Replace(sTheirDoc, " ", "%20")
+sTheirDoc="file:///"&sTheirDoc
+
+'Open the %mine document
+Dim oPropertyValue(0)
+Set oPropertyValue(0) = objServiceManager.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
+oPropertyValue(0).Name = "ShowTrackedChanges"
+oPropertyValue(0).Value = true
+Set objDocument=objDesktop.loadComponentFromURL(sMyDoc,"_blank", 0, oPropertyValue)
+
+'Set the frame
+Set Frame = objDesktop.getCurrentFrame
+
+Set dispatcher=objServiceManager.CreateInstance("com.sun.star.frame.DispatchHelper")
+
+'Execute the comparison
+Dispatcher.executeDispatch Frame, ".uno:ShowTrackedChanges", "", 0, oPropertyValue
+oPropertyValue(0).Name = "URL"
+oPropertyValue(0).Value = sTheirDoc
+Dispatcher.executeDispatch Frame, ".uno:CompareDocuments", "", 0, oPropertyValue
+