Using BC4 OSX with Version Control Systems

Collapse
This topic is closed.
X
This is a sticky topic.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Aaron
    Team Scooter
    • Oct 2007
    • 15941

    Using BC4 OSX with Version Control Systems

    Hello and welcome to the BC4 Alpha. We have noticed many of you have begun to incorporate BC4 into your daily work, which includes configuring BC4 for a variety of version control software. We will try to collect and document successful settings here in this forum thread.

    The first step is to launch Beyond Compare, go to the Beyond Compare menu and run "Install Command Line Tools". This will install the necessary bcompare and bcomp scripts needed for many source control solutions.

    Our current Windows and Linux documentation can be found here:
    http://www.scootersoftware.com/support.php?zz=kb_vcs

    If you are using Beyond Compare 4 for Mac as an external diff or merge tool for an application, please feel free to share your configuration in the forum. Once we see the thread, we'll incorporate it into this sticky thread.

    We may not be able to test all of these configurations, so please proceed with caution. BC4 is still an Alpha product and has not been tested with all of the following configurations.
    Aaron P Scooter Software
  • Aaron
    Team Scooter
    • Oct 2007
    • 15941

    #2
    Git

    Code:
    [diff]
        tool = bcomp
    [difftool]
        prompt = false
    [difftool "bcomp"]
        trustExitCode = true
        cmd = "/usr/local/bin/bcomp" "$LOCAL" "$REMOTE"
    [merge]
        tool = bcomp
    [mergetool]
        prompt = false
    [mergetool "bcomp"]
        trustExitCode = true
        cmd = "/usr/local/bin/bcomp" "$LOCAL" "$REMOTE" "$BASE" "$MERGED"
    Reference: http://www.scootersoftware.com/vbull...ad.php?t=11666
    Aaron P Scooter Software

    Comment

    • Aaron
      Team Scooter
      • Oct 2007
      • 15941

      #3
      Cornerstone SVN

      In Cornerstone, you can specify a custom external compare script.

      1) Launch Beyond Compare, go to the Beyond Compare menu and run "Install Command Line Tools"

      DIFF:
      Create an AppleScript wrapper for use by Cornerstone
      Here's the Diff script code:
      Code:
      -- Cornerstone executes the script as:
      --	/path/to/tool <original> <modified>
      --
      on run argv
      	do shell script "/usr/local/bin/bcomp \"" & item 1 of argv & "\" \"" & item 2 of argv & "\""
      end run
      Set in General section of Preferences, External compare tool, Other Script...

      Reference: http://www.scootersoftware.com/vbull...ad.php?t=11689
      Aaron P Scooter Software

      Comment

      • Aaron
        Team Scooter
        • Oct 2007
        • 15941

        #4
        Mercurial 2.4.2

        Code:
        [ui]
        merge = bcomp
        
        [extensions]
        extdiff =
        
        [extdiff]
        cmd.bcomp = /usr/local/bin/bcomp
        #opts.bcomp = -ro
        
        [merge-tools]
        bcomp.executable = /usr/local/bin/bcomp
        bcomp.args = $local $other $base $output
        bcomp.priority = 1
        bcomp.premerge = True
        bcomp.gui = True
        Reference: http://www.scootersoftware.com/vbull...ad.php?t=11693
        Aaron P Scooter Software

        Comment

        • Aaron
          Team Scooter
          • Oct 2007
          • 15941

          #5
          SourceTree

          Use the Beyond Compare menu -> Install Command Line Tools. Then:

          Code:
          Visual Diff Tool: Other
          Diff Command:/usr/local/bin/bcomp
          Parameters:-ro $LOCAL $REMOTE
          Merge Tool: Other
          Merge Command:/usr/local/bin/bcomp
          Paramters:$LOCAL $REMOTE $BASE $MERGED
          Reference: http://www.scootersoftware.com/vbull...ad.php?t=11695
          Last edited by Aaron; 05-Feb-2014, 10:34 AM. Reason: Adding -ro for diff
          Aaron P Scooter Software

          Comment

          • Aaron
            Team Scooter
            • Oct 2007
            • 15941

            #6
            Syncovery Mac:

            The first step is to launch Beyond Compare, go to the Beyond Compare menu and run "Install Command Line Tools"

            Then to configure Syncovery -

            1. Select menu Syncovery/Preferences...

            2. Click the Misc tab

            3. In the field Program used to compare files from the Sync Preview, write "/usr/local/bin/bcompare" (or the pathname given when using BC4's Install Command Line Tools)

            4. Click Close

            Reference: http://www.scootersoftware.com/vbull...ad.php?t=11673
            Aaron P Scooter Software

            Comment

            • Aaron
              Team Scooter
              • Oct 2007
              • 15941

              #7
              IntelliJ IDEA 12: (Potentially also: RubyMine, Webstorm, PyCharm, PhpStorm)

              The first step is to launch Beyond Compare, go to the Beyond Compare menu and run "Install Command Line Tools"

              In IntelliJ's Settings dialog, under IDE Settings, select the External Diff Tools section:

              Compare folders
              Path to executable: /usr/local/bin/bcomp

              Compare files
              Path to executable: /usr/local/bin/bcomp

              Merge tool
              Path to executable: /usr/local/bin/bcomp
              Parameters: %1 %3 %2 %4

              Reference: http://www.scootersoftware.com/vbull...ad.php?t=11824
              Also: http://www.scootersoftware.com/vbull...ad.php?t=12232
              Last edited by Aaron; 09-Aug-2013, 02:27 PM. Reason: Update: additional, similar programs
              Aaron P Scooter Software

              Comment

              • Aaron
                Team Scooter
                • Oct 2007
                • 15941

                #8
                Tower (Git):

                1. Close Tower and BC4

                2. Create the plist file ~/Library/Application Support/Tower/CompareTools.plist

                Code:
                <?xml version="1.0" encoding="UTF-8"?>
                <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
                <plist version="1.0">
                <array>
                	<dict>
                		<key>ApplicationIdentifier</key>
                		<string>com.ScooterSoftware.BeyondCompare</string>
                		<key>ApplicationName</key>
                		<string>BeyondCompare</string>
                		<key>DisplayName</key>
                		<string>Beyond Compare</string>
                		<key>LaunchScript</key>
                		<string>beyondcompare.sh</string>
                		<key>Identifier</key>
                		<string>BeyondCompare</string>
                		<key>SupportsMergeTool</key>
                		<true/>
                	</dict>
                </array>
                </plist>
                3. Create the shell script file ~/Library/Application Support/Tower/CompareScripts/beyondcompare.sh and chmod +x it

                Code:
                #!/bin/sh
                
                /usr/local/bin/bcomp "$1" "$2" "$3" "$4"
                4. Select Beyond Compare as your merge/diff tool in Tower's preference.


                Reference: http://www.scootersoftware.com/vbull...ad.php?t=12472


                ALTERNATE:
                Code:
                #!/bin/sh
                
                LOCAL="$1"
                REMOTE="$2"
                
                # Sanitize LOCAL path
                if [[ ! "$LOCAL" =~ ^/ ]]; then
                	LOCAL=$(echo "$LOCAL" | sed -e 's/^\.\///')
                	LOCAL="$PWD/$LOCAL"
                fi
                
                # Sanitize REMOTE path
                if [[ ! "$REMOTE" =~ ^/ ]]; then
                	REMOTE=$(echo "$REMOTE" | sed -e 's/^\.\///')
                	REMOTE="$PWD/$REMOTE"
                fi
                
                MERGING="$4"
                BACKUP="/tmp/$(date +"%Y%d%m%H%M%S")"
                
                BCOMP=`which bcomp`
                BCOMPARE=`which bcompare`
                
                if [ ! $BCOMP > /dev/null ] ; then
                  if [ -e '/usr/local/bin/bcomp' ] ; then
                    BCOMP='/usr/local/bin/bcomp'
                  fi
                fi
                
                if [ ! -x "$BCOMP" ]; then    
                  echo "Beyond Compares's command line tool 'bcomp' could not be found. Please make sure it has been installed in /usr/local/bin/." >&2
                  exit 128
                fi
                
                if [ -n "$MERGING" ]; then
                  BASE="$3"
                  MERGE="$4"
                
                  # Sanitize BASE path
                  if [[ ! "$BASE" =~ ^/ ]]; then
                    BASE=$(echo "$BASE" | sed -e 's/^\.\///')
                    BASE="$PWD/$BASE"
                
                    if [ ! -f "$BASE" ]; then
                      BASE=/dev/null
                    fi
                  fi
                
                  # Sanitize MERGE path
                  if [[ ! "$MERGE" =~ ^/ ]]; then
                    MERGE=$(echo "$MERGE" | sed -e 's/^\.\///')
                    MERGE="$PWD/$MERGE"
                
                    if [ ! -f "$MERGE" ]; then
                      # For conflict "Both Added", Git does not pass the merge param correctly in current versions
                      MERGE=$(echo "$LOCAL" | sed -e 's/\.LOCAL\.[0-9]*//')
                    fi
                  fi
                
                  sleep 1 # required to create different modification timestamp
                  touch "$BACKUP"
                  
                  "$BCOMP" -ro1 -ro2 -title1="HEAD - $LOCAL" -title2="Merging in - $REMOTE" -title3="Base - $BASE" "$LOCAL" "$REMOTE" "$BASE" "$MERGE"
                else
                  MERGE="$3"
                
                  if [ -n "$MERGE" ]; then
                      #"$BCOMP" -ro1 -ro2 -title1="Remote - $REMOTE" -title2 "Local - $LOCAL" -title3 "Base - $MERGE" "$REMOTE" "$LOCAL" "$MERGE"
                      #"$BCOMP" -ro1 -ro2 "$REMOTE" "$LOCAL" "$MERGE"
                      "$BCOMP" -vcs1="$MERGE" -ro1 -title1="Local - $LOCAL" -title2="Remote - $MERGE" "$LOCAL" "$REMOTE"
                  else
                      "$BCOMP" -ro1 -title1="Local - $LOCAL" -title2="Remote - $REMOTE" "$LOCAL" "$REMOTE"
                  fi  
                fi
                
                if [ -n "$MERGING" ]; then
                  # Check if the merged file has changed
                  if [ "$MERGE" -ot "$BACKUP" ]; then
                    exit 1
                  fi
                fi
                
                exit 0
                Reference: http://www.scootersoftware.com/vbull...ad.php?t=12472
                Last edited by Aaron; 27-Oct-2014, 09:31 AM. Reason: Update: Reference. CompareToolts.plist -> CompareTools.plist
                Aaron P Scooter Software

                Comment

                • Aaron
                  Team Scooter
                  • Oct 2007
                  • 15941

                  #9
                  Perforce (OSX):

                  1) Launch Beyond Compare, go to the Beyond Compare menu and run "Install Command Line Tools"

                  2) In the Perforce Preferences dialog, go to the Diff section and select "Other application".
                  Set Location to:
                  Code:
                  /usr/local/bin/bcomp
                  and Arguments to:
                  Code:
                  %1 %2
                  Reference: http://www.scootersoftware.com/vbull...ad.php?t=12930
                  Aaron P Scooter Software

                  Comment

                  • Aaron
                    Team Scooter
                    • Oct 2007
                    • 15941

                    #10
                    Subversion (OSX):

                    1) Launch Beyond Compare, go to the Beyond Compare menu and run "Install Command Line Tools"

                    Diff:

                    Create a file named /usr/bin/bcdiff.sh and allow execute permissions (chmod +x). Add the following line:
                    /usr/bin/bcomp "$6" "$7" -title1="$3" -title2="$5" -readonly
                    exit 0

                    Edit "$HOME/.subversion/config" and add the line "diff-cmd = /usr/bin/bcdiff.sh" in [Helpers].

                    Merge:

                    Create a file named /usr/bin/bcmerge.sh and allow execute permissions (chmod +x). Add the following line:
                    /usr/bin/bcomp "$2" "$3" "$1" "$4"

                    Edit "$HOME/.subversion/config" and add the line "merge-tool-cmd = /usr/bin/bcmerge.sh" in [Helpers].

                    Reference: http://www.scootersoftware.com/vbull...ad.php?t=13168
                    Aaron P Scooter Software

                    Comment

                    • Aaron
                      Team Scooter
                      • Oct 2007
                      • 15941

                      #11
                      Eclipse and Team Explorer Everywhere (OSX):

                      Under Eclipse's Preferences: Team | Team Foundation Server | Compare Tools
                      Add "File Types" of * and type a "Command" of /usr/local/bin/bcomp -ro1 %1 %2

                      Do not Browse to bcomp, as in OSX Eclipse (Juno) this will instead auto-populate with: "/Applications/Beyond Compare.app/Contents/MacOS/bcomp", which does not work.

                      Reference: http://www.scootersoftware.com/vbull...rer-Everywhere
                      Aaron P Scooter Software

                      Comment

                      • Aaron
                        Team Scooter
                        • Oct 2007
                        • 15941

                        #12
                        SmartCVS (OSX):

                        1. Install Command Line Tools using Beyond Compare Menu.

                        2. Open Preferences of SmartCVS and go to File Comparisons Section.

                        3. Click - Add / Edit the existing comparison with pattern “*"
                        Use File Pattern “*"
                        Select External Comparison
                        Command: /usr/local/bin/bcomp
                        Arguments: ${leftFile} ${rightFile}

                        4. Click Ok

                        Reference: Email
                        Aaron P Scooter Software

                        Comment

                        • Aaron
                          Team Scooter
                          • Oct 2007
                          • 15941

                          #13
                          Android Studio (OSX):

                          1. Install Command Line Tools using the Beyond Compare menu.

                          2. In ADJ, go to the main menu -> Android Studio/Preferences. Under IDE Settings, select External Diff Tools.

                          3. Compare folders:
                          Path to executable: /usr/local/bin/bcomp

                          Compare files:
                          Path to executable: /usr/local/bin/bcomp

                          Merge tool:
                          Path to executable: /usr/local/bin/bcomp
                          Parameters: %1 %3 %2 %4

                          Reference: email
                          Aaron P Scooter Software

                          Comment

                          Working...