mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-26 00:32:41 +01:00
Treat a file merged from another svn branch as an addition
Summary: After a reintegration merge, "Copied From URL" will be different and current approach will result in a wrong path. If the path does not match, just mark it as a new file. moved the comment before if so lines stay at 80 chars Test Plan: in trunk, svn merge --reintegrate ^/branches/foo and arc diff - without this change it will say "Copied from es/foo/..." Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3748
This commit is contained in:
parent
f1bca1b7cb
commit
134e9e5b4d
1 changed files with 12 additions and 7 deletions
|
@ -116,8 +116,9 @@ final class ArcanistDiffParser {
|
||||||
$root = $rinfo['URL'].'/';
|
$root = $rinfo['URL'].'/';
|
||||||
}
|
}
|
||||||
$cpath = $info['Copied From URL'];
|
$cpath = $info['Copied From URL'];
|
||||||
$cpath = substr($cpath, strlen($root));
|
$root_len = strlen($root);
|
||||||
if ($info['Copied From Rev']) {
|
if (!strncmp($cpath, $root, $root_len)) {
|
||||||
|
$cpath = substr($cpath, $root_len);
|
||||||
// The user can "svn cp /path/to/file@12345 x", which pulls a file out
|
// The user can "svn cp /path/to/file@12345 x", which pulls a file out
|
||||||
// of version history at a specific revision. If we just use the path,
|
// of version history at a specific revision. If we just use the path,
|
||||||
// we'll collide with possible changes to that path in the working
|
// we'll collide with possible changes to that path in the working
|
||||||
|
@ -129,14 +130,18 @@ final class ArcanistDiffParser {
|
||||||
// TODO: In theory, you could have an '@' in your path and this could
|
// TODO: In theory, you could have an '@' in your path and this could
|
||||||
// cause a collision, e.g. two files named 'f' and 'f@12345'. This is
|
// cause a collision, e.g. two files named 'f' and 'f@12345'. This is
|
||||||
// at least somewhat the user's fault, though.
|
// at least somewhat the user's fault, though.
|
||||||
|
if ($info['Copied From Rev']) {
|
||||||
if ($info['Copied From Rev'] != $info['Revision']) {
|
if ($info['Copied From Rev'] != $info['Revision']) {
|
||||||
$cpath .= '@'.$info['Copied From Rev'];
|
$cpath .= '@'.$info['Copied From Rev'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$change->setOldPath($cpath);
|
$change->setOldPath($cpath);
|
||||||
|
|
||||||
$from[$path] = $cpath;
|
$from[$path] = $cpath;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// file was merged from another branch, treat it as a new file
|
||||||
|
$change->setType(ArcanistDiffChangeType::TYPE_ADD);
|
||||||
|
}
|
||||||
$type = $change->getType();
|
$type = $change->getType();
|
||||||
if (($type === ArcanistDiffChangeType::TYPE_MOVE_AWAY ||
|
if (($type === ArcanistDiffChangeType::TYPE_MOVE_AWAY ||
|
||||||
$type === ArcanistDiffChangeType::TYPE_DELETE) &&
|
$type === ArcanistDiffChangeType::TYPE_DELETE) &&
|
||||||
|
|
Loading…
Reference in a new issue