1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-08 16:02:39 +01:00
Commit graph

2356 commits

Author SHA1 Message Date
epriestley
01e91dc260 Clean up some service profiler behavior in Conduit futures
Summary:
Correct two minor Conduit future issues:

  - FutureAgent shows up in the trace log as "<mystery>". Since it isn't doing anything useful, solve the mystery and drop it from the log.
  - Simply the ConduitFuture code for interacting with the service profiler now that a more structured integration is available.

Test Plan: Ran "arc branches --trace", saw conduit calls and no more "<mystery>" clutter.

Differential Revision: https://secure.phabricator.com/D21388
2020-07-01 06:37:31 -07:00
epriestley
b8a5191e3b Improve login/auth messages from Arcanist toolset workflows
Summary:
See PHI1802. After D21384, "arc land" and similar with no credentials now properly raise a useful exception, but it isn't formatted readably.

Update the display code to make it look prettier.

Test Plan: Ran "arc land" with no and invalid credentials, got properly formatted output.

Differential Revision: https://secure.phabricator.com/D21387
2020-07-01 06:37:31 -07:00
epriestley
65e4927dca Drop intended support for "--anonymous" from Arcanist Toolsets
Summary:
Currently, modern "arc" workflows accept and parse "--anonymous" but don't do anything with it.

I intend to move away from anonymous workflows, which only really supported a tiny subset of unusual workflows on open source installs but added significant complexity to login/auth behavior.

Drop support for this flag.

Test Plan: Grepped for "anonymous", didn't turn up any relevant hits.

Differential Revision: https://secure.phabricator.com/D21386
2020-07-01 06:37:31 -07:00
epriestley
17f2668d1f When tab-completing "arc" commands, suggest paths if the argument is empty and a path wildcard argument exists
Summary:
Currently, if you type "arc upload <tab>", we do not autocomplete the working directory. We should, but the "current argument" is the empty string and that's technically a prefix of every flag, so we suggest that you might want a flag instead.

You probably don't. Suggest paths in this case.

Test Plan:
  - Ran "arc upload <tab>", saw path completions.
  - Ran "arc land <tab>" (this workflow does NOT take paths as arguments), saw flag completions.

Differential Revision: https://secure.phabricator.com/D21385
2020-07-01 06:37:31 -07:00
epriestley
7e9f80971b Implement Conduit login prompt behavior as a pure FutureProxy, not a Future-like object
Summary:
See PHI1802. Currently, we can't raise a "you must login" error in a generic way at the beginning of a workflow because we don't know if a workflow needs credentials or not.

For example, "arc help" does not need credentials but "arc diff" does.

Additionally, some actual Conduit calls do not need credentials ("conduit.ping", "conduit.getcapabilities") and others do.

Although I'd like to simplify this eventually and move away from anonymous/unauthenticated "arc", this isn't trivial today. It's also possible for third-party code to add authenticated calls to "arc help", etc., so even if we could execute these tests upfront it's not obvious we'd want to.

So, for now, we raise "you must login" at runtime, when we receive an authentication error from Conduit.

This got implemented for Toolsets in a well-intentioned but not-so-great way somewhere in wilds/experimental, with an "ArcanistConduitCall" that behaves a bit like a future but is not really a future. This implementation made more sense when ConduitEngine was serving as a future engine, and FutureProxy could not rewrite exceptions.

After the Toolsets code was first written, ConduitEngine has stopped serving as a future engine (this is now in "HardpointEngine"). Since HardpointEngine needs a real future, this "show the user a login message" code gets bypassed. This results in user-visible raw authentication exceptions on some workflows:

```
[2020-06-30 21:39:53] EXCEPTION: (ConduitClientException) ERR-INVALID-SESSION: Session key is not present. at [<arcanist>/src/conduit/ConduitFuture.php:76]
```

To fix this:

  - Allow FutureProxy to rewrite exceptions (see D21383).
  - Implement "ArcanistConduitCall" as a FutureProxy, not a future-like object.
  - Collapse the mixed-mode future/not-quite-a-future APIs into a single "real future" API.

Test Plan:
- Created a paste with "echo hi | arc paste --".
- Uploaded a file with "arc upload".
- Called a raw method with "echo {} | arc call-conduit conduit.ping --".
- Invoked hardpoint behavior with "arc branches".
- Grepped for calls to either "resolveCall()" method, found none.
- Grepped for calls to "newCall()", found none.
- Grepped for "ArcanistConduitCall", found no references.

Then:

