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) {
$this->execxLocal(
'add -- %Ls',
$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) {
$this->execxLocal(
'add -- %Ls',
throw new ArcanistCapabilityNotSupportedException($this);
}
+ public function getAuthor() {
+ throw new ArcanistCapabilityNotSupportedException($this);
+ }
+
public function addToCommit(array $paths) {
throw new ArcanistCapabilityNotSupportedException($this);
}
echo "You have unstaged changes in this working copy.\n\n".
$working_copy_desc.
" Unstaged changes in working copy:\n".
- " ".implode("\n ", $unstaged)."\n\n";
+ " ".implode("\n ", $unstaged);
if ($this->askForAdd()) {
$api->addToCommit($unstaged);
$must_commit += array_flip($unstaged);
echo "You have uncommitted changes in this working copy.\n\n".
$working_copy_desc.
" Uncommitted changes in working copy:\n".
- " ".implode("\n ", $uncommitted)."\n\n";
+ " ".implode("\n ", $uncommitted);
if ($this->askForAdd()) {
$must_commit += array_flip($uncommitted);
} else {
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.
$repository_phid = idx($this->getProjectInfo(), 'repositoryPHID');