From 4f6d2cdd495ed7219a55179609251a809199bf84 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 21 Dec 2005 00:09:47 +0000 Subject: [PATCH] Property deletions, modifications, and additions are now differentiated --- diff.php | 17 ++++++++++++++++- includes/svnlib.php | 10 ++++++++-- templates/default/property.tpl | 2 +- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/diff.php b/diff.php index 034c541..5ce9d7c 100644 --- a/diff.php +++ b/diff.php @@ -124,8 +124,23 @@ foreach ($diff->fetch() AS $filename => $file) eval('$hunktpl .= "' . $template->fetch('diff_hunk') . '";'); } - foreach ($props AS $name => $value) + foreach ($props AS $name => $values) { + // modified + if (isset($values['add']) AND isset($values['del'])) + { + $data = sprintf($lang->string('Property %1$s set from %2$s to %3$s'), $name, $values['del'], $values['add']); + } + // added + else if (isset($values['add'])) + { + $data = sprintf($lang->string('Property %1$s set to %2$s'), $name, $values['add']); + } + // removed + else if (isset($values['del'])) + { + $data = sprintf($lang->string('Property %1$s deleted'), $name); + } eval('$proplist .= "' . $template->fetch('property') . '";'); } diff --git a/includes/svnlib.php b/includes/svnlib.php index 7b518cf..5b92e0e 100644 --- a/includes/svnlib.php +++ b/includes/svnlib.php @@ -994,11 +994,17 @@ class SVNDiff { if (preg_match('#^\s+?\+(.*)#', $line, $matches)) { - $this->diff["$index"]['props']["$curprop"] .= $matches[1]; + $mode = 'add'; + $this->diff["$index"]['props']["$curprop"]['add'] .= $matches[1]; + } + else if (preg_match('#^\s+?\-(.*)#', $line, $matches)) + { + $mode = 'del'; + $this->diff["$index"]['props']["$curprop"]['del'] .= $matches[1]; } else if (!preg_match('#^\s+[\+\- ](.*)#', $line) AND trim($line) != '') { - $this->diff["$index"]['props']["$curprop"] .= "\n" . $line; + $this->diff["$index"]['props']["$curprop"]["$mode"] .= "\n" . $line; } continue; } diff --git a/templates/default/property.tpl b/templates/default/property.tpl index 55de201..dfa51ad 100644 --- a/templates/default/property.tpl +++ b/templates/default/property.tpl @@ -1 +1 @@ -
  • Property $name set to $value
  • +
  • $data
  • -- 2.43.5