// -*- ASCII:EDT -*- // RCScompare.edt // compare a file with its // previous version within WinEdt // (schlicht 20010720) //////////////////////////////// IfFileExists("%b\Config\RCS\RCSconf.edt",> "Exe('%b\Config\RCS\RCSconf.edt');",> !"// You only have to adjust these settings, if you are using this file as a stand-alone macro. <> // If you use it is a part of the RCS menu, edit the file %b\Config\RCS\RCSconf.edt instead! // -- the path to the RCS system: Assign('RCSpath','%@(|ProgramFiles|);\Componentsoftware\CS-RCS\system\');> // -- the main executable: Assign('RCSexe','%$(|RCSpath|);csrcs.exe');> // -- the diff program Assign('RCSdiffexe','%$(|RCSpath|);csdiff.exe');> // the path for temporary files Assign('RCStempPath','%b\Config\RCS\temp');> // -- the command to retrieve the previous version of the file 'RCSfile' into the directory 'RCStempPath': Assign('RCSret',`%$('RCSexe'); ret /q /a""%$('RCStempPath');\"" ""%%$('RCSfile');""`);> // CSdiff 3.0: //Assign('RCSdiff',`%$('RCSdiffexe'); /q /T""%%$('RCSdiffresult');"" ""%%$('RCSfile1');"" ""%%$('RCSfile2');""`);> // CSdiff 4.0: Assign('RCSdiff',`%$('RCSdiffexe'); /q /Od""%%$('RCSdiffresult');"" ""%%$('RCSfile1');"" ""%%$('RCSfile2');""`);> "); StartWorking("comparing..."); Assign("diffFilePath","%p"); Assign("diffFile","%n%t"); // Retrieve old version: Assign("RCSfile","%$('diffFilePath');\%$('diffFile');"); IfFileExists("%$('RCStempPath');\","","CreateFolders('%$(|RCStempPath|);\',1);"); Do(*WinExe("",`%$("RCSret");`,"","",011100);*); IfOK("","Prompt('Could not retrieve previous version!');"); IfFileExists("%$('RCStempPath');\%$('diffFile');","",> "Prompt('File %$(|diffFile|); is not in the repository.'); Exit;"); // Check if files are different: Assign("RCSfile1","%$('RCStempPath');\%$('diffFile');"); Assign("RCSfile2","%$('diffFilePath');\%$('diffFile');"); Assign("RCSdiffresult","%$('RCStempPath');\%$('diffFile');.d$$"); Do(*WinExe("",`%$("RCSdiff");`,"%p","",011100);*); IfOK("","Prompt('Could not compare with previous version!');"); IfFileExists("%$('RCSdiffresult');",> !"DeleteFile('%$(|RCSdiffresult|);');",> !"Prompt('File %$(|diffFile|); is not modified.');Exit;"); StopWorking; // Compare them: SetTracking(0); CMD("Minimize All"); Open("%$('RCStempPath');\%$('diffFile');",1,1,-1); CMD("Go To Beginning Of File"); Open("%$('diffFilePath');\%$('diffFile');",0,1); CMD("Go To Beginning Of File"); CMD("Tile Horizontally"); //CMD("Tile Vertically"); SetTracking(1); CMD("Compare Documents..."); CMD("Next Difference"); End; // ---------------------------------------------------------------------------- This macro will compare a document to its last version within WinEdt. It will retrieve the previous version from the RCS repository, arrange the two files and let WinEdt compare them. You can then browse through the differences using CTRL-F3 (the default shortcut for "Search | Next Difference..."). The two files will be arranged horizontally. If you prefer it vertically, you can make the obvious change a couple of lines above. If you are not using this macro as a part of the RCS menu, you might have to adjust the commands at the beginning of the file. R Schlicht // ---------------------------------------------------------------------------- $Id: RCScompare.edt,v 1.5 2004-12-24 04:42:55+01 schlicht Exp schlicht $