Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Source Control
#8
Thanks.

I decided to go a different direction with this because all I really needed was a clean way to do a diff between versions. I have this working in two different source control applications (git and SourceGear Vault). The basic idea is to use the unix 'strings' command to create text files as input into the diff engines.

With git it's very easy - I had installed git with cygwin and thus had access to 'strings' from the bash command shell. There are pretty good instructions at this URL: http://git-scm.com/book/en/Customizing-G...Attributes. See how they configure the .gitattributes and .git/config file for Word *.doc files - I just did the same with *.qml files. When you enter
git diff
it will show you the differences in the file from the last checkin. It also shows a number of control characters and integer offset differences - but in general it's pretty easy to read.

SourceGear's Vault needed a few extra steps.
  • Install a Windows version of strings:http://technet.microsoft.com/en-us/sysin...97439.aspx
    Create a small batch file qmldiff.bat (source below). Put it in c:\<dirname>. Also create c:\<dirname>\temp. Put the downloaded strings.exe into c:\<dirname>
    In the tools/options menu replace with the default value of "Program:" with
    Code:
    Copy      Help
    c:\<dirname>\qmldiff.bat
    and the Arguments: with
    Code:
    Copy      Help
    "%LEFT_PATH%" "%RIGHT_PATH%"  "%LEFT_LABEL%"  "%RIGHT_LABEL%"

At this point you should be able to show differences in Vault as if it was standard text source code. There will be some of the control characters and offsets displayed in the code but it does show the differences in source very clearly.

Source of qmldiff.bat
Code:
Copy      Help
@echo off
set UTILDIR= c:\<dirname>
REM echo utildir is %UTILDIR%


set TEMPDIR= %UTILDIR%\temp
set TEMPFILE1= %TEMPDIR%\left.txt
set TEMPFILE2= %TEMPDIR%\right.txt
dir %TEMPDIR%
del %TEMPDIR%\*.txt

%UTILDIR%\strings.exe %1 >  %TEMPFILE1%
%UTILDIR%\strings.exe %2 >  %TEMPFILE2%
"c:\Program Files (x86)\SourceGear\Vault Client\sgdm.exe"  /ro1 /ro2 /title1:%3 /title2:%4  %TEMPFILE1% %TEMPFILE2%

I could make the batch file more robust creating directories and doing some error trapping - but this worked for me.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)