mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-10 08:52:39 +01:00
Don't amend commits with different author
Summary: Also delete extra newlines. Test Plan: $ arc diff # on top of my commit Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2025 Differential Revision: https://secure.phabricator.com/D3996
This commit is contained in:
parent
ec8c214ddf
commit
0cf8ef02d8
4 changed files with 34 additions and 3 deletions
|
@ -472,6 +472,18 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
|
||||||
return $this->status;
|
return $this->status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getGitConfig($key, $default = null) {
|
||||||
|
list($stdout) = $this->execxLocal('config %s', $key);
|
||||||
|
if ($stdout == '') {
|
||||||
|
return $default;
|
||||||
|
}
|
||||||
|
return rtrim($stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAuthor() {
|
||||||
|
return $this->getGitConfig('user.name');
|
||||||
|
}
|
||||||
|
|
||||||
public function addToCommit(array $paths) {
|
public function addToCommit(array $paths) {
|
||||||
$this->execxLocal(
|
$this->execxLocal(
|
||||||
'add -- %Ls',
|
'add -- %Ls',
|
||||||
|
|
|
@ -594,6 +594,18 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
|
||||||
$this->execxLocal('up');
|
$this->execxLocal('up');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getMercurialConfig($key, $default = null) {
|
||||||
|
list($stdout) = $this->execxLocal('showconfig %s', $key);
|
||||||
|
if ($stdout == '') {
|
||||||
|
return $default;
|
||||||
|
}
|
||||||
|
return rtrim($stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAuthor() {
|
||||||
|
return $this->getMercurialConfig('ui.username');
|
||||||
|
}
|
||||||
|
|
||||||
public function addToCommit(array $paths) {
|
public function addToCommit(array $paths) {
|
||||||
$this->execxLocal(
|
$this->execxLocal(
|
||||||
'add -- %Ls',
|
'add -- %Ls',
|
||||||
|
|
|
@ -192,6 +192,10 @@ abstract class ArcanistRepositoryAPI {
|
||||||
throw new ArcanistCapabilityNotSupportedException($this);
|
throw new ArcanistCapabilityNotSupportedException($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getAuthor() {
|
||||||
|
throw new ArcanistCapabilityNotSupportedException($this);
|
||||||
|
}
|
||||||
|
|
||||||
public function addToCommit(array $paths) {
|
public function addToCommit(array $paths) {
|
||||||
throw new ArcanistCapabilityNotSupportedException($this);
|
throw new ArcanistCapabilityNotSupportedException($this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -795,7 +795,7 @@ abstract class ArcanistBaseWorkflow {
|
||||||
echo "You have unstaged changes in this working copy.\n\n".
|
echo "You have unstaged changes in this working copy.\n\n".
|
||||||
$working_copy_desc.
|
$working_copy_desc.
|
||||||
" Unstaged changes in working copy:\n".
|
" Unstaged changes in working copy:\n".
|
||||||
" ".implode("\n ", $unstaged)."\n\n";
|
" ".implode("\n ", $unstaged);
|
||||||
if ($this->askForAdd()) {
|
if ($this->askForAdd()) {
|
||||||
$api->addToCommit($unstaged);
|
$api->addToCommit($unstaged);
|
||||||
$must_commit += array_flip($unstaged);
|
$must_commit += array_flip($unstaged);
|
||||||
|
@ -815,7 +815,7 @@ abstract class ArcanistBaseWorkflow {
|
||||||
echo "You have uncommitted changes in this working copy.\n\n".
|
echo "You have uncommitted changes in this working copy.\n\n".
|
||||||
$working_copy_desc.
|
$working_copy_desc.
|
||||||
" Uncommitted changes in working copy:\n".
|
" Uncommitted changes in working copy:\n".
|
||||||
" ".implode("\n ", $uncommitted)."\n\n";
|
" ".implode("\n ", $uncommitted);
|
||||||
if ($this->askForAdd()) {
|
if ($this->askForAdd()) {
|
||||||
$must_commit += array_flip($uncommitted);
|
$must_commit += array_flip($uncommitted);
|
||||||
} else {
|
} else {
|
||||||
|
@ -853,7 +853,10 @@ abstract class ArcanistBaseWorkflow {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Check last commit's author. If not me then return false.
|
if ($api->getAuthor() != $commit['author']) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Check commits since tracking branch. If empty then return false.
|
// TODO: Check commits since tracking branch. If empty then return false.
|
||||||
|
|
||||||
$repository_phid = idx($this->getProjectInfo(), 'repositoryPHID');
|
$repository_phid = idx($this->getProjectInfo(), 'repositoryPHID');
|
||||||
|
|
Loading…
Reference in a new issue