Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Jul 2014 22:39:04 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r361717 - in head/devel/arcanist: . files
Message-ID:  <201407132239.s6DMd4RX042144@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Sun Jul 13 22:39:04 2014
New Revision: 361717
URL: http://svnweb.freebsd.org/changeset/ports/361717
QAT: https://qat.redports.org/buildarchive/r361717/

Log:
  Add a patch from upstream to solve the problem of files include twice in case a new directory is added to the review
  
  Reported by:	many
  Obtained from:	https://secure.phabricator.com/D9921

Added:
  head/devel/arcanist/files/
  head/devel/arcanist/files/D9921.diff   (contents, props changed)
Modified:
  head/devel/arcanist/Makefile

Modified: head/devel/arcanist/Makefile
==============================================================================
--- head/devel/arcanist/Makefile	Sun Jul 13 22:31:17 2014	(r361716)
+++ head/devel/arcanist/Makefile	Sun Jul 13 22:39:04 2014	(r361717)
@@ -2,6 +2,7 @@
 
 PORTNAME=	arcanist
 PORTVERSION=	20140617
+PORTREVISION=	1
 CATEGORIES=	devel
 PKGNAMEPREFIX=	php5-
 
@@ -12,6 +13,7 @@ LICENSE=	APACHE20
 
 CONFLICTS=	arc-*
 
+EXTRA_PATCHES=	${FILESDIR}/D9921.diff:-p1
 PHP_DESTDIR=	lib/php/arcanist
 RUN_DEPENDS=	php5-libphutil>0:${PORTSDIR}/devel/libphutil
 USE_PHP=	curl json simplexml

Added: head/devel/arcanist/files/D9921.diff
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/arcanist/files/D9921.diff	Sun Jul 13 22:39:04 2014	(r361717)
@@ -0,0 +1,107 @@
+diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
+--- a/src/__phutil_library_map__.php
++++ b/src/__phutil_library_map__.php
+@@ -5,7 +5,6 @@
+  * @generated
+  * @phutil-library-version 2
+  */
+-
+ phutil_register_library_map(array(
+   '__library_version__' => 2,
+   'class' =>
+diff --git a/src/parser/ArcanistDiffParser.php b/src/parser/ArcanistDiffParser.php
+--- a/src/parser/ArcanistDiffParser.php
++++ b/src/parser/ArcanistDiffParser.php
+@@ -852,6 +852,14 @@
+   }
+ 
+   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();
+diff --git a/src/parser/__tests__/ArcanistDiffParserTestCase.php b/src/parser/__tests__/ArcanistDiffParserTestCase.php
+--- a/src/parser/__tests__/ArcanistDiffParserTestCase.php
++++ b/src/parser/__tests__/ArcanistDiffParserTestCase.php
+@@ -588,6 +588,13 @@
+           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;
+diff --git a/src/parser/__tests__/diff/svn-double-diff.svndiff b/src/parser/__tests__/diff/svn-double-diff.svndiff
+new file mode 100644
+--- /dev/null
++++ b/src/parser/__tests__/diff/svn-double-diff.svndiff
+@@ -0,0 +1,16 @@
++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
+diff --git a/src/parser/diff/ArcanistDiffChange.php b/src/parser/diff/ArcanistDiffChange.php
+--- a/src/parser/diff/ArcanistDiffChange.php
++++ b/src/parser/diff/ArcanistDiffChange.php
+@@ -192,6 +192,11 @@
+     return $this;
+   }
+ 
++  public function dropHunks() {
++    $this->hunks = array();
++    return $this;
++  }
++
+   public function getHunks() {
+     return $this->hunks;
+   }
+diff --git a/src/repository/api/ArcanistSubversionAPI.php b/src/repository/api/ArcanistSubversionAPI.php
+--- a/src/repository/api/ArcanistSubversionAPI.php
++++ b/src/repository/api/ArcanistSubversionAPI.php
+@@ -272,15 +272,18 @@
+   }
+ 
+   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
+     // ONLY changes to that directory when given it as a path. If we run
+     // 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.
+



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407132239.s6DMd4RX042144>