1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2025-01-22 12:41:18 +01:00
phorge-arcanist/src
epriestley 5e70719306 [Wilds] Continue toward a generalized "arc alias" workflow
Summary:
Ref T13098. This leaves a lot of rough edges but nothing is overtly broken so here's where we're at so far:

Config sources get "scopes", like user configuration vs system configuration. The major reason for this is so that `arc set-config x y` can know where it's supposed to write. This is generalized enough that we can implement `arc set-config --system ...` and `arc alias --local ...` and so on relatively easily later, although scopes themselves are not modular (a third-party can't add a new type of config scope). Maybe we'll modularize this some day but it felt like that's probably YAGNI/overboard since we have no current use cases. For now, a source does not need to belong to any particular scope.

Config may be writable (like user config in `~/.arcrc`) or nonwritable (like `--config` flags). Writable config can now specify how to write to disk. Config files can actually write to disk now, although the only pathway for doing this that exists is via `arc alias`.

Aliases now parse properly and can write to disk. `arc alias` now lets you define aliases, and writes them to disk. **The first time you do this, your `~/.arcrc` file will be rewritten into a format which old `arc` can not read!** It's relatively easily to unmangle/repair these files so I'm planning to just let this happen.

When a toolset is invoked, it now reads and evaluates aliases. Aliases have a lot of new guard rails like suggesting the user try `arc draft` if they type `phage draft`, allowing alias chains, detecting cycles, and limiting chain length.

Workflows can provide help and argument lists in a more structured way. I've moved this to sub-objects: help is now on `WorkflowInformation` (instead of a bunch of different `getHelp()`, `getSynopsis()` methods) and arguments now have a `WorkflowArgument` object instead of a dictionary. I think this pattern is generally better for extending: it lets us add and change stuff with less impact (and greater explicitness) down the road.

`arc alias` now has reasonable help text and argument documentation. The `arc alias` (list) and `arc alias x` (details/remove) flows don't work yet but `arc alias x y` does.

`arc liberate` now uses the new help/argument stuff, although the help needs more beef eventually. I pruned a bunch of long-obsolete or questionable flags and renamed `--all` to `--clean` since `--all` sounds like "liberate all libraries", which is now the default behavior of `arc liberate`.

Test Plan:
You can now define chains of aliases. Finally!

```
$ arc draft4
 WARNING  Ignoring unrecognized configuration option ("hosts") from source: User Config File (/Users/epriestley/.arcrc).
 WARNING  Ignoring unrecognized configuration option ("load") from source: Project Config File (/Users/epriestley/dev/core/.arcconfig).
 ALIAS  arc draft4 -> arc draft3
 ALIAS  arc draft3 -> arc draft2
 ALIAS  arc draft2 -> arc diff
Usage Exception: Unrecognized argument '--draft'.
```

This also works now:

```
$ phage alias deploy-secure -- deploy --hosts secure001-4 --limit 1
```

General!

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13098

Differential Revision: https://secure.phabricator.com/D19697
2018-09-25 15:57:22 -07:00
..
__tests__ [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
aphront [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
auth [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
browse Implement a revision resolver for arc browse <commit> 2016-11-23 13:27:26 -08:00
cache [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
channel [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
conduit [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
config [Wilds] Continue toward a generalized "arc alias" workflow 2018-09-25 15:57:22 -07:00
configuration [Wilds] Make "arc liberate" run in the untamed wilds 2018-09-21 15:57:36 -07:00
console [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
daemon [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
difference Raise the intraline diff hard limit from 80 to 100 characters 2018-05-09 13:38:20 -07:00
differential Add "arc diff --draft" 2017-10-31 09:39:55 -07:00
docs [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
error [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
events [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
exception [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
extensions Changes to Arcanist for libphutil "extensions/" 2013-04-22 14:38:49 -07:00
filesystem [Wilds] Prepare for more modular configuration management 2018-09-21 16:54:00 -07:00
future [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
grammar [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
hgdaemon Fix a property name collision in ArcanistHgServerChannel 2017-02-16 05:44:10 -08:00
internationalization [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
ip [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
land Fix errors found by PHPStan 2017-02-16 13:54:43 +00:00
lexer [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
lint Merge branch "master" into "experimental". 2018-08-24 17:44:52 -07:00
loader Implement a revision resolver for arc browse <commit> 2016-11-23 13:27:26 -08:00
markup [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
moduleutils [Wilds] Allow "arc liberate" to liberate itself again 2018-09-21 16:50:58 -07:00
object [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
parser [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
phage [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
readableserializer [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
ref Merge branch "master" into "experimental". 2018-01-16 13:58:09 -08:00
repository Merge branch "master" into "experimental". 2018-08-24 17:44:52 -07:00
search [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
serviceprofiler [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
sprites [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
symbols [Wilds] Allow class loading to continue on failure 2018-09-21 16:56:36 -07:00
toolset [Wilds] Continue toward a generalized "arc alias" workflow 2018-09-25 15:57:22 -07:00
unit [ARCUNIT] Set the ConfigurationManager of ConfigurationDrivenUnitTestEngines 2018-06-05 20:58:47 +00:00
upload Upgrade "arc upload" to use SHA256 2017-04-04 16:56:35 -07:00
utils [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
workflow [Wilds] Continue toward a generalized "arc alias" workflow 2018-09-25 15:57:22 -07:00
workingcopy [Wilds] Prepare for more modular configuration management 2018-09-21 16:54:00 -07:00
xsprintf [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
__phutil_library_init__.php [Wilds] Remove libphutil 2018-09-21 16:38:53 -07:00
__phutil_library_map__.php [Wilds] Continue toward a generalized "arc alias" workflow 2018-09-25 15:57:22 -07:00