Tags:
create new tag
view all tags
---+ Package =TWiki::Merge= Support for merging strings %TOC% ---++ StaticMethod *merge2* <tt>($arev,$a,$brev,$b,$sep,$session,$info)</tt> * =$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. 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. Call it like this: <verbatim> $newText = TWiki::Merge::merge2( $oldrev, $old, $newrev, $new, '.*?\n', $session, $info ); </verbatim> ---++ StaticMethod *simpleMerge* <tt>($a,$b,$sep) -> \@arr</tt> Perform a merge of two versions of the same text, returning 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 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. ---++ StaticMethod *merge3* <tt>($arev,$a,$brev,$b,$crev,$c,$sep,</tt> $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: <verbatim> my ( $ancestorMeta, $ancestorText ) = $store->readTopic( undef, $webName, $topic, $originalrev ); $newText = TWiki::Merge::merge3( $ancestorText, $prevText, $newText, $originalrev, $rev, "new", '.*?\n' ); </verbatim>
E
dit
|
A
nexar
|
Watch
|
Im
p
rimir
|
H
istórico
: r3
<
r2
<
r1
|
We
b
|
V
er tópico
|
Ra
w
edit
|
M
ais ações de tópico
Versão do tópico: r3 - 16 Jan 2007
-
TWikiContributor
Home
Site map
Main web
Sandbox web
TWiki web
Web TWiki
User registration
Usuários
Grupos
Índice
Busca
Alterações
Notificações
Fonte RSS
Estatísticas
Preferências
Ver
Raw View
Print version
Find backlinks
History
More topic actions
Editar
Editar modo texto
Attach file or image
Editar preferências do tópico
Marcar novo tópico pai
More topic actions
Referência do usuário
ATasteOfTWiki
TextFormattingRules
TWikiVariables
FormattedSearch
QuerySearch
TWikiDocGraphics
TWikiSkinBrowser
InstalledPlugins
Manutenção Administrativa
Reference Manual
InterWikis
ManagingUsers
ManagingWebs
TWikiSiteTools
TWikiPreferences
WebPreferences
Categorias
Admin Documentation
Admin Tools
Developer Doc
User Documentation
User Tools
Account
Iniciar sessão
Български
Cesky
Dansk
Deutsch
English
Español
_Français_
Italiano
日本語
한글
Nederlands
Polski
Português
Русский
Svenska
简体中文
簡體中文
E
dit
A
nexar
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Idéias, solicitações, problemas com relação ao TWiki?
Nos dê um retorno
Note:
Please contribute updates to this topic on TWiki.org at
TWiki:TWiki.TWikiMergeDotPm
.