• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

I just had my first incident of the new automerge feature, and it doesn't seem to work at all as expected. The resulting revision looked like it had a bunch of chunks of text, all of them (or almost all, at least) copied twice. So the resulting page was twice as long as it should've been, in a weird way.

I looked at Merge.pm and I suppose the problem is that _acceptA calls push twice (once on $b and then again on $a) but I don't know because I don't understand the design of the algorithm. To do a merge effectively, don't you need to have three blocks of text? (the common ancestor, edit a, and edit b?) Anyway, whatever it's doing, it looks like it has small a glitch.


Attached is my proposed TWiki/Merge3.pm that implements a three-way merge. I'd check it in myself, except

  1. Implementing a whole new algorithm is a fairly aggressive way to fix a bug smile and Dakar is supposed to be getting close to release "any day now", and
  2. I didn't put in mergeHandler support because I don't know exactly what the original intent of that was, and it should probably look a little different for a three-way merge, and I don't know what the legacy issues there are.

But if someone else wants to check it over and then submit it to svn, cool!


Greg, The "algorithm" you refer to is documented in the man pages for Algorithm::Diff. It's great that you have something that works but it's far from clear to me how to integrate this with TWiki:Merge.pm. Because we are close to a release I have to ask for a better fix than the one offered.
  1. We need a solution with tests (preferably more complete tests than those in your Merge.pm)
  2. We need a solution that observes the published API for TWiki::Merge. If you need to change the API to support input of 3 versions, it's fine by me to change the API, as long as you fix where it is called.

StaticMethod insDelMerge( $a, $b, $sep, $info )

Perform a merge of two versions of the same text, using HTML tags to mark conflicts.

The granularity of the merge depends on the setting of $sep. For example, if it is "\\n", a line-by-line merge will be done.

Where conflicts exist, they are marked using HTML <del> and <ins> tags. <del> marks content from $a while <ins> marks content from $b.

Non-conflicting content (insertions from either set) are not marked.

The plugins mergeHandler is called for each merge.

StaticMethod simpleMerge( $a, $b, $sep ) -> \@arr

Perform a merge of two versions of the same text, returning and array of strings representing the blocks in the merged context where each string starts with one of "+", "-" or " " depending on whether it is an insertion, a deletion, or just text. Insertions and deletions alway happen in pairs, as text taken in from either version that does not replace text in the other version will simply be accepted.

The granularity of the merge depends on the setting of $sep. For example, if it is "\\n", a line-by-line merge will be done. $sep characters are retained in the outout.

CC


Yeah I get Algorithm::Diff and it's cool; in fact I used it as a basis for my 3-way merge. The part I have a tougher time grokking is TWiki::Merge, but that's okay. Anyway, I added real unit tests... only a little more "complete", but at least they're actually in the unit tests framework instead of being a few random debugging methods. smile And I changed Save.pm to call the new routine. Meta.pm still uses insDelMerge... if we can give it access to the ancestor revision of its data, it'd be cool to upgrade it to Merge3.pm, too.

-- GregAbbas - 23 Aug 2005

ItemTemplate
Summary Merge causes lots of duplicate text
ReportedBy GregAbbas
Codebase

AppliesTo Engine
Priority Urgent
CurrentState Closed
WaitingFor

Checkins 6145 6200
Topic attachments
I Attachment History Action Size Date Who Comment
Perl source code filepm Merge3.pm r2 r1 manage 8.2 K 2005-08-19 - 11:38 GregAbbas  
Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r9 - 2005-08-24 - GregAbbas
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback