Page MenuHomePhabricator

D18651.diff
No OneTemporary

D18651.diff

diff --git a/src/ref/ArcanistRevisionRef.php b/src/ref/ArcanistRevisionRef.php
--- a/src/ref/ArcanistRevisionRef.php
+++ b/src/ref/ArcanistRevisionRef.php
@@ -56,6 +56,10 @@
return idx($this->parameters, 'title');
}
+ public function getAuthorPHID() {
+ return idx($this->parameters, 'authorPHID');
+ }
+
public function addSource(ArcanistRevisionRefSource $source) {
$this->sources[] = $source;
return $this;
diff --git a/src/repository/api/ArcanistGitAPI.php b/src/repository/api/ArcanistGitAPI.php
--- a/src/repository/api/ArcanistGitAPI.php
+++ b/src/repository/api/ArcanistGitAPI.php
@@ -1053,19 +1053,22 @@
return $refs;
}
+ public function getBaseCommitRef() {
+ $base_commit = $this->getSourceControlBaseRevision();
+ $base_message = $this->getCommitMessage($base_commit);
+
+ // TODO: We should also pull the tree hash.
+
+ return $this->newCommitRef()
+ ->setCommitHash($base_commit)
+ ->attachMessage($base_message);
+ }
+
public function getWorkingCopyRevision() {
list($stdout) = $this->execxLocal('rev-parse HEAD');
return rtrim($stdout, "\n");
}
- public function getUnderlyingWorkingCopyRevision() {
- list($err, $stdout) = $this->execManualLocal('svn find-rev HEAD');
- if (!$err && $stdout) {
- return rtrim($stdout, "\n");
- }
- return $this->getWorkingCopyRevision();
- }
-
public function isHistoryDefaultImmutable() {
return false;
}
diff --git a/src/repository/api/ArcanistRepositoryAPI.php b/src/repository/api/ArcanistRepositoryAPI.php
--- a/src/repository/api/ArcanistRepositoryAPI.php
+++ b/src/repository/api/ArcanistRepositoryAPI.php
@@ -343,11 +343,6 @@
array $query);
abstract public function getRemoteURI();
-
- public function getUnderlyingWorkingCopyRevision() {
- return $this->getWorkingCopyRevision();
- }
-
public function getChangedFiles($since_commit) {
throw new ArcanistCapabilityNotSupportedException($this);
}
@@ -379,6 +374,10 @@
throw new ArcanistCapabilityNotSupportedException($this);
}
+ public function getBaseCommitRef() {
+ throw new ArcanistCapabilityNotSupportedException($this);
+ }
+
public function hasLocalCommit($commit) {
throw new ArcanistCapabilityNotSupportedException($this);
}
diff --git a/src/workflow/ArcanistDiffWorkflow.php b/src/workflow/ArcanistDiffWorkflow.php
--- a/src/workflow/ArcanistDiffWorkflow.php
+++ b/src/workflow/ArcanistDiffWorkflow.php
@@ -393,16 +393,6 @@
),
'supports' => array('git', 'hg'),
),
- 'cache' => array(
- 'param' => 'bool',
- 'help' => pht(
- '%d to disable lint cache, %d to enable (default).',
- 0,
- 1),
- 'passthru' => array(
- 'lint' => true,
- ),
- ),
'coverage' => array(
'help' => pht('Always enable coverage information.'),
'conflicts' => array(
@@ -1950,6 +1940,15 @@
$faux_message[] = pht('CC: %s', $this->getArgument('cc'));
}
+ // NOTE: For now, this isn't a real field, so it just ends up as the first
+ // part of the summary.
+ $depends_ref = $this->getDependsOnRevisionRef();
+ if ($depends_ref) {
+ $faux_message[] = pht(
+ 'Depends on %s. ',
+ $depends_ref->getMonogram());
+ }
+
// See T12069. After T10312, the first line of a message is always parsed
// as a title. Add a placeholder so "Reviewers" and "CC" are never the
// first line.
@@ -2904,4 +2903,45 @@
}
}
+ private function getDependsOnRevisionRef() {
+ $api = $this->getRepositoryAPI();
+ $base_ref = $api->getBaseCommitRef();
+
+ $state_ref = $this->newWorkingCopyStateRef()
+ ->setCommitRef($base_ref);
+
+ $this->newRefQuery(array($state_ref))
+ ->needHardpoints(
+ array(
+ 'revisionRefs',
+ ))
+ ->execute();
+
+ $revision_refs = $state_ref->getRevisionRefs();
+ $viewer_phid = $this->getUserPHID();
+
+ foreach ($revision_refs as $key => $revision_ref) {
+ // Don't automatically depend on closed revisions.
+ if ($revision_ref->isClosed()) {
+ unset($revision_refs[$key]);
+ continue;
+ }
+
+ // Don't automatically depend on revisions authored by other users.
+ if ($revision_ref->getAuthorPHID() != $viewer_phid) {
+ continue;
+ }
+ }
+
+ if (!$revision_refs) {
+ return null;
+ }
+
+ if (count($revision_refs) > 1) {
+ return null;
+ }
+
+ return head($revision_refs);
+ }
+
}
diff --git a/src/workflow/ArcanistLintWorkflow.php b/src/workflow/ArcanistLintWorkflow.php
--- a/src/workflow/ArcanistLintWorkflow.php
+++ b/src/workflow/ArcanistLintWorkflow.php
@@ -201,7 +201,7 @@
// This is used so that the lint engine can drop warning messages
// concerning lines that weren't in the change.
$engine->setPaths($paths);
- if ($lint_all) {
+ if (!$lint_all) {
foreach ($paths as $path) {
// Note that getChangedLines() returns null to indicate that a file
// is binary or a directory (i.e., changed lines are not relevant).

File Metadata

Mime Type
text/plain
Expires
Wed, May 22, 2:43 AM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6300125
Default Alt Text
D18651.diff (5 KB)

Event Timeline