Do not split Hg's and git's log output into lines - this will make it
impossible for us to detect proper line endings later on.
This commit is contained in:
parent
ef2d3a9af9
commit
1be91e5a2a
@ -507,33 +507,23 @@ class IDF_Scm_Git extends IDF_Scm
|
|||||||
"'".$this->mediumtree_fmt."'",
|
"'".$this->mediumtree_fmt."'",
|
||||||
escapeshellarg($commit));
|
escapeshellarg($commit));
|
||||||
}
|
}
|
||||||
$out = array();
|
|
||||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||||
self::exec('IDF_Scm_Git::getCommit', $cmd, $out, $ret);
|
$out = self::shell_exec('IDF_Scm_Git::getCommit', $cmd);
|
||||||
if ($ret != 0 or count($out) == 0) {
|
if (strlen($out) == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($getdiff) {
|
|
||||||
$log = array();
|
$diffStart = strpos($out, 'diff --git a');
|
||||||
$change = array();
|
$diff = '';
|
||||||
$inchange = false;
|
if ($diffStart !== false) {
|
||||||
foreach ($out as $line) {
|
$log = substr($out, 0, $diffStart);
|
||||||
if (!$inchange and 0 === strpos($line, 'diff --git a')) {
|
$diff = substr($out, $diffStart);
|
||||||
$inchange = true;
|
|
||||||
}
|
|
||||||
if ($inchange) {
|
|
||||||
$change[] = $line;
|
|
||||||
} else {
|
} else {
|
||||||
$log[] = $line;
|
$log = $out;
|
||||||
}
|
|
||||||
}
|
|
||||||
$out = self::parseLog($log);
|
|
||||||
$out[0]->diff = implode("\n", $change);
|
|
||||||
} else {
|
|
||||||
$out = self::parseLog($out);
|
|
||||||
$out[0]->diff = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$out = self::parseLog(preg_split('/\r\n|\n/', $log));
|
||||||
|
$out[0]->diff = $diff;
|
||||||
$out[0]->branch = implode(', ', $this->inBranches($out[0]->commit, null));
|
$out[0]->branch = implode(', ', $this->inBranches($out[0]->commit, null));
|
||||||
return $out[0];
|
return $out[0];
|
||||||
}
|
}
|
||||||
|
@ -408,24 +408,23 @@ class IDF_Scm_Mercurial extends IDF_Scm
|
|||||||
escapeshellarg($commit),
|
escapeshellarg($commit),
|
||||||
escapeshellarg($this->repo),
|
escapeshellarg($this->repo),
|
||||||
escapeshellarg($logStyle->get()));
|
escapeshellarg($logStyle->get()));
|
||||||
$out = array();
|
|
||||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||||
self::exec('IDF_Scm_Mercurial::getCommit', $cmd, $out);
|
$out = self::shell_exec('IDF_Scm_Mercurial::getCommit', $cmd);
|
||||||
$log = array();
|
if (strlen($out) == 0) {
|
||||||
$change = array();
|
return false;
|
||||||
$inchange = false;
|
|
||||||
foreach ($out as $line) {
|
|
||||||
if (!$inchange and 0 === strpos($line, 'diff -r')) {
|
|
||||||
$inchange = true;
|
|
||||||
}
|
}
|
||||||
if ($inchange) {
|
|
||||||
$change[] = $line;
|
$diffStart = strpos($out, 'diff -r');
|
||||||
|
$diff = '';
|
||||||
|
if ($diffStart !== false) {
|
||||||
|
$log = substr($out, 0, $diffStart);
|
||||||
|
$diff = substr($out, $diffStart);
|
||||||
} else {
|
} else {
|
||||||
$log[] = $line;
|
$log = $out;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
$out = self::parseLog($log);
|
$out = self::parseLog(preg_split('/\r\n|\n/', $log));
|
||||||
$out[0]->diff = implode("\n", $change);
|
$out[0]->diff = $diff;
|
||||||
return $out[0];
|
return $out[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user