No announcement yet.

Autocompare showing detailed text differences

  • Filter
  • Time
  • Show
Clear All
new posts

  • Autocompare showing detailed text differences

    We have deployed an application in our test environment and in our production environment with a few thousand files. For most of the files (Java class files, voice binaries, etc.), a simple CRC comparison is enough, and I know how to make that work.

    However, there are some text files that have normal differences because of varying environmental configurations. For instance, I want to compare all the *.properties and *.jsp files in the two environments and (since I know some MUST be different) see the actual text differences between the files. The time stamps and sizes and CRCs of the files are irrelevant because I need to see the ACTUAL TEXT differences between the left and right files. If the left and right files are the same, a line in the output file saying that they are the same is sufficient -- or nothing for all.

    For example, if the file in the system test environment has a line that reads "\logs\test\flatfile.txt" and the in the production environment has a line that reads "\logs\prod\flatfile.txt", I know that this is a valid difference. When I see it in the output file, I will disregard it. But if other text differences for these two files show in the output file, I have a discrepancy I need to repair.

    I want to completely automate this process. The list of differences should go into to a text file, interleaved. I absolutely do NOT want to do this by running the GUI because that takes too much time. Also, the output file is something I can include in my online release notes to show the exact differences between test and production environments.

  • #2

    You can generate a Text-report on a multi-file selection of different files, and only show difference text. This can be done in script to make it an automated process

    I would suggest first working with the graphical interface. Use a Folder Compare session, and select multiple files (you can use an Expand All command, then a Display filter to limit the show files to All, Only Differences, etc, then the Select All Files command). Then go to the Actions menu -> File Comparison Report. There are several report types here, with various options. Once you have found the report style and configuration you would like to use, you can generate a script file that uses the same settings.

    Scripting reference is available in the Help file under Scripting Reference, or under Using Beyond Compare -> Automating with Script. Each script command mirrors actions taken in the graphical interface, so basic script would still need to execute an "expand all" command in order to select files in subfolders.

    Let us know if you have any questions, or need any help with specific script (and which report you want to generate).
    Aaron P Scooter Software


    • #3
      How to?

      Thank you for the reply, but I still have the problem.

      While I'm sure it's possible to do what you say, the Help does not explain how, or it's buried so deeply in Help that I wasn't able to find it. I looked high and low for at least an hour before giving up and coming to this forum instead.

      As for using the GUI -- that's easy and intuitive. I'd already done it. It's not what I need. I need a fully automated solution, run from the command line. Using the GUI wasn't any help.

      Here's my .bat file:
      BCompare.exe "@.\ntbeawd00_sysivr1.P06_prdivr2.txt"

      Here's a version of the text file it references:
      filter "*.properties"
      load \\server1\fullpath \\server2\fullpath
      compare binary
      expand all
      folder-report layout:side-by-side options:display-all output-to:.\report3.txt
      text-report layout:interleaved options:display-all output-to:.\report4.txt

      report4.txt, which I would expect to show the text differences between the two sets of properties files, shows no differences -- and there are differences. I'm obviously doing something wrong.


      • #4
        Spoke too soon

        I see that you suggest generating a script file from the GUI.
        I'll try that and let you know how that works.
        Thank you for the suggestion. It's a good one.
        I somehow overlooked it until I re-read your reply.


        • #5
          No success

          I'm about ready to give up and write some code to do this instead. There's something missing from the file that specifies all the commands. See the earlier post in this thread, where all this stuff is documented. If the GUI does it, I'm sure the scripting will. But when I
          Session > Save Session As
          and save it, it's nowhere to be found -- not in the BeyondCompare directory, not on the servers where the compared files are kept. At least the folder compare report lets me specify where to put it. But where on this planet is the "Root" for the session? Isn't the session where I'm supposed to find the commands I need?


          • #6

            We don't have the ability to generate a script from the GUI. My suggestion was to use the GUI first (which is sounds like you have done) to generate the type of report you want. Once you can do this, writing the script is easier since you know the variables you want to set.

            There are a few issues with your current script:
            The Compare command works on the selection. You want to use the criteria command to set the comparison criteria in general. You should put the criteria command before the load command (since the load triggers the comparison, setting the criteria before the load compares the files once instead of twice).
            You do not need to generate a Folder-report, unless you want a general report of the filenames.
            The text (or file-report) works on the selection, so you need to use the select command before calling it. The selected files are then used to generate the report.
            Lastly, your current filter string would show only *.properties files. Is this intentional, or did you want to hide all .properties files? If you wanted to hide them, the filter would be "-*.properties"

            So your script should look something like this:
            filter "*.properties"
            criteria binary
            load \\server1\fullpath \\server2\fullpath
            expand all
            select newer.files older.files diff.files
            text-report layout:interleaved options:display-all output-to:c:\folder\report4.txt
            How does that work for you?
            Aaron P Scooter Software


            • #7

              Thank you.
              This is what appeared to do the trick:
              select newer.files older.files diff.files

              The only thing I need to do now is to get rid of all the extra text -- e.g. I only want line 35, instead of all the lines:
              ... [lines 1 - 34]
              34 34 #the absolute path since we don't want to lose log files to a redeployment
              35 FlatFileLocation = F:\\logs\\ivr\\prdivr2\\FlatFile\\AquilaFlatFile.t xt
              35 FlatFileLocation = F:\\logs\\ivr\\sysivr1\\FlatFile\\AquilaFlatFile.t xt
              36 36
              ... [lines 36 - end]

              As soon as I get that figured out, I'm done.

              Thanks for the help.


              • #8
                Got it

                The "display-mismatches" did the trick for me.

                I do need to figure out how to exclude old folders -- but it's time I cleaned them up anyway, and that will take care of that problem.

                This will save me a lot of time.