Fixed issue in the display of filename with spaces with Mercurial.

The Mercurial backend was not displaying correctly the filenames/folders
having spaces in them. It was troncating at the space.
This commit is contained in:
Benjamin Jorand 2009-01-17 10:03:10 +01:00 committed by Loic d'Anterroches
parent 419601bb92
commit 7e7b5a4409

View File

@ -149,13 +149,12 @@ class IDF_Scm_Mercurial
list($hash, $perm, $exec, $file) = preg_split('/ |\t/', $line, 4); list($hash, $perm, $exec, $file) = preg_split('/ |\t/', $line, 4);
$file = trim($file); $file = trim($file);
$dir = explode('/', $file, -1); $dir = explode('/', $file, -1);
preg_match_all('|([a-zA-Z0-9_-]+)/|', $file, $dir);
$tmp = ''; $tmp = '';
for ($i=0; $i < count($dir[1]); $i++) { for ($i=0; $i < count($dir); $i++) {
if ($i > 0) { if ($i > 0) {
$tmp .= '/'; $tmp .= '/';
} }
$tmp .= $dir[1][$i]; $tmp .= $dir[$i];
if (!in_array("empty\t000\t\t$tmp/", $out_hack)) if (!in_array("empty\t000\t\t$tmp/", $out_hack))
$out_hack[] = "empty\t000\t\t$tmp/"; $out_hack[] = "empty\t000\t\t$tmp/";
} }
@ -206,13 +205,12 @@ class IDF_Scm_Mercurial
list($hash, $perm, $exec, $file) = preg_split('/ |\t/', $line, 4); list($hash, $perm, $exec, $file) = preg_split('/ |\t/', $line, 4);
$file = trim($file); $file = trim($file);
$dir = explode('/', $file, -1); $dir = explode('/', $file, -1);
preg_match_all('|([a-zA-Z0-9_-]+)/|', $file, $dir);
$tmp = ''; $tmp = '';
for ($i=0; $i < count($dir[1]); $i++) { for ($i=0; $i < count($dir); $i++) {
if ($i > 0) { if ($i > 0) {
$tmp .= '/'; $tmp .= '/';
} }
$tmp .= $dir[1][$i]; $tmp .= $dir[$i];
if (!in_array("empty\t000\t\t$tmp/", $out_hack)) { if (!in_array("empty\t000\t\t$tmp/", $out_hack)) {
$out_hack[] = "emtpy\t000\t\t$tmp/"; $out_hack[] = "emtpy\t000\t\t$tmp/";
} }