Announcement

Collapse
No announcement yet.

Wishlist: Easy way to ignore text in comparison

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

  • Wishlist: Easy way to ignore text in comparison

    I would like an easier way to mark text to be ignored when doing a comparison.

    For example I sometimes compare log files from running systems, and I would like to see how sucessive runs are different, however in the log files, every line has a timestamp, so I need a way to exclude it from the comparison.

    I know that it is possible to do this sort of thing with a grammar, but the whole user interface do to that is quite confusing, and not realy suited to an ad-hoc comparison.

    What I would like is a feature where I can highlight the timestamp and get a context menu that says "Exclude from comparison ..." which would lead to a dialog box with choices such as excluding the first 20 chars of each line, text matching a regular expresson, or the like.

  • #2
    You can ignore differences in an entire selected line using the right click "Ignored" command.

    BC4 also adds an ad-hoc definition of unimportant text. In the Text Compare, select "Session > Session Settings" or click on the Rules toolbar button. Go to the Importance tab. In the Unimportance section, click +. Add a word or regular expression matching the text you want unimportant. This setting is session specific, so it doesn't affect the grammar of the files you have loaded.
    Chris K Scooter Software

    Comment


    • #3
      Here is a RegEx for ignoring carriage returns around curly brackets (since they're shown as "important" changes by default):

      Code:
      (^|$|\s)?({|})(^|$|\s)?
      For example:

      In the following code segment, if one applies formatting / styling to a file for readability preferring same-line curly braces

      Code:
      if (string.IsNullOrEmpty(arguments)) 
      {
      control = this.LoadControl("~/UserControls/Panels/" + uc.UserControl , id.ToString() , loc.ToString());
      } else {
      control = this.LoadControl("~/UserControls/Panels/" + uc.UserControl , id.ToString() , loc.ToString() , arguments);
      }

      To


      Code:
      if (string.IsNullOrEmpty(arguments2)) {
      control = this.LoadControl("~/UserControls/Panels/" + uc.UserControl , id.ToString() , loc.ToString());
      } else {
      control = this.LoadControl("~/UserControls/Panels/" + uc.UserControl , id.ToString() , loc.ToString() , arguments);
      }
      The diff shows those lines as (important) changes thereby making it harder to see any actual code changes, which in turn makes merges more difficult. In the example above, one would scroll through the "important" changes, and could easily miss the "real" code change since it initially appears to just be a carriage return style difference. The RegEx in this post applied via Chris's instructions fixes this (temporarily anyway).


      Hope this helps someone,

      jnsohnumr






      Originally posted by chrestomanci View Post
      I would like an easier way to mark text to be ignored when doing a comparison.

      For example I sometimes compare log files from running systems, and I would like to see how sucessive runs are different, however in the log files, every line has a timestamp, so I need a way to exclude it from the comparison.

      I know that it is possible to do this sort of thing with a grammar, but the whole user interface do to that is quite confusing, and not realy suited to an ad-hoc comparison.

      What I would like is a feature where I can highlight the timestamp and get a context menu that says "Exclude from comparison ..." which would lead to a dialog box with choices such as excluding the first 20 chars of each line, text matching a regular expresson, or the like.

      Comment


      • #4
        Hello,

        Thanks for the complex Regular Expression. The line break itself will always separate lines in the comparison, and the Unimportant Text definition can't stretch past a line break or over two lines.

        The Line Break character can be Important or Unimportant based on the Session Settings, Importance tab, "Compare line endings". For the bracket characters, you could mark them as unimportant with explicit "}|{"
        Aaron P Scooter Software

        Comment

        Working...
        X