* @generated
* @phutil-library-version 2
*/
-
phutil_register_library_map(array(
'__library_version__' => 2,
'class' =>
}
protected function parseChangeset(ArcanistDiffChange $change) {
+ // If a diff includes two sets of changes to the same file, let the
+ // second one win. In particular, this occurs when adding subdirectories
+ // in Subversion that contain files: the file text will be present in
+ // both the directory diff and the file diff. See T5555. Dropping the
+ // hunks lets whichever one shows up later win instead of showing changes
+ // twice.
+ $change->dropHunks();
+
$all_changes = array();
do {
$hunk = new ArcanistDiffHunk();
ArcanistDiffChangeType::TYPE_CHANGE,
$change->getType());
break;
+ case 'svn-double-diff.svndiff':
+ $this->assertEqual(1, count($changes));
+
+ $change = array_shift($changes);
+ $hunks = $change->getHunks();
+ $this->assertEqual(1, count($hunks));
+ break;
default:
throw new Exception("No test block for diff file {$diff_file}.");
break;
--- /dev/null
+Index: subdir/newfile
+===================================================================
+--- subdir/newfile (revision 0)
++++ subdir/newfile (working copy)
+@@ -0,0 +1,3 @@
++apple
++banana
++cherry
+Index: subdir/newfile
+===================================================================
+--- subdir/newfile (revision 0)
++++ subdir/newfile (working copy)
+@@ -0,0 +1,3 @@
++apple
++banana
++cherry
return $this;
}
+ public function dropHunks() {
+ $this->hunks = array();
+ return $this;
+ }
+
public function getHunks() {
return $this->hunks;
}
}
public function buildDiffFuture($path) {
+ $root = phutil_get_library_root('arcanist');
+
// The "--depth empty" flag prevents us from picking up changes in
// children when we run 'diff' against a directory. Specifically, when a
// user has added or modified some directory "example/", we want to return
// without "--depth empty", svn will give us changes to the directory
// itself (such as property changes) and also give us changes to any
// files within the directory (basically, implicit recursion). We don't
- // want that, so prevent recursive diffing.
- $root = phutil_get_library_root('arcanist');
+ // want that, so prevent recursive diffing. This flag does not work if the
+ // directory is newly added (see T5555) so we need to filter the results
+ // out later as well.
if (phutil_is_windows()) {
// TODO: Provide a binary_safe_diff script for Windows.