From 7303e9dd58122dba90ae5c22c60f943cf650ebf5 Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Wed, 23 Jun 2010 15:58:07 +0200 Subject: [PATCH] return the correct file name for dropped files from monotone's diff output --- src/IDF/Diff.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/IDF/Diff.php b/src/IDF/Diff.php index 71e8019..c51e883 100644 --- a/src/IDF/Diff.php +++ b/src/IDF/Diff.php @@ -72,7 +72,18 @@ class IDF_Diff $indiff = true; continue; } else if (0 === strpos($line, '=========')) { + // by default always use the new name of a possibly renamed file $current_file = self::getMtnFile($this->lines[$i+1]); + // mtn 0.48 and newer set /dev/null as file path for dropped files + // so we display the old name here + if ($current_file == "/dev/null") { + $current_file = self::getMtnFile($this->lines[$i]); + } + if ($current_file == "/dev/null") { + throw new Exception( + "could not determine path from diff" + ); + } $files[$current_file] = array(); $files[$current_file]['chunks'] = array(); $files[$current_file]['chunks_def'] = array();