Announcement

Collapse
No announcement yet.

How to define minor differences for Java?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to define minor differences for Java?

    First apologies, if this question has already been covered, but the site's search revealed not a single hit for my misc. keywords.

    I was trying to adapt the rule for "minor differences" for Java.
    Our versioning system replaces certain specifically formatted lines in the header comment with the data and time of the check-in (and - alas - injects the current time when checking them out) and so BC always shows me ALL files as being different after fetching them from the repository.

    I need to filter changes in those lines from being regarded as changes, i.e. if two files only differ in that timestamp they should be regards as "equal" (or rather: as having only "minor" differences, so that I can filter them from being displayed as having changes).

    I recall that I had once defined these lines to be ignored in an earlier version of BC (using some regexp(-like) expression), but since version 4 these setting seems to be hidden in some "Java source" syntax description for which I found no instructions how to locate and adapt those. Can you give me a hint or pointer, how and where to achieve the above goal?

    Michael

  • #2
    Hello,

    You'll want to follow this guide/video:
    http://www.scootersoftware.com/suppo..._unimportantv3

    It is a similar process to BC3. First, you customize the Java format to define this versioning text. Is it always the first line of the file? If so, the Lines grammar type would work well. Otherwise, a Basic regular expression.

    Once the grammar matches on just this line, you alter the Session Setting Defaults to mark this grammar as Unimportant. From then on, a Rules-based scan in the Folder Compare uses the Session Setting Defaults for the grammar, and would ignore appropriately.
    Aaron P Scooter Software

    Comment


    • #3
      For some reason that does not seem to work, if I define the basic file format as "Java source" (it works, when defining the format as Text, but I think Java source is more appropriate here).
      Those lines that I want to mask read e.g.:
      // Generated on: 2014.12.01 at 11:25:17 AM CET

      So I defined an ": Unimportant text" regexp: ^//Generated on: \d\d\d\d\.\d\d\.\d\d at \d\d\:\d\d\:\d\d .*$
      But for some reason that doesn't engage and both sides still show the diffs in red

      Any idea?

      M.

      Comment


      • #4
        What do you mean by "it works when defining the format as text"? It works if you put the grammar element within the default text format, but not the java format? That would seem to indicate that your files are not opening in the Java format, but rather the <default> format. The determining factor for which format is used is the file extension. The topmost file extension match in the Tools menu -> File Formats dialog is the format used automatically. If your files are java code, but have an extension of .txt, then it would open in the default format for example.

        We display the detected format name in the top status bar of each pane. Is the format you defined the grammar the one that is used here?

        If so, then double check that the grammar is detected correctly by clicking the blinking cursor into the text pattern (in between 2 of the numbers). We then display the detected grammar element the cursor resides in in the bottom status bar of each pane. Does this detect your grammar correctly?

        If you are still having any trouble, please feel free to email into support@scootersoftware.com with:
        1) A full screen screenshot
        2) A pair of sample files
        3) Your BCSupport.zip from the Help menu -> Support dialog, Export
        4) A link back to this forum thread for our reference.
        Aaron P Scooter Software

        Comment

        Working...
        X