Exemplo n.º 1
0
 /**
  * Merge
  * @return	string		Merged string
  */
 public function merge()
 {
     /* Create the Diff object. */
     $diff = new Text_Diff3($this->_ORIG, $this->_NEW, $this->_CUSTOM);
     /* Output the diff in unified format. */
     return $this->_postProcessQuick(implode("\n", $diff->mergedOutput('XXXNEWXXX', 'XXXCUSTOMXXX')));
 }
Exemplo n.º 2
0
 /**
  * Perform the merge and return the result
  *
  * On conflict, will throw an exception with a message of CONFLICT
  *
  * @return	@e string
  * @throws	Exception
  */
 public function merge()
 {
     $this->_addDebugMsg('---- START--o---', $this->_ORIG);
     $this->_addDebugMsg('---- START--n---', $this->_NEW);
     $this->_addDebugMsg('---- START--c---', $this->_CUSTOM);
     if ($this->diffType == 'lite') {
         /* Create the Diff object. */
         $diff = new Text_Diff3($this->_ORIG, $this->_NEW, $this->_CUSTOM);
         /* Output the diff in unified format. */
         return $this->_postProcessQuick(implode("\n", $diff->mergedOutput('XXXNEWXXX', 'XXXCUSTOMXXX')));
     } else {
         /* ORIG - NEW */
         $diff = new Text_Diff('auto', array($this->_ORIG, $this->_NEW));
         $renderer = new Text_Diff_Renderer_ips3waymerge();
         $orig_new = explode("\n", trim($renderer->render($diff)));
         /* ORIG - CUSTOM */
         $diff = new Text_Diff('auto', array($this->_ORIG, $this->_CUSTOM));
         $renderer = new Text_Diff_Renderer_ips3waymerge();
         $orig_custom = explode("\n", trim($renderer->render($diff)));
         /* Process the arrays */
         $orig_new_map = $this->_fetchProcessed($orig_new, 1);
         $orig_custom_map = $this->_fetchProcessed($orig_custom);
         /* Add to debug */
         $this->_addDebugMsg('---- OLD DEFAULT------', $this->_ORIG);
         $this->_addDebugMsg('---- NEW DEFAULT------', $this->_NEW);
         $this->_addDebugMsg('---- USER DEFAULT------', $this->_CUSTOM);
         $this->_addDebugMsg('---- OLD DEFAULT > NEW DEFAULT DIFF------', $orig_new_map);
         $this->_addDebugMsg('---- OLD DEFAULT > USER CUSTOM DIFF------', $orig_custom_map);
         /* Process the thing */
         try {
             $return = $this->_processMerge($orig_new_map, $orig_custom_map);
             return $return;
         } catch (Exception $e) {
             throw new Exception($e->getMessage());
         }
     }
 }