- Removed my "~/.arcrc", ran "arc land", got a sensible and human-readable (but currently ugly) exception instead of a raw authentication stack trace.

Differential Revision: https://secure.phabricator.com/D21384
2020-07-01 06:37:31 -07:00
epriestley
2daf9b16ae Improve resolution behaviors of FutureProxy
Summary:
See PHI1764. See PHI1802. Address two resolution behaviors for FutureProxy:

  - FutureProxy may throw an exception directly from iteration via "FutureIterator" (see PHI1764). This is wrong: futures should throw only when resolved.
  - FutureProxy can not change an exception into a result, or a result into an exception, or an exception into a different exception. Being able to proxy the full range of result and exception behavior is useful, particularly for Conduit (see PHI1802).

Make "FutureProxy" more robust in how it handles exceptions from proxied futures.

Test Plan:
Used this script to raise an exception during result processing:

```
<?php

require_once 'support/init/init-script.php';

final class ThrowingFutureProxy
  extends FutureProxy {

  protected function didReceiveResult($result) {
    throw new Exception('!');
  }

}

$future = new ImmediateFuture('quack');
$proxy = new ThrowingFutureProxy($future);
$iterator = new FutureIterator(array($proxy));

foreach ($iterator as $resolved) {
  try {
    $resolved->resolve();
  } catch (Exception $ex) {
    echo "Caught exception properly on resolution.\n";
  }
}
```

Before this change, the exception is raised in the `foreach()` loop. After this change, the exception is raised at resolution time.

Differential Revision: https://secure.phabricator.com/D21383
2020-07-01 06:37:30 -07:00
epriestley
98ca5cfa81 Remove an unused method in "ArcanistUploadWorkflow"
Summary: This method is private and has no callers. The code has moved to "FileUploader" in a prior change.

Test Plan: Grepped for callers, found none.

Differential Revision: https://secure.phabricator.com/D21382
2020-07-01 06:37:30 -07:00
epriestley
4b8a32ee02 Give Mercurial more plausible marker behavior
Summary: Ref T13546. Fixes some issues where marker selection in Mercurial didn't work, and selects "draft()" as the set of commits to show, which is at least somewhat reasonable.

Test Plan: Ran "arc branches" and "arc bookmarks" in Mercurial, got more reasonable output.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21380
2020-06-30 15:50:07 -07:00
epriestley
8c95dc0d29 Support date-range commit graph queries, and multiple disjoint commits in Git
Summary: Ref T13546. Allow the commit graph to be queried by date range, and Git to be queried for multiple disjoint commits.

Test Plan: Ran "arc branches" and future code which searches for alternate commit ranges for revisions.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21379
2020-06-30 15:50:06 -07:00
epriestley
c7093a2e57 In "arc branches", group linear sequences of published revisions together
Summary: Ref T13546. If your history includes a long linear sequence of published revisions, summarize them.

Test Plan: Ran "arc branches", saw better summarization of linear published revision sequences.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21367
2020-06-30 15:50:06 -07:00
epriestley
5d305909eb When a commit graph set has many commits, summarize them
Summary: Ref T13546. In cases where a given set has a large number of commits, summarize them in the output.

Test Plan: Ran "arc branches", saw long lists of commits (like the history of "stable" summarized).

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21366
2020-06-30 15:50:06 -07:00
epriestley
0ad3222d59 Improve grid layout in "arc branches" at various terminal widths
Summary: Ref T13546. Make "arc branches" use a flexible grid width and try to match the content to the display width in a reasonable way.

Test Plan: Ran "arc branches" at various terminal widths, got generally sensible output.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21365
2020-06-30 15:50:06 -07:00
epriestley
10c4a551ae Remove implicit sorting from "MarkerRefQuery"
Summary: Ref T13546. This is no longer necessary after the introduction of "msortv_natural()", which can handle natural string sorting.

Test Plan: Ran "arc branches", saw the same sorting applied.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21364
2020-06-30 15:50:05 -07:00
epriestley
cd19216ea2 Render "arc markers" workflows as a tree, not a list
Summary:
Ref T13546. Currently, each "land" workflow executes custom graph queries to find commits: move toward abstracting this logic.

The "land" workflow also has a potentially dangerous behavior: if you have "master > A > B > C" and "arc land C", it will land A, B, and C. However, an updated version of A or B may exist elsewhere in the working copy. If it does, "arc land" will incorrectly land an out-of-date set of changes.

To find newer versions of "A" and "B", we need to search backwards from all local markers to the nearest outgoing marker, then compare the sets of changes we find to the sets of changes selected by "arc land".

