Announcement

Collapse
No announcement yet.

Replacements not working

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

  • Replacements not working

    I've defined a text replacements that should be applied to Java files, when opening two files for comparison I don't see the replacements being applied.

    The replacement is defined as:
    Text to find: \$Id:[^$]*\$
    Replace with: $Id:$
    Match character case: true
    Regular expression: true
    Side: Left

    A file has the text appearing like this:
    /*
    * $Id: File.java 0000 2009-01-01 01:01:01Z username $
    */

    What other settings do I need to apply to have the text replacement occur when opening the files for comparison, or am I misunderstanding how this feature works. Thanks.

    BC Pro: 3.1.7 (build 10865)

  • #2
    Hello,

    The BC3 Pro Feature Text Replacements replaces equality of the text without actually changing text.

    This way you can mark
    IDversion3 <=> IDversion4
    as unimportant when those two are aligned, but not mark IDversion3 or IDversion4 as unimportant in any other case.

    If you are looking to replace text in a pane of BC3, you can use the Find or Replace Dialogs (Under the Search menu). You can also define a custom external conversion to perform a command line action on the file before opening it. Here is a KB article showing an example of how to set that up:
    http://www.scootersoftware.com/suppo...conversion.php
    Aaron P Scooter Software

    Comment


    • #3
      If it changes equality of text, would defining the same rule for both the left and right side mark the line as not different at all? I really want the text to not even show as unimportant?

      Comment


      • #4
        To show the text as equal, the first step is to define it as unimportant. Then toggle on the Ignore Unimportant Differences option (which hides blue/unimportant text as black/equal text).

        If the line on a whole is Unimportant, you can define it as such following this KB article:
        http://www.scootersoftware.com/suppo...mportantv3.php

        If you define a replacement in both directions, that would do it too, but Replacements are generally used when you want to ignore a specific change you define. To ignore it in more general cases, you can simply mark it as Unimportant.
        Aaron P Scooter Software

        Comment


        • #5
          Thank you for the tips. I was able to use them to mark the text an unimportant. However, as I typically want to see other unimportant changes I ultimately went with custom external conversion. This approach allowed me in a folder compare to easily see which files merged correctly with only SVN keyword differences versus those files that had some meaningful change. In the future it would be great to have an "ignored text" option built in for these simple kinds of rules.

          Comment


          • #6
            You can ignore unimportant text from the Folder Compare. First, make sure the unimportant text is blue when the file is viewed. Then toggle on Ignore Unimportant Differences to hide that text. From the Folder Compare, under the Session Settings: Comparison, use the Rules-based content comparison. Then in the Folder Compare, make use Ignore Unimportant Differences is also toggled on. This is mark files that contain only Unimportant differences as equal.
            Aaron P Scooter Software

            Comment


            • #7
              I believe DanielR's suggestion is to have options (similar to the Session Settings Importance tab) to ignore specific grammar and text elements instead of ignoring all unimportant differences or none at all.

              This could be done via a new Session Settings "Ignore" tab, or it could be controlled via an extra set of checkboxes on the current Importance tab (one checkbox for the importance flag and another for the ignore flag on every element).
              BC v4.0.7 build 19761
              ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

              Comment


              • #8
                Thanks, but I'm not sure I follow your suggestion, Michael. If a user wants to Ignore it on a Session specific basis, then they can set it as Unimportant for that session. That is why they are session specific now, instead of global like BC2.
                Or are you suggesting a new third level of Important (Red), Unimportant (Blue, and Ignored (Always Black)?

                If that is the case, DanielR, do you need a third level for the purposes of the comparison or for coloring? My suggestion would be to mark the unimportant you still want to see as Important (since you consider them important to the comparison in this case) for this Session. If you would like to alter the colors of specific grammar elements, you can do that in the Tools menu -> Options, Files Views, Display. You can enable a tweak to retain syntax highlighting in difference sections in the Tweaks dialog (Ctrl+Shift+T, Text Views).

                Do these tools help with your current workflow (along with your external conversion)?
                Aaron P Scooter Software

                Comment


                • #9
                  Originally posted by Aaron View Post
                  Or are you suggesting a new third level of Important (Red), Unimportant (Blue, and Ignored (Always Black)?
                  Exactly, that was my interpretation of Daniel's request... that some elements could simply be ignored (remain black) while other elements will show up as unimportant (blue) or important (red).

                  Frankly, I like the idea... especially for formats where you have elements (such as version/date stamps) that you never want to highlight... but stiill do want the ability to use the ignore unimportant toggle for other elements such as comments and mod-log entries.
                  BC v4.0.7 build 19761
                  ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

                  Comment


                  • #10
                    Thanks for the suggestion, Michael. I've created a wishlist entry.
                    Aaron P Scooter Software

                    Comment

                    Working...
                    X