Menu

#1923 Line filters not working if "Match similar lines" enabled

open
nobody
None
5
2012-12-21
2009-05-26
No

"Match similar lines" correctly match most similar lines.

A good example is file a:
--------------
Testme 1
--------------

and file b:
--------------
something
Testme 2
--------------

The first and last lines are identical, the line with Testme is matched correctly.
If you add and enable a new line filter "^Testme" both lines are still marked as different. They are only marked as identical if the line with something is deleted.

To solve the bug, the line filters must be used after matching similar lines, not before like it is done now.

Discussion

  • Kimmo Varis

    Kimmo Varis - 2009-05-26

    Ah, very good catch! This may explain some of the weird reports about filters not working.

    Compare code flow must be changed so that all (line matching currently, possibly others in future) diff-modifying features are run before filtering. I've thought filtering as integral part of the comparing, but seems we need to think it rather as one post-processing phase.

     
  • Matthias

    Matthias - 2009-05-26

    read brief of
    CDiffWrapper::RegExpFilter
    'Matching the diff requires that all lines in difference match.'

    To change this we must crack the diffblock in two or three parts, in case only a part of this block is matching the filter.

     
  • Kimmo Varis

    Kimmo Varis - 2009-05-26

    I wrote that code so I know it very well.

    > 'Matching the diff requires that all lines in difference match.'
    Which is just current implementation. Nothing prevents changing it. And it is current implementation because old implementation behaved like that. Indeed I want to change this behavior.

     
  • Kimmo Varis

    Kimmo Varis - 2009-05-26

    > To change this we must crack the diffblock in two or three parts,
    > in case only a part of this block is matching the filter.

    You are thinking about a lot more advanced feature. Filtering single lines from diffs would indeed require splitting diffs and that in again would lead to GUI confusion. So its not going to happen until someobody has a good idea about GUI which allows diffs next to each other without making it too hard to understand (think about current moved lines option...). And that discussion belongs to forums.

    What this bug needs is we compare lines in diffs after they have been moved by the line matching. Nothing more. No new behavior for the filtering.

     
  • Matthias

    Matthias - 2010-07-25

    Today I'd moved the filter as your suggestion, but it's not enough.
    sample:
    you have a long diff (5 lines). at the end you have an empty line followed by a diff line.
    On the other side, there will be two ghost lines at the end of that diff.
    In this case the empty line will not be filtered as thís diff will have been splitted into at least two diffs, where the last diff has a size of two lines.
    So still a splitting is needed.
    file1:
    N1000 F= FC_Eil
    // $Id: MergeDocDiffSync.cpp 7054 2009-12-22 17:59:08Z kimmov $

    N1010 G01 C1=LadeArm_unten
    b2

    a3
    ;---------------------------------------------------------------
    N1020 M30
    file2:
    N1000 F= FC_Eil
    // $Id: mm.cpp 7054 2009-12-22 17:59:08Z kimmov $
    N1010 G02 C1=LadeArm_unten
    a4
    b3
    ;---------------------------------------------------------------
    N1020 M30
    linefilter:
    ^// \WId: .*\$
    ^\s$
    ^$

    expected:
    trivial left,2-4,7
    trivial right 2

     
  • Kimmo Varis

    Kimmo Varis - 2010-08-05

    Ok, lets read the original bug description again.

    We have been documenting that we only match whole diffs with line filter. So all the lines in differences in both sides must match the filter. Otherwise the difference is not ignored. This filtering is done before the similar lines are matched and lines moved. Hence, this is not a bug per se but side-effect of how the current filtering works.

    From user point of view this is of course weird behavior and something that should be improved. But first thing to solve is the difference splitting problem. Which requires to solve the GUI and usability problems around it. Until those are solved there is no point in trying to fix this bug.

    Yes, I was confused in my earlier comments. I forgot how things are working currently.

     

Log in to post a comment.

MongoDB Logo MongoDB