This is also roughly the workflow that "arc branches", etc., need to show local markers as a tree, and starting in "arc branches" allows the process to be visualized.

As implemented here ,this rendering is still somewhat rough, and the selection of "outgoing markers" isn't good. In Mercurial, we may plausibly be able to use phase markers, but in Git we likely can't guess the right behavior automatically and probably need additional configuration.

Test Plan: Ran "arc branches" and "arc bookmarks" in Git and Mercurial.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21363
2020-06-30 15:50:05 -07:00
epriestley
80f5166b70 Identify published commits in working copies by using remote configuration
Summary:
Ref T13546. When running "arc branches", we want to show all unpublished commits. This is often a different set of commits than "commits not present in any remote".

Attempt to identify published commits by using the permanent ref rules in Phabricator.

Test Plan: Ran "arc look published", saw sensible published commits in Git.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21378
2020-06-30 14:56:34 -07:00
epriestley
50f7a853b5 Load and map repository objects for remote URIs
Summary:
Ref T13546. Query and associate known Phabricator repositories to working copy remotes by normalizing and comparing URIs.

This primarily gives us access to "permanentRefRules" so we can tell which branches have published changes.

Test Plan: Ran "arc look remotes" in Git and Mercurial working copies, saw repositories map properly.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21377
2020-06-30 13:43:14 -07:00
epriestley
6bf7a40358 Provide "arc look", a user-facing inspection command
Summary:
Ref T13546. Currently, "arc which" provides some amount of inspection but it generally isn't very helpful to users and is too limited and inflexible. "arc inspect" is an internal/debugging workflow.

The new "arc look" is much more aggressively unhelpful.

Test Plan: I'm not sure if this command should allow you to continue at night, because it's too dark.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21376
2020-06-30 13:08:31 -07:00
epriestley
ffb027e85c Support generating remote refs in Git
Summary: Ref T13546. Allow construction of remote refs in Git; previously they were only supported in Mercurial.

Test Plan: Ran "arc inspect remote(origin)" in Git, got a ref.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21375
2020-06-30 13:08:19 -07:00
epriestley
89f9eb66a7 Support inspection of remote refs with "arc inspect remote(...)"
Summary: Ref T13546. Expose remote refs for inspection via "arc inspect". For now, this only works in Mercurial.

Test Plan: Ran "arc inspect remote(default)" in Mercurial, got a ref out.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21374
2020-06-30 13:07:25 -07:00
epriestley
b19985a4bd Copy repository URI normalization code from Phabricator to Arcanist
Summary: Ref T13546. Move toward smarter remote repository lookup by providing URI normalization code in Arcanist. This diff duplicates code from Phabricator; the next change will collapse it.

Test Plan: Ran unit tests.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21372
2020-06-30 13:07:12 -07:00
epriestley
c53c05e5b2 Introduce "phutil_partition()" and natural case sorting for "msortv(...)"
Summary:
Ref T13546. Pull some small utility changes out of the deeper stack of "land/markers" changes.

"phutil_partition()" makes it easier to write code that loops over a list grouping elements, then acts on each group. This kind of code is not terribly common, but often feels awkward when implemented with raw primitives.

"msortv()" can support "natural" sorting, which sorts "feature1", "feature2", ..., "feature10" in a more human-readable order.

Test Plan: Ran unit tests, used new behaviors elsewhere in "arc markers" workflows.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21371
2020-06-30 06:45:03 -07:00
epriestley
33484b43c9 Introduce "GridView", an updated version of "ConsoleTableView"
Summary:
Ref T13546. In a future change, I'm providing a fancier version of "arc branches" that requires more sophisticated table rendering.

Implement a new view which can do some fancier things, like handle alignment of multi-line table cells.

Test Plan: See future changes.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21360
2020-06-30 06:31:24 -07:00
epriestley
98bf58db4a Correct a leftover reference to "--keep-branch"
Summary: See <https://discourse.phabricator-community.org/t/arc-land-keep-branch-no-longer-works/4004/>. This flag is now "--keep-branches".

Test Plan: Grepped for "keep-branch".

Differential Revision: https://secure.phabricator.com/D21356
2020-06-30 06:30:51 -07:00
epriestley
f52222ad19 Add more "RepositoryRef" legacy status mappings
Summary: Ref T13546. The old "differential.query" call is still used to fill refs when all we have locally is hashes. Add some mappings to improve the resulting refs.

