Page MenuHomePhabricator

D6264.id20763.diff
No OneTemporary

D6264.id20763.diff

diff --git a/arcanist/.phutil_module_cache b/arcanist/.phutil_module_cache
--- a/arcanist/.phutil_module_cache
+++ b/arcanist/.phutil_module_cache
@@ -1 +1 @@
-{"__symbol_cache_version__":11,"9780c82e3cf1cde0c46662563f00444f":{"have":{"class":{"ArcanistBitcoinABCConfiguration":13}},"need":{"function":{"pht":242},"class":{"ArcanistConfiguration":53,"ArcanistLintWorkflow":1652},"class\/interface":{"ArcanistWorkflow":385,"ArcanistNoEffectException":1371}},"xmap":{"ArcanistBitcoinABCConfiguration":["ArcanistConfiguration"]}},"ae5b7d3d6b8cf9598ce4abaf0cd56b21":{"have":{"class":{"ExtendedConfigurationDrivenLintEngine":19}},"need":{"function":{"newv":159,"pht":933},"class":{"ArcanistLintEngine":65,"ArcanistConfigurationDrivenLintEngine":171,"PhutilConsole":866},"class\/interface":{"ILintOnce":634}},"xmap":{"ExtendedConfigurationDrivenLintEngine":["ArcanistLintEngine"]}},"2809b09d2021203b43c57da33d1fe8bf":{"have":{"class":{"AssertWithSideEffectsLinter":210}},"need":{"function":{"pht":439},"class":{"ArcanistLinter":246,"ArcanistLintSeverity":926,"Filesystem":1170}},"xmap":{"AssertWithSideEffectsLinter":["ArcanistLinter"]}},"90a8b110dc475955f15bb81d37268cb5":{"have":{"class":{"AutoPEP8FormatLinter":75}},"need":{"function":{"pht":297,"execx":769,"id":1903},"class":{"ArcanistExternalLinter":104,"ArcanistLintMessage":1910,"Filesystem":1754,"ArcanistLinter":2017,"ArcanistLintSeverity":2095}},"xmap":{"AutoPEP8FormatLinter":["ArcanistExternalLinter"]}},"4c4adcac26dddfa5e350b85a40097755":{"have":{"class":{"BashShebangLinter":82}},"need":{"function":{"pht":281},"class":{"ArcanistLinter":108,"ArcanistLintSeverity":597,"Filesystem":837}},"xmap":{"BashShebangLinter":["ArcanistLinter"]}},"5ea58c19df0397ed8ee0f463d90d6c72":{"have":{"class":{"BoostDependenciesLinter":145}},"need":{"function":{"pht":330,"id":1440},"class":{"GlobalExternalLinter":177,"ArcanistLintMessage":1447,"Filesystem":609,"ArcanistLinter":1524,"ArcanistLintSeverity":1624}},"xmap":{"BoostDependenciesLinter":["GlobalExternalLinter"]}},"38f0c676bff5192a344464142caaa253":{"have":{"class":{"CHeaderLinter":99}},"need":{"function":{"pht":611},"class":{"ArcanistLinter":121,"ArcanistLintSeverity":1060,"Filesystem":1307}},"xmap":{"CHeaderLinter":["ArcanistLinter"]}},"9bb48ec0fe2e9ced8e27d42540d0571c":{"have":{"class":{"CheckDocLinter":106}},"need":{"function":{"pht":321,"id":1845},"class":{"GlobalExternalLinter":129,"ArcanistLintMessage":1852,"Filesystem":729,"ArcanistLinter":1900,"ArcanistLintSeverity":1986}},"xmap":{"CheckDocLinter":["GlobalExternalLinter"]}},"63d19a8745cb2e1200cc26488dc7ad25":{"have":{"class":{"CheckRpcMappingsLinter":131}},"need":{"function":{"pht":310,"id":1386},"class":{"GlobalExternalLinter":162,"ArcanistLintMessage":1393,"Filesystem":573,"ArcanistLinter":1443,"ArcanistLintSeverity":1544}},"xmap":{"CheckRpcMappingsLinter":["GlobalExternalLinter"]}},"24f5f28d739120159e375f587d3a68e4":{"have":{"class":{"ClangFormatLinter":79}},"need":{"function":{"pht":302,"execx":781,"id":2235},"class":{"ArcanistExternalLinter":105,"ArcanistLintMessage":2242,"Filesystem":2086,"ArcanistLinter":2349,"ArcanistLintSeverity":2427}},"xmap":{"ClangFormatLinter":["ArcanistExternalLinter"]}},"9c6223f7b59509a61f43d02842cc4bbc":{"have":{"class":{"CppVoidParameterLinter":119}},"need":{"function":{"pht":333},"class":{"ArcanistLinter":150,"ArcanistLintSeverity":648,"Filesystem":895}},"xmap":{"CppVoidParameterLinter":["ArcanistLinter"]}},"e4678dca551a849892aff414d3c4e24e":{"have":{"class":{"DoxygenLinter":91}},"need":{"function":{"pht":382},"class":{"ArcanistLinter":113,"ArcanistLintSeverity":695,"Filesystem":943}},"xmap":{"DoxygenLinter":["ArcanistLinter"]}},"75579a609dd975aa0226add52700c622":{"have":{"class":{"FileNameLinter":103}},"need":{"function":{"pht":307},"class":{"ArcanistLinter":126,"ArcanistLintSeverity":662,"Filesystem":968}},"xmap":{"FileNameLinter":["ArcanistLinter"]}},"9285ad9415f8ebe564f7119e5a72c559":{"have":{"class":{"FormatStringLinter":146}},"need":{"function":{"pht":377,"csprintf":1492,"id":1872},"class":{"ArcanistExternalLinter":173,"ArcanistLintMessage":1879,"Filesystem":827,"ArcanistLinter":1956,"ArcanistLintSeverity":2044}},"xmap":{"FormatStringLinter":["ArcanistExternalLinter"]}},"2e11dd9ad67e594f863bc46ac59ea37e":{"have":{"class":{"GlobalExternalLinter":199}},"need":{"class":{"ArcanistExternalLinter":228},"interface":{"ILintOnce":262}},"xmap":{"GlobalExternalLinter":["ArcanistExternalLinter","ILintOnce"]}},"b2403124ec3e8be6cb4d10bf0f6c4134":{"have":{"interface":{"ILintOnce":69}},"need":[],"xmap":[]},"40c4038155ed0fcad9047f0f6efd62a1":{"have":{"class":{"IncludeGuardLinter":98}},"need":{"function":{"pht":368},"class":{"ArcanistLinter":125,"ArcanistLintSeverity":721,"Filesystem":970}},"xmap":{"IncludeGuardLinter":["ArcanistLinter"]}},"2cbb6e7228d81557f777ad648704f343":{"have":{"class":{"IncludeQuotesLinter":100}},"need":{"function":{"pht":306},"class":{"ArcanistLinter":128,"ArcanistLintSeverity":663,"Filesystem":964}},"xmap":{"IncludeQuotesLinter":["ArcanistLinter"]}},"f151089cf79fdb8257b2272ed4782d88":{"have":{"class":{"IncludeSourceLinter":99}},"need":{"function":{"pht":391},"class":{"ArcanistLinter":127,"ArcanistLintSeverity":699,"Filesystem":938}},"xmap":{"IncludeSourceLinter":["ArcanistLinter"]}},"85936cbfc0decd1aae05001717b359da":{"have":{"class":{"LogLinter":116}},"need":{"function":{"pht":297},"class":{"ArcanistLinter":134,"ArcanistLintSeverity":580,"Filesystem":875}},"xmap":{"LogLinter":["ArcanistLinter"]}},"6f2f22dd0f259fb2eaa284b4fab3bc29":{"have":{"class":{"PythonFormatLinter":123}},"need":{"function":{"pht":353,"id":1838},"class":{"ArcanistExternalLinter":150,"ArcanistLintMessage":1845,"Filesystem":776,"ArcanistLinter":1970,"ArcanistLintSeverity":2053}},"xmap":{"PythonFormatLinter":["ArcanistExternalLinter"]}},"454160ed72e88797129d84ee589de304":{"have":{"class":{"PythonShebangLinter":87}},"need":{"function":{"pht":290},"class":{"ArcanistLinter":115,"ArcanistLintSeverity":614,"Filesystem":854}},"xmap":{"PythonShebangLinter":["ArcanistLinter"]}},"146347e1ef63e514a6634ada8de5b5c9":{"have":{"class":{"Qt5Linter":70}},"need":{"function":{"pht":258},"class":{"ArcanistLinter":88,"ArcanistLintSeverity":609,"Filesystem":836}},"xmap":{"Qt5Linter":["ArcanistLinter"]}},"c5bb63c97d3e04f6e0906d001bd3f8a2":{"have":{"class":{"ShellCheckLinter":95}},"need":{"function":{"pht":921,"id":2137},"class":{"ArcanistExternalLinter":120,"ArcanistLintMessage":2144,"ArcanistLintSeverity":646,"ArcanistLinter":2192}},"xmap":{"ShellCheckLinter":["ArcanistExternalLinter"]}},"729e2f379c278258d8040e156ba9da29":{"have":{"class":{"ShellLocaleLinter":107}},"need":{"function":{"pht":382},"class":{"ArcanistLinter":133,"ArcanistLintSeverity":734,"Filesystem":1044}},"xmap":{"ShellLocaleLinter":["ArcanistLinter"]}},"09a933fbbf135320585be52750d93831":{"have":{"class":{"StdintLinter":90}},"need":{"function":{"pht":280},"class":{"ArcanistLinter":111,"ArcanistLintSeverity":589,"Filesystem":897}},"xmap":{"StdintLinter":["ArcanistLinter"]}},"2f99c841a569f2029d13ea030dee007c":{"have":{"class":{"TestsLinter":103}},"need":{"function":{"pht":318,"id":2638},"class":{"ArcanistExternalLinter":123,"ArcanistLintMessage":2645,"Filesystem":776,"ArcanistLinter":2693,"ArcanistLintSeverity":2801}},"xmap":{"TestsLinter":["ArcanistExternalLinter"]}},"c9e595b23560664866ed4d6f2cbdb117":{"have":{"class":{"WhitespaceLinter":59}},"need":{"function":{"pht":258},"class":{"ArcanistLinter":84,"ArcanistLintSeverity":545,"Filesystem":791}},"xmap":{"WhitespaceLinter":["ArcanistLinter"]}},"4b824ccd108bd1def2257e17c92217f2":{"have":{"class":{"PythonFileEncodingLinter":111}},"need":{"function":{"pht":321},"class":{"ArcanistLinter":144,"ArcanistLintSeverity":685,"Filesystem":990}},"xmap":{"PythonFileEncodingLinter":["ArcanistLinter"]}},"706ed744ebdf4f2e46a71badc98a5277":{"have":{"class":{"LocaleDependenceLinter":160}},"need":{"function":{"pht":5610},"class":{"ArcanistLinter":191,"ArcanistLintSeverity":6113,"Filesystem":6359}},"xmap":{"LocaleDependenceLinter":["ArcanistLinter"]}}}
\ No newline at end of file
+{"__symbol_cache_version__":11,"9780c82e3cf1cde0c46662563f00444f":{"have":{"class":{"ArcanistBitcoinABCConfiguration":13}},"need":{"function":{"pht":242},"class":{"ArcanistConfiguration":53,"ArcanistLintWorkflow":1652},"class\/interface":{"ArcanistWorkflow":385,"ArcanistNoEffectException":1371}},"xmap":{"ArcanistBitcoinABCConfiguration":["ArcanistConfiguration"]}},"ae5b7d3d6b8cf9598ce4abaf0cd56b21":{"have":{"class":{"ExtendedConfigurationDrivenLintEngine":19}},"need":{"function":{"newv":159,"pht":933},"class":{"ArcanistLintEngine":65,"ArcanistConfigurationDrivenLintEngine":171,"PhutilConsole":866},"class\/interface":{"ILintOnce":634}},"xmap":{"ExtendedConfigurationDrivenLintEngine":["ArcanistLintEngine"]}},"454160ed72e88797129d84ee589de304":{"have":{"class":{"PythonShebangLinter":87}},"need":{"function":{"pht":290},"class":{"ArcanistLinter":115,"ArcanistLintSeverity":614,"Filesystem":854}},"xmap":{"PythonShebangLinter":["ArcanistLinter"]}},"38f0c676bff5192a344464142caaa253":{"have":{"class":{"CHeaderLinter":99}},"need":{"function":{"pht":611},"class":{"ArcanistLinter":121,"ArcanistLintSeverity":1060,"Filesystem":1307}},"xmap":{"CHeaderLinter":["ArcanistLinter"]}},"5ea58c19df0397ed8ee0f463d90d6c72":{"have":{"class":{"BoostDependenciesLinter":145}},"need":{"function":{"pht":330,"id":1440},"class":{"GlobalExternalLinter":177,"ArcanistLintMessage":1447,"Filesystem":609,"ArcanistLinter":1524,"ArcanistLintSeverity":1624}},"xmap":{"BoostDependenciesLinter":["GlobalExternalLinter"]}},"2cbb6e7228d81557f777ad648704f343":{"have":{"class":{"IncludeQuotesLinter":100}},"need":{"function":{"pht":306},"class":{"ArcanistLinter":128,"ArcanistLintSeverity":663,"Filesystem":964}},"xmap":{"IncludeQuotesLinter":["ArcanistLinter"]}},"2809b09d2021203b43c57da33d1fe8bf":{"have":{"class":{"AssertWithSideEffectsLinter":210}},"need":{"function":{"pht":439},"class":{"ArcanistLinter":246,"ArcanistLintSeverity":926,"Filesystem":1170}},"xmap":{"AssertWithSideEffectsLinter":["ArcanistLinter"]}},"c9e595b23560664866ed4d6f2cbdb117":{"have":{"class":{"WhitespaceLinter":59}},"need":{"function":{"pht":258},"class":{"ArcanistLinter":84,"ArcanistLintSeverity":545,"Filesystem":791}},"xmap":{"WhitespaceLinter":["ArcanistLinter"]}},"706ed744ebdf4f2e46a71badc98a5277":{"have":{"class":{"LocaleDependenceLinter":160}},"need":{"function":{"pht":5610},"class":{"ArcanistLinter":191,"ArcanistLintSeverity":6113,"Filesystem":6359}},"xmap":{"LocaleDependenceLinter":["ArcanistLinter"]}},"146347e1ef63e514a6634ada8de5b5c9":{"have":{"class":{"Qt5Linter":70}},"need":{"function":{"pht":258},"class":{"ArcanistLinter":88,"ArcanistLintSeverity":609,"Filesystem":836}},"xmap":{"Qt5Linter":["ArcanistLinter"]}},"2e11dd9ad67e594f863bc46ac59ea37e":{"have":{"class":{"GlobalExternalLinter":199}},"need":{"class":{"ArcanistExternalLinter":228},"interface":{"ILintOnce":262}},"xmap":{"GlobalExternalLinter":["ArcanistExternalLinter","ILintOnce"]}},"4c4adcac26dddfa5e350b85a40097755":{"have":{"class":{"BashShebangLinter":82}},"need":{"function":{"pht":281},"class":{"ArcanistLinter":108,"ArcanistLintSeverity":597,"Filesystem":837}},"xmap":{"BashShebangLinter":["ArcanistLinter"]}},"c5bb63c97d3e04f6e0906d001bd3f8a2":{"have":{"class":{"ShellCheckLinter":95}},"need":{"function":{"pht":921,"id":2137},"class":{"ArcanistExternalLinter":120,"ArcanistLintMessage":2144,"ArcanistLintSeverity":646,"ArcanistLinter":2192}},"xmap":{"ShellCheckLinter":["ArcanistExternalLinter"]}},"f151089cf79fdb8257b2272ed4782d88":{"have":{"class":{"IncludeSourceLinter":99}},"need":{"function":{"pht":391},"class":{"ArcanistLinter":127,"ArcanistLintSeverity":699,"Filesystem":938}},"xmap":{"IncludeSourceLinter":["ArcanistLinter"]}},"40c4038155ed0fcad9047f0f6efd62a1":{"have":{"class":{"IncludeGuardLinter":98}},"need":{"function":{"pht":368},"class":{"ArcanistLinter":125,"ArcanistLintSeverity":721,"Filesystem":970}},"xmap":{"IncludeGuardLinter":["ArcanistLinter"]}},"6f2f22dd0f259fb2eaa284b4fab3bc29":{"have":{"class":{"PythonFormatLinter":123}},"need":{"function":{"pht":353,"id":1838},"class":{"ArcanistExternalLinter":150,"ArcanistLintMessage":1845,"Filesystem":776,"ArcanistLinter":1970,"ArcanistLintSeverity":2053}},"xmap":{"PythonFormatLinter":["ArcanistExternalLinter"]}},"24f5f28d739120159e375f587d3a68e4":{"have":{"class":{"ClangFormatLinter":79}},"need":{"function":{"pht":302,"execx":781,"id":2235},"class":{"ArcanistExternalLinter":105,"ArcanistLintMessage":2242,"Filesystem":2086,"ArcanistLinter":2349,"ArcanistLintSeverity":2427}},"xmap":{"ClangFormatLinter":["ArcanistExternalLinter"]}},"9285ad9415f8ebe564f7119e5a72c559":{"have":{"class":{"FormatStringLinter":146}},"need":{"function":{"pht":377,"csprintf":1492,"id":1872},"class":{"ArcanistExternalLinter":173,"ArcanistLintMessage":1879,"Filesystem":827,"ArcanistLinter":1956,"ArcanistLintSeverity":2044}},"xmap":{"FormatStringLinter":["ArcanistExternalLinter"]}},"85936cbfc0decd1aae05001717b359da":{"have":{"class":{"LogLinter":116}},"need":{"function":{"pht":297},"class":{"ArcanistLinter":134,"ArcanistLintSeverity":580,"Filesystem":875}},"xmap":{"LogLinter":["ArcanistLinter"]}},"9bb48ec0fe2e9ced8e27d42540d0571c":{"have":{"class":{"CheckDocLinter":106}},"need":{"function":{"pht":321,"id":1845},"class":{"GlobalExternalLinter":129,"ArcanistLintMessage":1852,"Filesystem":729,"ArcanistLinter":1900,"ArcanistLintSeverity":1986}},"xmap":{"CheckDocLinter":["GlobalExternalLinter"]}},"90a8b110dc475955f15bb81d37268cb5":{"have":{"class":{"AutoPEP8FormatLinter":75}},"need":{"function":{"pht":297,"execx":769,"id":1903},"class":{"ArcanistExternalLinter":104,"ArcanistLintMessage":1910,"Filesystem":1754,"ArcanistLinter":2017,"ArcanistLintSeverity":2095}},"xmap":{"AutoPEP8FormatLinter":["ArcanistExternalLinter"]}},"b2403124ec3e8be6cb4d10bf0f6c4134":{"have":{"interface":{"ILintOnce":69}},"need":[],"xmap":[]},"1dabcf7e27dc93d597d5cdc705efc279":{"have":{"class":{"PythonFileEncodingLinter":111}},"need":{"function":{"pht":321},"class":{"ArcanistLinter":144,"ArcanistLintSeverity":685,"Filesystem":990}},"xmap":{"PythonFileEncodingLinter":["ArcanistLinter"]}},"09a933fbbf135320585be52750d93831":{"have":{"class":{"StdintLinter":90}},"need":{"function":{"pht":280},"class":{"ArcanistLinter":111,"ArcanistLintSeverity":589,"Filesystem":897}},"xmap":{"StdintLinter":["ArcanistLinter"]}},"63d19a8745cb2e1200cc26488dc7ad25":{"have":{"class":{"CheckRpcMappingsLinter":131}},"need":{"function":{"pht":310,"id":1386},"class":{"GlobalExternalLinter":162,"ArcanistLintMessage":1393,"Filesystem":573,"ArcanistLinter":1443,"ArcanistLintSeverity":1544}},"xmap":{"CheckRpcMappingsLinter":["GlobalExternalLinter"]}},"2f99c841a569f2029d13ea030dee007c":{"have":{"class":{"TestsLinter":103}},"need":{"function":{"pht":318,"id":2638},"class":{"ArcanistExternalLinter":123,"ArcanistLintMessage":2645,"Filesystem":776,"ArcanistLinter":2693,"ArcanistLintSeverity":2801}},"xmap":{"TestsLinter":["ArcanistExternalLinter"]}},"729e2f379c278258d8040e156ba9da29":{"have":{"class":{"ShellLocaleLinter":107}},"need":{"function":{"pht":382},"class":{"ArcanistLinter":133,"ArcanistLintSeverity":734,"Filesystem":1044}},"xmap":{"ShellLocaleLinter":["ArcanistLinter"]}},"75579a609dd975aa0226add52700c622":{"have":{"class":{"FileNameLinter":103}},"need":{"function":{"pht":307},"class":{"ArcanistLinter":126,"ArcanistLintSeverity":662,"Filesystem":968}},"xmap":{"FileNameLinter":["ArcanistLinter"]}},"e4678dca551a849892aff414d3c4e24e":{"have":{"class":{"DoxygenLinter":91}},"need":{"function":{"pht":382},"class":{"ArcanistLinter":113,"ArcanistLintSeverity":695,"Filesystem":943}},"xmap":{"DoxygenLinter":["ArcanistLinter"]}},"9c6223f7b59509a61f43d02842cc4bbc":{"have":{"class":{"CppVoidParameterLinter":119}},"need":{"function":{"pht":333},"class":{"ArcanistLinter":150,"ArcanistLintSeverity":648,"Filesystem":895}},"xmap":{"CppVoidParameterLinter":["ArcanistLinter"]}},"448cd3c88fd17f8c69ed72bf8c60eafc":{"have":{"class":{"ArcanistLandBotWorkflow":91}},"need":{"function":{"phutil_console_format":265,"pht":1577,"execx":2181},"class":{"ArcanistWorkflow":123,"ArcanistUsageException":2251}},"xmap":{"ArcanistLandBotWorkflow":["ArcanistWorkflow"]}}}
\ No newline at end of file
diff --git a/arcanist/__phutil_library_map__.php b/arcanist/__phutil_library_map__.php
--- a/arcanist/__phutil_library_map__.php
+++ b/arcanist/__phutil_library_map__.php
@@ -10,6 +10,7 @@
'__library_version__' => 2,
'class' => array(
'ArcanistBitcoinABCConfiguration' => 'configuration/ArcanistBitcoinABCConfiguration.php',
+ 'ArcanistLandBotWorkflow' => 'workflow/ArcanistLandBotWorkflow.php',
'AssertWithSideEffectsLinter' => 'linter/AssertWithSideEffectsLinter.php',
'AutoPEP8FormatLinter' => 'linter/AutoPEP8Linter.php',
'BashShebangLinter' => 'linter/BashShebangLinter.php',
@@ -43,6 +44,7 @@
'function' => array(),
'xmap' => array(
'ArcanistBitcoinABCConfiguration' => 'ArcanistConfiguration',
+ 'ArcanistLandBotWorkflow' => 'ArcanistWorkflow',
'AssertWithSideEffectsLinter' => 'ArcanistLinter',
'AutoPEP8FormatLinter' => 'ArcanistExternalLinter',
'BashShebangLinter' => 'ArcanistLinter',
diff --git a/arcanist/workflow/ArcanistLandBotWorkflow.php b/arcanist/workflow/ArcanistLandBotWorkflow.php
new file mode 100644
--- /dev/null
+++ b/arcanist/workflow/ArcanistLandBotWorkflow.php
@@ -0,0 +1,179 @@
+<?php
+
+/**
+ * Lands a revision by sending it to a remote land bot service.
+ */
+final class ArcanistLandBotWorkflow extends ArcanistWorkflow {
+
+ public function getWorkflowName() {
+ return 'land-via-bot';
+ }
+
+ public function getCommandSynopses() {
+ return phutil_console_format(<<<EOTEXT
+ **land-via-bot** [__options__] [__ref__]
+EOTEXT
+ );
+ }
+
+ public function getCommandHelp() {
+ return phutil_console_format(<<<EOTEXT
+ Publish an accepted revision after review. This command is the last
+ step in the standard Differential code review workflow.
+
+ This command queues a revision to be landed by a remote land bot,
+ changes for which are sitting in __ref__, which is usually the name
+ of a local branch. Without __ref__, the current working copy state
+ will be used.
+
+ Prior to landing the revision, the land bot may run smoke tests and
+ other checks to ensure master is always in a stable state. The land
+ bot may also make automated adjustments to your patch as necessary.
+
+ With **--hold** or **--preview**, execution will be similar to
+ passing the same options to 'arc land'.
+EOTEXT
+ );
+ }
+
+ public function requiresWorkingCopy() {
+ return true;
+ }
+
+ public function requiresConduit() {
+ return true;
+ }
+
+ public function requiresAuthentication() {
+ return true;
+ }
+
+ public function requiresRepositoryAPI() {
+ return true;
+ }
+
+ public function getArguments() {
+ return array(
+ 'hold' => array(
+ 'help' => pht(
+ 'Prepare the change to be pushed to the land queue, but do not '.
+ 'actually push it.'),
+ ),
+ 'preview' => array(
+ 'help' => pht(
+ 'Prints the commits that would be landed. Does not actually modify '.
+ 'or land the commits.'),
+ ),
+ 'revision' => array(
+ 'param' => 'id',
+ 'help' => pht(
+ 'Land a specific revision, rather than inferring the revision '.
+ 'based on branch content.'),
+ ),
+ '*' => 'branch',
+ );
+ }
+
+ public function run() {
+ // Make sure gpg is installed
+ try {
+ execx('command -v gpg');
+ } catch (Exception $e) {
+ throw new ArcanistUsageException(pht(
+ 'gpg not found. Try installing it first.'));
+ }
+
+ // Determine the branch you are currently on so we can return to it later
+ $repositoryApi = $this->getRepositoryAPI();
+ $oldBranch = $repositoryApi->getBranchName();
+ if (!strlen($oldBranch)) {
+ $oldBranch = $repositoryApi->getWorkingCopyRevision();
+ }
+
+ // Run the default land workflow to take advantage of various sanity checks
+ // and fetch the revision ID if it's not set via --revision.
+ $landArgs = array();
+ if ($this->getArgument('preview')) {
+ array_push($landArgs, '--preview');
+ } else {
+ // Always hold the revision since we are not using 'arc land' to actually
+ // land the change.
+ array_push($landArgs, '--hold');
+ }
+
+ $revision = $this->getArgument('revision');
+ if ($revision) {
+ array_push($landArgs, '--revision');
+ array_push($landArgs, $revision);
+ }
+
+ $branch = $this->getArgument('branch');
+ if ($branch) {
+ array_push($landArgs, $branch);
+ }
+
+ $landWorkflow = $this->buildChildWorkflow('land', $landArgs);
+ $landWorkflow->run();
+
+ if ($this->getArgument('preview')) {
+ return 0;
+ }
+
+ // Whether --revision was set or not, we need a formatted revision ID
+ $revision = 'D' . $landWorkflow->getRevisionDict()['id'];
+
+ if ($this->getArgument('hold')) {
+ echo phutil_console_format(pht(
+ 'Revision %s will not be queued with the land bot.', $revision) . "\n");
+ return 0;
+ }
+
+ // Checkout the branch you were on previously
+ $repositoryApi->execxLocal('checkout %s', $oldBranch);
+
+ // Encrypt your Conduit token to securely pass it to the land bot
+ $workingCopy = $repositoryApi->getWorkingCopyIdentity();
+ $pubkeyFile = $workingCopy->getProjectPath(
+ './contrib/source-control-tools/land-patch.pub');
+ $token = $this->getConduit()->getConduitToken();
+ list($encryptedToken) = execx(
+ 'echo %s | gpg --armor -o- --encrypt --recipient-file %s',
+ $token, $pubkeyFile);
+ unset($token);
+
+ // Prepare cURL request to land bot
+ $ch = curl_init('https://buildbot-prod.bitframe.org/land');
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
+ 'Content-Type:application/json', 'Accept:application/json'));
+ curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(array(
+ "revision" => $revision,
+ "conduitToken" => $encryptedToken)));
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+
+ echo phutil_console_format(pht(
+ 'Pushing revision %s to land bot queue...', $revision) . "\n\n");
+
+ $response = curl_exec($ch);
+ if (!$response) {
+ throw new ArcanistUsageException(pht(
+ 'Error pushing to land bot queue: %s', curl_error($ch)) . "\n");
+ }
+
+ $jsonResponse = json_decode($response);
+ if (!$jsonResponse) {
+ throw new ArcanistUsageException(pht(
+ 'JSON decoding error: %d', json_last_error()) . "\n");
+ }
+
+ echo phutil_console_format("<bg:blue>** " .
+ pht('Your revision is in the queue:') . " **</bg>\n\n");
+ echo phutil_console_format(
+ pht('Revision:') . "\thttps://reviews.bitcoinabc.org/%s\n", $revision);
+ echo phutil_console_format(pht('Build log:') . "\t%s\n",
+ $jsonResponse->webUrl . '&tab=buildLog');
+
+ curl_close($ch);
+ return 0;
+ }
+
+}
diff --git a/contrib/source-control-tools/land-patch.pub b/contrib/source-control-tools/land-patch.pub
new file mode 100644
--- /dev/null
+++ b/contrib/source-control-tools/land-patch.pub
@@ -0,0 +1,52 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+
+mQINBF7CygABEADhBW9cZD/fZ8bIGXEVOvhqzgZfEkGTYAR0F+7sFNJdDl6Wp5Gb
+3/osNqNkP73h3eo1PwTGwpnPAxqBnR3uEXVN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MSSfVkioOMN7OfS5MHbs+64A3Ur8hy+aiI1uLu4f57u/2B6egWdwjxhi0J5q
+wcB0RwARAQABiQI8BBgBCgAmFiEEOTpCSDYWLFw3DTh//iA60jLqwO4FAl7CygAC
+GwwFCQPCZwAACgkQ/iA60jLqwO4b2RAAnPFtvzjMsGg9UuKRyM6W+zt0noLCvt+/
+X/Gm4nKdKfYxwMmDJ79mxSBNGVmz9TO7BLDgfz2ml2+aZ5CPuUoSAeuM1WcFjrQT
+YK5J3cE0RCt7Sisams3LYkFoPoNnKn1xURoFFiQSQiWx94M4OS+gpeSjf3gj7p0N
+J3hiNuPIoY/OCV7zHPP9w0hp3cw1/3bN9YMTOumGECvFlbJbBrZ7MWzqcBT77Aoa
+zuyPTLZFpvkeV/DNS8uJJtRfP6fPTFeI0u37YuMl4rCtrQAfugbsuqG6mO5lUl9C
+SE+Y4MfXwKIJX7Zf0fFoFydH6aAmhyIhpXftMn5HqiXEIGTI/0rUD8AH3v6nHjVp
+KTrW7AWd+3uU95i3jKXsyalx7O+v8xUbpd/UH1J3xKamEqYVs+hkbkuEYOP0Yrsn
+AuGqnnV2pMbP0eV9ro/FGa6RdQf/REe5/R4nJ7BfGmk9ZOoTiX86QtaATrAh7u9W
+a0eNqU7fKoVQKP/1uzZVtTDHZVfgTB6PonFWKjRJsYVaxZlUnCD/CCy/iyADdisZ
+EzgjVOjSULGcP2ELBkZ4fVsa5d0a7TL2XwDgw7SST2JvaWnKixfWajaZmux6bqVN
+5+Gs6V+/uPMRjLwtr+Q3VP5OpOphdW1Jk1RNw0iNZ9o6x1hO/5oL1vu0FYW97exm
+Wq5PzacLw0E=
+=CREh
+-----END PGP PUBLIC KEY BLOCK-----

File Metadata

Mime Type
text/plain
Expires
Tue, May 20, 21:15 (15 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5865937
Default Alt Text
D6264.id20763.diff (25 KB)

Event Timeline