Welcome, Registration, and other StartingPoints; TWiki history & Wiki style; All the docs...
View   r3  >  r2  >  r1
TWikiMergeDotPm 3 - 16 Jan 2007 - Main.TWikiContributor

TWikiMergeDotPm 2 - 01 Apr 2006 - Main.TWikiContributor
Line: 5 to 5
 
Changed:
<
<

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

>
>

StaticMethod merge2 ($arev,$a,$brev,$b,$sep,$session,$info)

  • $arev - rev for $a (string)
  • $a - first ('original') string
  • $brev - rev for $b (string)
  • $b - second ('new') string
  • $sep = separator, string RE e.g. '.*?\n' for lines
  • $session - TWiki object
  • $info - data block passed to plugins merge handler. Conventionally this will identify the source of the text being merged (the source form field, or undef for the body text)
 Perform a merge of two versions of the same text, using HTML tags to mark conflicts.
Line: 20 to 27
 Non-conflicting content (insertions from either set) are not marked.
Changed:
<
<
The plugins mergeHandler is called for each merge.
>
>
The plugins mergeHandler is called for each merge.

Call it like this:

$newText = TWiki::Merge::merge2(
   $oldrev, $old, $newrev, $new, '.*?\n', $session, $info );
 

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

Perform a merge of two versions of the same text, returning

Changed:
<
<
and array of strings representing the blocks in the merged context
>
>
an 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
Line: 39 to 52
 $sep characters are retained in the outout.
Added:
>
>

StaticMethod merge3 ($arev,$a,$brev,$b,$crev,$c,$sep,

$session, $info )

  • $arev - rev for common ancestor (id e.g. ver no)
  • $a - common ancestor
  • $brev - rev no for first derivative string (id)
  • $b - first derivative string
  • $crev - rev no for second derivative string (id)
  • $c - second derivative string
  • $sep = separator, string RE e.g. '.*?\n' for lines
  • $session - TWiki object
  • $info - data block passed to plugins merge handler. Conventionally this will identify the source of the text being merged (the source form field, or undef for the body text)

Perform a merge of two versions (b and c) of the same text, using HTML <div> tags to mark conflicts. a is the common ancestor.

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 labeled using the provided revision numbers.

The plugins mergeHandler is called for each merge.

Here's a little picture of a 3-way merge:

a <- ancestor / b c <- revisions \ / d <- merged result, returned.

call it like this:

    my ( $ancestorMeta, $ancestorText ) =
        $store->readTopic( undef, $webName, $topic, $originalrev );
    $newText = TWiki::Merge::merge3(
        $ancestorText, $prevText, $newText,
        $originalrev, $rev, "new",
        '.*?\n' );

TWikiMergeDotPm 1 - 01 Feb 2006 - Main.TWikiContributor
Line: 1 to 1
Added:
>
>

Package TWiki::Merge

Support for merging strings

StaticMethod insDelMerge ($a,$b,$sep,$session,$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.


Revision 3r3 - 16 Jan 2007 - 04:12:00 - TWikiContributor
Revision 2r2 - 01 Apr 2006 - 05:55:39 - TWikiContributor
Revision 1r1 - 01 Feb 2006 - 12:01:25 - TWikiContributor
This site is powered by the TWiki collaboration platform.
All material on this collaboration platform is the property of the contributing authors.
All material marked as authored by Eben Moglen is available under the license terms CC-BY-SA version 4.
Syndicate this site RSSATOM