mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-29 10:12:41 +01:00
Make callsigns optional in arcanist
Summary: Remove couple of references to callsigns: - `arc which` now prints repository name - `getShouldAmend()` can now use new format of commit name a quick git-grep looks like the remaining references are all about `repository.callsign` config. Ref T4245 Test Plan: - `arc which` on a repository with no callsign - trigger `requireCleanWorkingCopy()`, see both "Do you want to amend this change" and "Do you want to create a new commit" prompts. - fire this diff with new code. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin Maniphest Tasks: T4245 Differential Revision: https://secure.phabricator.com/D15472
This commit is contained in:
parent
ccbaee585e
commit
3d7ac867f5
2 changed files with 20 additions and 12 deletions
|
@ -259,7 +259,7 @@ EOTEXT
|
||||||
$console = PhutilConsole::getConsole();
|
$console = PhutilConsole::getConsole();
|
||||||
$console->writeOut("**%s**\n", pht('REPOSITORY'));
|
$console->writeOut("**%s**\n", pht('REPOSITORY'));
|
||||||
|
|
||||||
$callsign = $this->getRepositoryCallsign();
|
$repo_name = $this->getRepositoryName();
|
||||||
|
|
||||||
$console->writeOut(
|
$console->writeOut(
|
||||||
"%s\n\n",
|
"%s\n\n",
|
||||||
|
@ -272,11 +272,11 @@ EOTEXT
|
||||||
$console->writeOut("%s\n\n", $reason);
|
$console->writeOut("%s\n\n", $reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($callsign) {
|
if ($repo_name) {
|
||||||
$console->writeOut(
|
$console->writeOut(
|
||||||
"%s\n",
|
"%s\n",
|
||||||
pht('This working copy is associated with the %s repository.',
|
pht('This working copy is associated with the %s repository.',
|
||||||
phutil_console_format('**%s**', $callsign)));
|
phutil_console_format('**%s**', $repo_name)));
|
||||||
} else {
|
} else {
|
||||||
$console->writeOut(
|
$console->writeOut(
|
||||||
"%s\n",
|
"%s\n",
|
||||||
|
|
|
@ -1107,8 +1107,17 @@ abstract class ArcanistWorkflow extends Phobject {
|
||||||
// Don't amend the current commit if it has already been published.
|
// Don't amend the current commit if it has already been published.
|
||||||
$repository = $this->loadProjectRepository();
|
$repository = $this->loadProjectRepository();
|
||||||
if ($repository) {
|
if ($repository) {
|
||||||
$callsign = $repository['callsign'];
|
$repo_id = $repository['id'];
|
||||||
$commit_name = 'r'.$callsign.$commit['commit'];
|
$commit_hash = $commit['commit'];
|
||||||
|
$callsign = idx($repository, 'callsign');
|
||||||
|
if ($callsign) {
|
||||||
|
// The server might be too old to support the new style commit names,
|
||||||
|
// so prefer the old way
|
||||||
|
$commit_name = "r{$callsign}{$commit_hash}";
|
||||||
|
} else {
|
||||||
|
$commit_name = "R{$repo_id}:{$commit_hash}";
|
||||||
|
}
|
||||||
|
|
||||||
$result = $this->getConduit()->callMethodSynchronous(
|
$result = $this->getConduit()->callMethodSynchronous(
|
||||||
'diffusion.querycommits',
|
'diffusion.querycommits',
|
||||||
array('names' => array($commit_name)));
|
array('names' => array($commit_name)));
|
||||||
|
@ -1686,18 +1695,17 @@ abstract class ArcanistWorkflow extends Phobject {
|
||||||
return idx($this->getRepositoryInformation(), 'phid');
|
return idx($this->getRepositoryInformation(), 'phid');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the callsign of the Phabricator repository this working copy
|
* Get the name of the Phabricator repository this working copy
|
||||||
* corresponds to. Returns `null` if no repository can be identified.
|
* corresponds to. Returns `null` if no repository can be identified.
|
||||||
*
|
*
|
||||||
* @return string|null Repository callsign, or null if no repository can be
|
* @return string|null Repository name, or null if no repository can be
|
||||||
* identified.
|
* identified.
|
||||||
*
|
*
|
||||||
* @task phabrep
|
* @task phabrep
|
||||||
*/
|
*/
|
||||||
final protected function getRepositoryCallsign() {
|
final protected function getRepositoryName() {
|
||||||
return idx($this->getRepositoryInformation(), 'callsign');
|
return idx($this->getRepositoryInformation(), 'name');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2013,12 +2021,12 @@ abstract class ArcanistWorkflow extends Phobject {
|
||||||
// If we know which repository we're in, try to tell Phabricator that we
|
// If we know which repository we're in, try to tell Phabricator that we
|
||||||
// pushed commits to it so it can update. This hint can help pull updates
|
// pushed commits to it so it can update. This hint can help pull updates
|
||||||
// more quickly, especially in rarely-used repositories.
|
// more quickly, especially in rarely-used repositories.
|
||||||
if ($this->getRepositoryCallsign()) {
|
if ($this->getRepositoryPHID()) {
|
||||||
try {
|
try {
|
||||||
$this->getConduit()->callMethodSynchronous(
|
$this->getConduit()->callMethodSynchronous(
|
||||||
'diffusion.looksoon',
|
'diffusion.looksoon',
|
||||||
array(
|
array(
|
||||||
'callsigns' => array($this->getRepositoryCallsign()),
|
'repositories' => array($this->getRepositoryPHID()),
|
||||||
));
|
));
|
||||||
} catch (ConduitClientException $ex) {
|
} catch (ConduitClientException $ex) {
|
||||||
// If we hit an exception, just ignore it. Likely, we are running
|
// If we hit an exception, just ignore it. Likely, we are running
|
||||||
|
|
Loading…
Reference in a new issue