Test Plan: Viewed "arc branches", saw statuses colored more consistently.

Reviewers: ptarjan

Reviewed By: ptarjan

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21355
2020-06-30 06:30:21 -07:00
epriestley
b0a9ef8351 In "arc land" under Git, confirm branch creation
Summary: Ref T13546. If "arc land" would create a branch, warn the user before it does.

Test Plan: Ran "arc land --onto mtarse", a typo of "master".

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21354
2020-06-30 06:29:51 -07:00
epriestley
33bb0acf97 Collect scattered implementations of "getDisplayHash()" into RepositoryAPI
Summary: Ref T13546. All of LandEngine, LocalState, and RepositoryAPI implement "getDisplayHash()". Always use the RepositoryAPI implementation.

Test Plan: Grepped for symbols.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21353
2020-06-30 06:28:38 -07:00
epriestley
63f2e667b9 Update "arc land" display of build failures, and rename "DisplayRef" to "RefView"
Summary:
Ref T13546. Show ongoing and failed builds more clearly in "arc land" output.

Also rename "DisplayRef" (which is not a "Ref") to "RefView" with the goal of improving clarity, and let callers "build...()" it so they can add more status, etc., information.

Get rid of "[DisplayRef|RefView]Interface". In theory, future refs (say, in Phabricator) might not do anything here, but every Ref just ends up implementing it. This could perhaps be subclassed more narrowly in the future if necessary.

Test Plan: Ran "arc land", grepped for various symbols.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21352
2020-06-30 06:27:56 -07:00
epriestley
33dfa859d8 On Windows, don't try to set "stdin" nonblocking, as it does not work
Summary:
See <https://discourse.phabricator-community.org/t/arc-land-fail-unable-to-set-stdin-nonblocking/4006/>.

See also <https://bugs.php.net/bug.php?id=34972>.

Note that you can't ^C during a prompt (or at any other time) in Windows currently, see T13549.

Test Plan: On Windows, hit a prompt in "arc land", then answered it successfully.

Differential Revision: https://secure.phabricator.com/D21358
2020-06-12 14:29:52 -07:00
epriestley
1e09a0ee7e When a linter raises a message at a nonexistent line, don't fatal during rendering
Summary:
See PHI1782. If a linter raises a message at a line which does not exist in the file, render a confused warning rather than fataling.

This is a long-existing issue which was exacerbated by D21044.

Test Plan: Modified a linter to raise issues at line 99999. Before change: fatal in console rendering. After change: reasonable rendering.

Differential Revision: https://secure.phabricator.com/D21357
2020-06-12 12:31:02 -07:00
epriestley
92f860ae9b Improve "--hold", save/restore state, bookmark creation, and some warnings for "arc land" in Mercurial
Summary:
Ref T13546. Ref T9948.

  - Make "--hold" show the same set of commands to manually push that the normal workflow would use.
  - Make save/restore state work.
  - Make bookmark creation prompt for confirmation.
  - Improve / provide some additional warnings and help text.

Test Plan: Ran various increasingly complex "arc land" workflows, e.g. "arc land --hold --onto fauxmark1 --onto fauxmark2 --into default . --revision 118 --trace"

Maniphest Tasks: T13546, T9948

Differential Revision: https://secure.phabricator.com/D21351
2020-06-10 17:31:51 -07:00
epriestley
50c534b591 Correct some minor "arc land" workflow issues in Mercurial
Summary: Ref T9948. Ref T13546. Clean up some minor behaviors to allow "arc land" to function in the simplest cases again. Also, do a capability test for "prune" rather than just falling back.

Test Plan: Ran "arc land <mark>" in Mercurial, got changes pushed.

Maniphest Tasks: T13546, T9948

Differential Revision: https://secure.phabricator.com/D21350
2020-06-10 17:31:50 -07:00
epriestley
86951ad067 Use a "branchmap" call to identify remote branches in "arc-hg"
Summary:
Ref T9948. Ref T13546. To identify remote branch heads -- not just modified heads -- use "branchmap" like "hg outgoing" does.

I wasn't able to find any other way to get what we want: for example, with a bundlerepo, "peer.heads()" and "peer.changelog.heads()" include local branches which are not present in the remote.

It generally seems difficult (perhaps impossible?) to distinguish between these cases by using "getremotechanges()":

  - branch X exists at position Y in both the local and remote;
  - branch X exists at positino Y in the local, but not the remote.

In any case, this seems to work properly and //should// do less work than "getremotechanges()" since we don't need to pull as much data over the wire.

