From b642b6ef672b367e291864cfb617287f7f278b8c Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 5 Jan 2016 10:10:06 -0800 Subject: [PATCH] (stable) Fix `arc diff --raw` with "onto" target properties Summary: Currently, `git show | arc diff --raw` and similar doesn't work because we try to figure out what the "Branch: feature (branched from whatever)" value is, which doesn't make sense. ``` $ git show | arc diff --raw --trace ARGV '/Users/epriestley/dev/core/lib/arcanist/bin/../scripts/arcanist.php' 'diff' '--raw' '--trace' LOAD Loaded "phutil" from "/Users/epriestley/dev/core/lib/libphutil/src". LOAD Loaded "arcanist" from "/Users/epriestley/dev/core/lib/arcanist/src". Config: Reading user configuration file "/Users/epriestley/.arcrc"... Config: Did not find system configuration at "/etc/arcconfig". Working Copy: Reading .arcconfig from "/Users/epriestley/dev/core/lib/arcanist/.arcconfig". Working Copy: Path "/Users/epriestley/dev/core/lib/arcanist" is part of `git` working copy "/Users/epriestley/dev/core/lib/arcanist". Working Copy: Project root is at "/Users/epriestley/dev/core/lib/arcanist". Config: Reading local configuration file "/Users/epriestley/dev/core/lib/arcanist/.git/arc/config"... Loading phutil library from '/Users/epriestley/dev/core/lib/arcanist/src'... >>> [0] conduit.connect() >>> [1] https://secure.phabricator.com/api/conduit.connect <<< [1] 211,217 us <<< [0] 212,001 us >>> [2] diff.didCollectChanges <<< [2] 140 us >>> [3] diff.didBuildMessage <<< [3] 46 us Reading diff from stdin... >>> [4] differential.creatediff() >>> [5] https://secure.phabricator.com/api/differential.creatediff <<< [5] 120,215 us <<< [4] 120,411 us >>> [6] diff.wasCreated <<< [6] 41 us SKIP STAGING Raw changes can not be pushed to a staging area. >>> [7] harbormaster.queryautotargets() >>> [8] https://secure.phabricator.com/api/harbormaster.queryautotargets <<< [8] 217,717 us <<< [7] 217,944 us >>> [9] harbormaster.sendmessage() >>> [10] https://secure.phabricator.com/api/harbormaster.sendmessage >>> [11] harbormaster.sendmessage() >>> [12] https://secure.phabricator.com/api/harbormaster.sendmessage <<< [10] 123,821 us <<< [9] 134,329 us <<< [12] 227,580 us <<< [11] 227,787 us [2016-01-05 10:08:58] EXCEPTION: (Exception) This workflow ('ArcanistDiffWorkflow') requires a Repository API, override requiresRepositoryAPI() to return true. at [/src/workflow/ArcanistWorkflow.php:804] arcanist(head=master, ref.master=b3e68c9f1793), phutil(head=stable, ref.master=adb8a9c074ba, ref.stable=7b8d38cd2d4e) #0 ArcanistWorkflow::getRepositoryAPI() called at [/src/workflow/ArcanistDiffWorkflow.php:2421] #1 ArcanistDiffWorkflow::getDiffOntoTargets() called at [/src/workflow/ArcanistDiffWorkflow.php:2411] #2 ArcanistDiffWorkflow::updateOntoDiffProperty() called at [/src/workflow/ArcanistDiffWorkflow.php:534] #3 ArcanistDiffWorkflow::run() called at [/scripts/arcanist.php:392] ``` Test Plan: Ran `arc diff --raw` in `phabricator/`. Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D14946 --- src/workflow/ArcanistDiffWorkflow.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/workflow/ArcanistDiffWorkflow.php b/src/workflow/ArcanistDiffWorkflow.php index b75de9cd..8a3fa6f6 100644 --- a/src/workflow/ArcanistDiffWorkflow.php +++ b/src/workflow/ArcanistDiffWorkflow.php @@ -2418,6 +2418,10 @@ EOTEXT } private function getDiffOntoTargets() { + if ($this->isRawDiffSource()) { + return null; + } + $api = $this->getRepositoryAPI(); if (!($api instanceof ArcanistGitAPI)) {