Change default SVN diffing tool

前端 未结 10 2215
无人及你
无人及你 2020-12-14 19:55

Following a blog, I created a batch file, wm.bat:

\"d:\\svnroot\\external\\winmerge\\WinMerge.exe\" /B /WAIT \"d:\\svnroot\\external\\winmerge\\WinMergeU.exe         


        
相关标签:
10条回答
  • 2020-12-14 20:06

    Check out this link:

    http://blog.tplus1.com/index.php/2007/08/29/how-to-use-vimdiff-as-the-subversion-diff-tool/

    Here is a copy for SOer's convienience:

    Get this diffwrap.sh script and save it anywhere. I saved mine in my $HOME/bin directory. Make sure to make it executable! I’m showing it below:

    #!/bin/sh
    # Configure your favorite diff program here.
    DIFF="/usr/bin/vimdiff" 
    # Subversion provides the paths we need as the sixth and seventh
    # parameters.
    LEFT="$6"
    RIGHT="$7"
    # Call the diff command (change the following line to make sense for
    # your merge program).
    "$DIFF" "$LEFT" "$RIGHT"
    
    # Return an errorcode of 0 if no differences were detected, 1 if some were.
    # Any other errorcode will be treated as fatal.
    

    Then change your $HOME/.subversion/config file to point at that script:

    [helpers]
    diff-cmd = /home/matt/bin/diffwrap.sh
    

    Then go diff a file!

    0 讨论(0)
  • 2020-12-14 20:08

    Using Cygwin, Subversion (Cygwin's version) and WinDiff requires some care to deal with the latter's intolerance of forward slashes. I use the following Bash script, installed via svn's diff-cmd setting, to get the desired results with 'svn diff':

    arg1=$(echo $6 | sed 's/\//\\/g' | sed 's/\\cygdrive\\c/c:/')
    arg2=$(echo $7 | sed 's/\//\\/g' | sed 's/\\cygdrive\\c/c:/')
    cmd /c windiff.exe $arg1 $arg2
    
    0 讨论(0)
  • 2020-12-14 20:08

    Something similar to the above answers worked for me, but, my particular setup required a bit of customization. Modifications for me were needed to (1) account for the "/tmp" directory in Cygwin, and (2) ensure the "/tmp" file stayed present (hence the "start" is gone from the launch of Meld).

    The below .bat file worked for me with:

    • Cygwin (x64)
    • SVN (command line)
    • Meld
    • Windows 10

    --

    @echo off
    
    set left=%6
    set right=%7
    
    REM Repeat these two lines for all drives
    set left=%left:/cygdrive/d/=d:/%
    set right=%right:/cygdrive/d/=d:/%
    set left=%left:/tmp=c:/cygwin64/tmp%
    set right=%right:/tmp=c:/cygwin64/tmp%
    
    "C:\program files (x86)\meld\Meld.exe" %left% %right%
    
    0 讨论(0)
  • 2020-12-14 20:11

    After creating a batch file that contains a call to your favorite merge program, you can configure Subversion to always use your batch file in Windows (without requiring the --diff-cmd argument on each use) by modifying the line

    # diff-cmd = diff_program (diff, gdiff, etc.)
    

    in the file C:\Documents and Settings\username\Application Data\Subversion\config. This line should be changed to point to your batch file. For example:

    diff-cmd = c:\bin\wm.bat
    
    0 讨论(0)
  • 2020-12-14 20:11

    You need to convert the path to Windows style:

    #!/bin/sh
    
    LEFT="$6"
    RIGHT="$7"
    
    RRIGHT=`cygpath.exe -pw $RIGHT`
    LLEFT=`cygpath.exe -pw $LEFT`
    
    /cygdrive/c/Program\ Files\ \(x86\)/WinMerge/WinMergeU.exe /e /s /ub /dl %3 /dr %5 $LLEFT $RRIGHT
    
    0 讨论(0)
  • 2020-12-14 20:13

    Meld works really great for me. After installing, I went to the Subversion config file, uncommented the diff-cmd line and set it to the path when meld.exe is. In my case:

    [helpers]
    ### ...
    ### Set diff-cmd to the absolute path of your 'diff' program.
    ###   This will override the compile-time default, which is to use
    ###   Subversion's internal diff implementation.
    diff-cmd = D:\SOFT\Meld\meld\meld.exe
    
    0 讨论(0)
提交回复
热议问题