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 @@ -1213,4 +1213,12 @@ $this->resolvedHeadCommit = null; } + public function setSingleCommit($symbolic_commit) { + list($parent) = $this->execxLocal( + 'rev-list %s --skip=1 --max-count=1', $symbolic_commit); + $parent = rtrim($parent, "\n"); + $this->setBaseCommit($parent); + $this->setHeadCommit($symbolic_commit); + } + } diff --git a/src/workflow/ArcanistDiffWorkflow.php b/src/workflow/ArcanistDiffWorkflow.php --- a/src/workflow/ArcanistDiffWorkflow.php +++ b/src/workflow/ArcanistDiffWorkflow.php @@ -182,6 +182,15 @@ 'never-apply-patches' => '--nolint suppresses lint.', ), ), + 'commit' => array( + 'param' => 'revision_id', + 'help' => 'Single commit to generate diff from.', + 'conflicts' => array( + '--base' => '--commit suppresses --base.', + '--head' => '--commit suppresses --head.' + ), + 'supports' => array('git'), + ), 'only' => array( 'help' => 'Only generate a diff, without running lint, unit tests, or other '. @@ -450,6 +459,10 @@ } $repo = $this->getRepositoryAPI(); + if ($this->getArgument('commit')) { + $repo->setSingleCommit($this->getArgument('commit')); + } + $head_commit = $this->getArgument('head'); if ($head_commit !== null) { $repo->setHeadCommit($head_commit);