No announcement yet.

Moved lines and Alignment on File comparsion.

  • Filter
  • Time
  • Show
Clear All
new posts

  • Moved lines and Alignment on File comparsion.

    Is there any option to complete ignore lines which have been merely moved?

    For example, Visual Studio (2003) Form designer automatically generates a lot of code relating to the form's controls. Whenever a change is made to the control, it re-generates this section which can quite often be in a completely different order. Unfortunately it also sometimes decide to change the position of the controls slightly resulting in the controls driftly slightly out of alignment.
    Correcting this using Beyond Compare is usually very straight forward, except when VS has moved all the lines around.

    I have tried changing the alignment options in the viewer, but this does not seem to help. I am not sure whether this could be because there is no large section of un-changed code, because maybe every tenth line has been amended (as well as being moved)

    Does this make sense and is should Beyond Compare cope with this?



  • #2
    Re: Moved lines and Alignment on File comparsion.

    Hello Stephen,

    Beyond Compare doesn't currently detect moved lines. If the lines are out of order, it will only see a difference. Moved line detection is something we're considering for the future.

    Right now your best option is probably to use something to preformat the code into a standard order. This is what our HTML Tidy/XML Tidy Rule does, as does our Jalopy - Java Source Code Formatter rule.

    Both rules are on our Additional Rules page:

    If you can find a program to standardize the formatting of the text you want to compare, you can configure it to be called by BC before the text is opened for comparison in the File Viewer. Details are in the Rules>File Conversion Rules section of Beyond Compare's help file.
    Chris K Scooter Software


    • #3
      Sorry for bumping an old post. Did anything ever happen about this? I have the exact same scenario, VS Designer moved lots of code blocks around and removed the event handers, I want to try and diff them to put them back!


      • #4
        We still handle it similarly as before, and have added a few additional conversion processes to our list:

        and have a KB article on how to handle it with a custom solution (example: RESX files) here:
        Aaron P Scooter Software


        • #5
          Can I please check whether this is still in effect i.e. I still need to sort the files before comparing them? If so, I think this has effectively eliminated Beyond Compare (which I think is excellent in many ways) from consideration as a comparison/merge tool for use with Visual Studio for the same reason as the OP i.e. Visual Studio often rearranges the order of the form controls and we need to identify if anything has actually been added or removed and then be able to add the missing lines. I will do some testing to see if the sort works under these circumstances, but I for one would be very keen to see this feature added.


          • #6
            The behavior hasn't changed. Beyond Compare doesn't detect moved sections, it will show them as differences.

            The only workaround is still as described previously, use a file format to sort the text of the file before comparison.
            Chris K Scooter Software