'ws' => true
), $opts);
- $this->assertValidRevision($rev1);
- $this->assertValidRevision($rev2);
+ if ($rev1) { $this->assertValidRevision($rev1); }
$diff = $this->_diff($file, $rev1, $rev2, $opts);
return empty($opts['human'])
$flags .= ' -b -w ';
}
- switch ($opts['type']) {
- case 'unified':
- $flags .= '--unified=' . escapeshellarg((int)$opts['num']);
- break;
- }
+ if (!$rev1) {
+ $command = $this->getCommand() . ' show --oneline ' . escapeshellarg($rev2) . ' -- ' . escapeshellarg($file->queryModulePath()) . ' 2>&1';
+ } else {
+ switch ($opts['type']) {
+ case 'unified':
+ $flags .= '--unified=' . escapeshellarg((int)$opts['num']);
+ break;
+ }
- // @TODO: add options for $hr options - however these may not
- // be compatible with some diffs.
- $command = $this->getCommand() . ' diff -M -C ' . $flags . ' --no-color ' . escapeshellarg($rev1 . '..' . $rev2) . ' -- ' . escapeshellarg($file->queryModulePath()) . ' 2>&1';
+ // @TODO: add options for $hr options - however these may not
+ // be compatible with some diffs.
+ $command = $this->getCommand() . ' diff -M -C ' . $flags . ' --no-color ' . escapeshellarg($rev1 . '..' . $rev2) . ' -- ' . escapeshellarg($file->queryModulePath()) . ' 2>&1';
+ }
exec($command, $diff, $retval);
-
return $diff;
}