Page MenuHomePhabricator

Arcanist - normalize question about unstaged files across workflows (diff vs land)
ClosedPublic

Authored by btrahan on Apr 10 2014, 11:05 PM.
Tags
None
Referenced Files
F14076573: D8753.diff
Thu, Nov 21, 6:20 PM
Unknown Object (File)
Tue, Nov 19, 12:18 PM
Unknown Object (File)
Oct 22 2024, 4:01 PM
Unknown Object (File)
Oct 22 2024, 3:58 PM
Unknown Object (File)
Oct 22 2024, 3:58 PM
Unknown Object (File)
Oct 22 2024, 3:56 PM
Unknown Object (File)
Oct 16 2024, 3:52 AM
Unknown Object (File)
Oct 11 2024, 8:58 AM

Details

Summary

Fixes T4163. Re-word the question so its the same as in "arc diff". Draw the line though and don't automagically do anything if the user says "Y", 'cuz amending / adding files last minute in 'arc land' and other workflows is batshit insane. Assuming infinite growth in the future, I think its best to get this language consistent now.

I changed the shouldAmend member variable to a shouldAmend() function with a static inside. Previously shouldAmend was getting set as a side effect and it was kind of weird. I thought maybe it was written this way because the calls to the vcs are a little slow or something. As such, I figured caching it in the static was a good idea? Didn't seem awful but maybe a premature optimization with whatever the performance reality turns out to be.

Also a modest amount of bonus pht.

Test Plan

this very diff. i'm going to arc land it laters too.

Diff Detail

Repository
rARC Arcanist
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

btrahan retitled this revision from to Arcanist - normalize question about unstaged files across workflows (diff vs land).
btrahan updated this object.
btrahan edited the test plan for this revision. (Show Details)
btrahan added a reviewer: epriestley.

@chad - FYI I am throwing the gauntlet down here.

This is fairly contentious change overall I guess. I think its best for new users / looking long term. For careful readers its basically the same. For people who have lots of untracked files and muscle reflex type "Y" or "N" -- well, they're broked, sorry.

epriestley edited edge metadata.

Couple of tiny nits, but overall everything here looks great to me.

src/workflow/ArcanistBaseWorkflow.php
785

For consistency, prefer . over ,

826–830

Maybe call this some thing like askToAddFiles() or similar, to make it clear that it returns answer, not, e.g., an actual prompt text.

930

I think this cache should still be a normal property, but the new implementation is otherwise better.

It's possible for a command to end up running multiple workflows, and we shouldn't carry the answer to this question from one workflow to another -- although it can't happen today, some day "arc diff" could make us run workflows in different working copies (maybe, for example, Git submodules or SVN externals) which might have a different answer to this question.

So we'd end up with, e.g.:

private $shouldAmend;
private function getShouldAmend() { ... }
private function calculateShouldAmend() { ... }
This revision is now accepted and ready to land.Apr 11 2014, 11:17 AM
btrahan updated this revision to Diff 20776.

Closed by commit rARC77a9c1814063 (authored by @btrahan).