Test Plan: Ran "hg arc-ls-markers" in various repositories, got what appeared to be a faithful representation of the remote branch and bookmark state.

Maniphest Tasks: T13546, T9948

Differential Revision: https://secure.phabricator.com/D21349
2020-06-10 17:31:50 -07:00
epriestley
488a24c40a In "arc land" in Mercurial, inch closer to making complex branch/bookmark workflows function
Summary:
Ref T9948. Ref T13546. This change moves toward a functional "arc land" in Mercurial.

Because of how "bundlerepo.getremotechanges()" works, "hg arc-ls-markers" does not actually list markers in the remote that aren't different from local markers so it's hard to get anywhere with this.

Test Plan: Got somewhat-encouraging output from "arc land" and "hg arc-ls-markers", but too many things are still broken for this to really work yet.

Maniphest Tasks: T13546, T9948

Differential Revision: https://secure.phabricator.com/D21348
2020-06-10 17:31:50 -07:00
epriestley
727d73fec9 In "arc land", fix some coarse issues with build warnings
Summary: Ref T13546. In the new "arc land": actually reach build warnings; and show buildable URIs.

Test Plan: Ran "arc land ..." with intentionally broken builds, got more useful build warnings.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21347
2020-06-10 10:27:18 -07:00
epriestley
705c48effc Realign "arc land" closed/published warning around more modern language
Summary: Ref T13546. The modern constant from the modern API method for this state is "published", and this more narrowly covers the desired behavior (notably, excluding "Abandoned" revisions).

Test Plan: Ran "arc land ... --revision X" where "X" is a published revision, got an appropriate prompt.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21345
2020-06-10 10:27:18 -07:00
epriestley
3cad824e38 In "arc land" in Mercurial, show a tidier "ls-remote" command
Summary:
Ref T9948. Ref T13546. We must passthru "hg ls-remote" because it might prompt the user for credentials.

Since "ls-remote" is implemented as an exension and we can't rely on using stdout beacuse of passthru, the actual command we execute is:

```
$ hg --config extensions.arc-hg=<huge long path to extension> arc-ls-remote --output <huge long path to temporary file> -- remote
```

This is meaningless and distracting; show the intent of the command we're executing instead. Users can see the raw command in "--trace" if they're actually debugging behavior.

Test Plan: Ran "arc land" in a Mercurial repository, got a tidier command output.

Maniphest Tasks: T13546, T9948

Differential Revision: https://secure.phabricator.com/D21344
2020-06-10 10:27:17 -07:00
epriestley
b1f807f7ca Disambiguate various types of Mercurial remote markers with "hg arc-ls-remote"
Summary: Ref T13546. Ref T9948. It seems challenging to examine a remote in vanilla Mercurial. Provide an "hg arc-ls-remote" command which functions like "git ls-remote" so we can figure out if "--into X" is a bookmark, branch, both, neither, or a branch with multiple heads without mutating the working copy as a side effect.

Test Plan: Ran various "arc land --into ..." commands in a Mercurial working copy, saw apparently-sensible resolution of remote marker names.

Maniphest Tasks: T13546, T9948

Differential Revision: https://secure.phabricator.com/D21343
2020-06-10 10:27:17 -07:00
epriestley
1bb054ef47 Verify remotes ("paths") in Mercurial during "arc land"
Summary: Ref T13546. Parse "hg paths" and validate that the remotes "arc land" plans to interact with actually exist.

Test Plan: Ran "arc land" with good and bad "--into-remote" and "--onto-remote" arguments, got sensible validation behavior.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21342
2020-06-10 10:27:17 -07:00
epriestley
091aebe014 Refine "arc land" behavior when pushing "onto" a new branch
Summary:
Ref T13546. If the "onto" branch doesn't exist yet and has a "/" in it, we need to preface it with "refs/heads" explicitly.

Fix a "false/null" issue with argument validation.

Possibly, "arc land" should prompt you before creating branches in the remote.

Test Plan: Ran "arc land --onto does-not-exist/1.1" and created a branch.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21341
2020-06-08 16:56:46 -07:00
epriestley
ab70626c12 Support "arc land --pick" to pick specific changes out of a sequence
Summary:
Ref T13546. If you have "feature1", "feature2", etc., "arc land feature4" will now land the entire sequence.

Provide "arc land --pick feature4" to work more like the old "arc land" did. This cherry-picks the commits associated with "feature4", then cascades onto the ancestor of the range.

