1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-09 00:12:40 +01:00
Commit graph

2064 commits

Author SHA1 Message Date
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
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
epriestley
0bf4da60f6 Make Mercurial use "hg shelve" and "hg unshelve" in dirty working copies in "arc land"
Summary: Ref T13546. Implement the equivalents of "git stash" in Mercurial.

Test Plan: Dirtied a working copy in Mercurial, ran "arc land", saw dirty changes survive the process.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21329
2020-06-08 16:22:44 -07:00
epriestley
4d61c00531 Improve final messages under "arc land --hold"
Summary: Ref T13546. Update some of the "arc land --hold" behavior to be more functional/consistent with the updated workflow.

Test Plan: Ran "arc land --hold" under various conditions, got sensible forward/restore instructions.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21328
2020-06-08 16:22:44 -07:00
epriestley
b62919f7e4 Show some "arc" help pages through a configurable pager, like "less"
Summary:
Fixes T5420. Some "arc help ..." is long and most similar commands send this kind of output through a pager.

Use a pager in at least some cases.

Test Plan: Ran "arc help land", got pager output. Ran "arc help land | cat", got raw output.

Maniphest Tasks: T5420

Differential Revision: https://secure.phabricator.com/D21327
2020-06-08 16:22:44 -07:00
epriestley
a30378a34a Update "arc help land"
Summary: Ref T13546. Provide more up-to-date help about the "land" workflow, including modern flags and behavior.

Test Plan: Read "arc help land".

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21326
2020-06-08 16:22:43 -07:00
epriestley
709c9cb6fb Improve the logic for identifying ambiguous commits and applying "--revision" to them
Summary: Ref T13546. This is mostly minor cleanup that improves behavior under "--revision".

Test Plan: Ran `arc land --into-empty` and `arc land --into-empty --revision 123` with ambiguous revisions in history to hit both the force and non-force outcomes.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21325
2020-06-08 16:22:43 -07:00
epriestley
8a53b5a451 When landing changes in an empty repository, merge cleanly in Git
Summary:
Fixes T12876. Ref T13546. When you make the first change in a new Git repository, "arc land" currently can not merge it because there's nothing to merge into.

Support merging into the empty state formally, reachable by using "--into-empty" (which should be uncommon) or "arc land" in an empty repository.

Test Plan:
  - Used "arc land --into-empty --hold ..." to generate merges against the empty state under "squash" and "merge" strategies in Git.
    - Got sensible result commits with appropriate parents and content.

Maniphest Tasks: T13546, T12876

Differential Revision: https://secure.phabricator.com/D21324
2020-06-08 16:19:55 -07:00
epriestley
57d0d690cc Modernize output when pruning branches in Git during "arc land"
Summary: Ref T13546. Make this output look more similar to other modern output.

Test Plan: Ran "arc land", saw consistent-looking output.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21319
2020-06-08 16:19:55 -07:00
epriestley
94f78cf87c Provide more information about merge progress in "arc land" under Git
Summary: Ref T13546. Communicate more progress information and provide additional details when merge conflicts occur.

Test Plan: Hit a merge conflict, saw more helpful output.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21318
2020-06-08 16:19:55 -07:00
epriestley
1552397c86 Sometimes discard already-closed revisions in "arc land"
Summary:
Ref T13546. When we find commits in history which are associated with already-closed revisions, and they weren't named explicitly on the command line, and we're using a squash strategy, discard them.

This generally happens when "feature2" is on top of "feature1", but "feature1" gets amended or branched elsewhere and lands independently.

Test Plan: Ran "arc land feature3" where prior revisions had already landed, got discards on the duplicated changes.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21322
2020-06-08 16:17:20 -07:00
epriestley
6fb84e5164 Add a synopsis and example for "arc help land"
Summary: Ref T13546. Small documentation fix. Mostly so I can have more things to land.

Test Plan: Ran "arc help land", saw help.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21321
2020-06-08 16:17:20 -07:00
epriestley
25afb93f7a In "arc land", rebase branches in natural order
Summary: Ref T13546. When "arc land" performs cascading rebases, do them in "feature1", "feature2", etc., order so they're easier to follow. The outcome is not dependent on execution order.

Test Plan: Landed a change which cascaded many other branches, saw more comprehensible update order.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21320
2020-06-08 16:17:19 -07:00
epriestley
68f28a1718 Substantially modernize the "arc land" workflow
Summary: Ref T13546. This has a lot of dangerously rough edges, but has managed to land at least one commit in each Git and Mercurial.

Test Plan:
  - Landed one commit under ideal conditions in Git and Mercurial.
  - See followups.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21315
2020-06-08 16:17:19 -07:00
epriestley
7d615a97e2 In "arc branch" output, sort branches updated in the same second by name
Summary:
Ref T13546. The new "arc land" workflow can rebase several branches per second. With branches like "feature1", "feature2", etc., this leads to out-of-order listing in "arc branch".

