No announcement yet.

compare report in "diff" format?

  • Filter
  • Time
  • Show
Clear All
new posts

  • compare report in "diff" format?

    This may have been asked and answered already, but searching the forums for "diff" returns too many entries...

    I'd like to use BC to generate a folder compare report in Unix "diff" format so that I can feed the file to other tools that understand that format.

    - I want to use BC because I can filter for e.g., "unimportant" before generating output, which will improve s/n ratio

    I understand how to do this from folder compare, but none of the formats (normal, context, unified) seem to match a "normal" unix diff.

    Any suggestions would be much appreciated!

  • #2

    From a Folder Compare, you can issue an Expand All, then Select All Files command from the Edit menu. Then right click and generate a File Report on the select of files. This should launch the Text Compare Report dialog assuming only text files were selected, and you can select Patch as a style. You've tried this with the 3 supported layouts: Normal, Context, and Unified and none meet your needs?

    Which version of Beyond Compare are you running? The latest 4.1.3? I would expect Unified or Normal to be interpreted by your parser. What command line are you using and what errors does it output attempting to apply the patch? If you re-open the patch in BC4 using the Tools menu -> Apply Patch, does this interface load ok?
    Aaron P Scooter Software


    • #3
      Hi Aaron:

      Thanks for the reply. I understand all the bit about generating the compare report (was able to find that in the doc).

      The question is specifically about format, since I'm dealing with some software (ReviewBoard) that is rather picky about the formats it accepts.

      None of the three formats supported by BC are identical to Linux diff format, so I haven't tried feeding it to RB, as I'm fairly sure it will choke, or worse. (RB is actually looking for "svn diff --diff-filename=diff" format, but I assume I can munge the output if I can at least get close to diff format).

      Let me know if you need a sample of Linux diff output, but I imagine you can easily get that yourself.


      • #4
        Beyond Compare's Patch reports generate the same results as the Unix command line "diff". You can see some variance between diff and svn's patch support since the Unified spec only defines the +++ and --- lines. The parsing program should ignore the Header or other metadata. This sounds like a bug in ReviewBoard if it is only able to accept very specific patch files.
        Aaron P Scooter Software


        • #5
          SVN doesn't have a "--diff-filename" switch (at least in 1.8.11). Are you thinking of "--diff-cmd"? SVN uses "diff" by default, so it should produce the same output even if you leave that argument off.

          The --- and +++ lines of the unified patch format are documented as including the name, a tab, and then the file modification times. That's what Beyond Compare and the GNU "diff" command both generate. SVN looks like replaces the file modification times with a textual description of the revision instead. If ReviewBoard fails on that, I'd suggest just stripping off everything after the first tab on any line that begins with either "---" or "+++".

          The only other difference that you're likely to see between the patches generated by BC and the ones generated by the Unix diff is the number of context lines we include around changes. Any reasonable patch parser should handle that variance there, but you can change how many Beyond Compare includes by going into the Options dialog, and on the "Text Editing" panel, decrease the "Number of context lines" setting to 3.
          Zoë P Scooter Software


          • #6
            Hi Zoe:

            You're right -- the svn param is --diff-cmd (RB param is --diff-filename).

            You're also right that RB is quite picky about what it accepts -- unfortunately there's nothing I can do about that and I don't expect that to change (there's a lot of complaining about that on the net).

            I'll try hacking on the BC output to see if I can come up with something that RB will accept, and I'll post back if I find something that works.

            Thanks for your help!