Test Plan: Ran "arc land --pick land14" to pick a change out of a stack.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21340
2020-06-08 16:30:53 -07:00
epriestley
7ddaed9aba Improve "arc land" behavior in the presence of merge conflicts and change sequences
Summary:
Ref T13546. When we encounter a merge conflict, suggest "--incremental" if it's likely to help.

When merging multiple changes, rebase ranges before merging them. This reduces conflicts when landing sequences of changes.

Test Plan: Ran "arc land" to land multiple changes. Hit better merge conflict messaging, then survived merge conflicts entirely.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21339
2020-06-08 16:30:41 -07:00
epriestley
b003cf9310 Remove "arc feature", "arc branch", "arc bookmark", and significant chunks of obsolete marker code
Summary: Ref T13546. Moves away from the older workflows in favor of "arc branches", "arc bookmarks", and "arc work".

Test Plan: Grepped for affected symbols, didn't find any callers.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21337
2020-06-08 16:27:31 -07:00
epriestley
3d64140ff3 Implement "arc work", to replace "arc feature"
Summary: Ref T13546. Fixes T2928. Adds a new "arc work" workflow which functions like the older "arc feature" workflow, but with modern infrastructure.

Test Plan: Used "arc work" to begin work on branches, bookmarks, and revisions in Git and Mercurial.

Maniphest Tasks: T13546, T2928

Differential Revision: https://secure.phabricator.com/D21336
2020-06-08 16:27:27 -07:00
epriestley
5abf0b96c8 Use MarkerRefs to resolve landing symbols in Mercurial
Summary: Ref T13546. Update the Mercurial code which finds default targets and maps symbols to targets under "arc land" to use the new MarkerRef workflow.

Test Plan: Ran "arc land" with (and without) various arguments in Mercurial, saw them resolve in a seemingly sensible way.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21335
2020-06-08 16:27:24 -07:00
epriestley
599ba0f999 Provide a more powerful query mechanism for "markers" (branches/bookmarks)
Summary:
Ref T13546. Various Arcanist workflows, and particularly the MercurialAPI, currently repeat quite a lot of code around parsing branches and bookmarks.

In modern Mercurial, we can generally use the "head()" and "bookmark()" revsets to do this fairly sensibly.

This change mostly adds //more// code (and introduces "arc bookmarks" and "arc branches" as replacements for "arc bookmark" and "arc branch") but followups should be able to mostly delete code.

Test Plan: Ran "arc branches" and "arc bookmarks" in Git and Mercurial.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21333
2020-06-08 16:27:20 -07:00
epriestley
e8c3cc3289 Allow "arc" to accept any prefix of a command as that command
Summary:
Ref T13546. Practically, this allows "arc branch" to run "arc branches".

(This risks overcorrection to some degree, but command correction only occurs if stdout is a TTY so the risk seems limited.)

Test Plan: Ran "arc branch", got "arc branches" as a correction.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21338
2020-06-08 16:26:58 -07:00
epriestley
31d08f9a8f Remove old Mercurial code testing for rebase and phase support
Summary: Ref T13546. The minimum required Mercurial version should now always have these features; if not, they should move to more modern feature tests.

Test Plan: Grepped for affected symbols.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21334
2020-06-08 16:26:39 -07:00
epriestley
78e9cc9c01 Add a check for ambiguous merge strategies after the "history.immutable" behavioral change
Summary: Ref T13546. When users hit a situation where we would select "squash" but would previously select "merge", prevent them from continuing under ambiguous conditions.

Test Plan: Ran "arc land" in Git with "history.immutable" true, false, and not configured.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21332
2020-06-08 16:26:18 -07:00
epriestley
c5192bde34 Allow users to save prompt responses in "arc" workflows
Summary: Ref T13546. Permit users to answer "y*" to mean "y, and don't ask me again".

Test Plan: Answered "y*" to some prompts, re-ran workflows, got auto-responses.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21331
2020-06-08 16:26:18 -07:00
epriestley
f3f31155b7 Format "arc land" passthru commands more nicely, and execute them from CWD
Summary:
Fixes T13380. Ref T13546. Use slightly nicer command formatting for passthru commands, to make it more obvious what's going on and which pieces of output are from "arc" vs various subcommands.

Also, execute repository API passthru commands from the working copy root. All other commands already did this, the older API just didn't support it.

Test Plan: Ran "arc land" in Git and Mercurial repositories, saw nicer output formatting.

Maniphest Tasks: T13546, T13380

Differential Revision: https://secure.phabricator.com/D21330
2020-06-08 16:26:18 -07:00