When two branches would otherwise sort to the same position, sort them by name.

Test Plan: Ran "arc branch" after a cascading rebase by "arc land", saw "land5", "land7", "land8", etc., instead of an arbitrary order.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21316
2020-06-08 16:04:12 -07:00
epriestley
86471fc0fe Remove "--ignore-unsound-tests" from "arc diff"
Summary: Ref T13544. This flag only disables a warning and should be a prompt default, not a flag.

Test Plan: Grepped for "ignore-unsound-tests", created this revision.

Maniphest Tasks: T13544

Differential Revision: https://secure.phabricator.com/D21303
2020-06-08 15:58:27 -07:00
epriestley
3ed81d35a2 When "arc" receives SIGWINCH or other signals during display of a prompt, recover
Summary:
Ref T13546. Resizing the terminal window to send SIGWINCH, or other signals, may interrupt "stream_select()" with an error which upgrades to a RuntimeException.

When "stream_select()" fails, continue and test the stream itself.

Test Plan: Waited for a prompt, resized the window. Before patch: SIGWINCH interruption. After patch: undisturbed prompt.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21317
2020-06-08 15:56:59 -07:00
epriestley
0da395ffe4 Introduce "RepositoryLocalState", a modern version of "requireCleanWorkingCopy()"
Summary:
Ref T13546. Introduces a more structured construct for saving and restoring local repository state.

This is similar to old behavior, except that:

  - "arc.autostash" is no longer respected;
  - untracked changes are stashed; and
  - we do not offer to amend.

Test Plan: In future changes, saved and restored various permutations of local state.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21314
2020-06-08 15:40:01 -07:00
epriestley
7ac3b791b0 Provide modern config options for "arc land" configuration
Summary: Ref T13546. Adds modern support for "arc.land.onto", "arc.land.onto-remote", and "history.immutable".

Test Plan: Read configuration in a future change.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21313
2020-06-08 15:40:01 -07:00
epriestley
de607e9fbc Add modern refs and hardpoints for buildables, builds, and build plans
Summary: Ref T13546. Prepares "arc land" to use hardpoint queries to load build information.

Test Plan: Ran `arc inspect --explore revision(1234)`, got a full related object tree including build information.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21312
2020-06-08 15:39:27 -07:00
epriestley
c1a4bee4a1 Add "Author" and "Parent Revision" hardpoints to RevisionRefs
Summary: Ref T13546. These are used by a future "arc land" workflow to support the "Land changes you don't own?" and "Land changes with open dependencies?" prompts.

Test Plan: Ran a future "arc land" flow, hit both prompts.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21311
2020-06-08 15:10:20 -07:00
epriestley
0a4a841f8f Remove the "--less-context" flag from "arc diff"
Summary: Ref T13544. This is an obscure flag and almost never useful. You can accomplish the same goal, roughly, with "git diff | arc diff --raw -". See also PHI675. See also T13338.

Test Plan: Grepped for "less-context", created this revision.

Maniphest Tasks: T13544

Differential Revision: https://secure.phabricator.com/D21301
2020-06-05 13:32:14 -07:00
epriestley
466de2d2e1 Remove "--encoding" flag from "arc diff"
Summary: Ref T13544. This flag is generally questionable, likely has no actual uses, and is slated for obsoletion and replacement elsewhere (see T13338).

Test Plan: Grepped for "encoding", found no relevant hits.

Maniphest Tasks: T13544

Differential Revision: https://secure.phabricator.com/D21300
2020-06-05 13:27:42 -07:00
epriestley
bb81172eb7 Remove "haveUncommittedChanges" property from "arc diff"
Summary: Ref T13544. This property is private and has no writers.

Test Plan: Grepped for symbol.

Maniphest Tasks: T13544

Differential Revision: https://secure.phabricator.com/D21299
2020-06-05 13:26:30 -07:00
epriestley
d0eb822e37 Remove "--lintall" and "--only-new" flags to "arc diff"
Summary:
Ref T13544. These flags change the behavior of the "arc lint" subprocess.

I believe there is no reason to ever use "arc diff --lintall". If you want to find extra warnings to fix, you can use "arc lint --lintall" to express this intent.

Use of "arc diff --only-new" almost certainly means your linters are raising messages at "error" severity which should instead be raised at "warning" severity. If you only care about fixing a particular type of error in changed code, it should be raised as a "warning". The correct remedy is to adjust the severity, not use "--only-new", which is a very broad, slow, complicated hammer.

Test Plan: Searched for "lintall" and "only-new" in this workflow. These flags still exist in "arc lint", but may be changed in the future. Generated this change.

Maniphest Tasks: T13544

Differential Revision: https://secure.phabricator.com/D21298
2020-06-05 13:24:48 -07:00