Makes arc work [task] work with git. Creates git branch with task id and task name.
Details
- Reviewers
aklapper - Group Reviewers
O1: Blessed Committers - Maniphest Tasks
- T15993: Support for arc work T12345 (workOnTask workflow)
Try arc work T12345
Diff Detail
- Repository
- rARC Arcanist
- Branch
- arcpatch-D25872_3
- Lint
Lint Skipped - Unit
Test Failures - Build Status
Buildable 1784 Build 1784: arc lint + arc unit
Time | Test | |
---|---|---|
213 ms | PhutilLibraryTestCase::testLibraryMap EXCEPTION (CommandException): JSON command 'php -f /Users/nick/Code/PhpstormProjects/arcanist2/src/moduleutils/../../support/lib/extract-symbols.php -- --ugly -- /Users/nick/Code/PhpstormProjects/arcanist2/src/work/ArcanistWorkEngine.php' emitted text to stderr when none was expected: 0
COMMAND
php -f /Users/nick/Code/PhpstormProjects/arcanist2/src/moduleutils/../../support/lib/extract-symbols.php -- --ugly -- /Users/nick/Code/PhpstormProjects/arcanist2/src/work/ArcanistWorkEngine.php
| |
119 ms | PhutilLibraryTestCase::testEverythingImplemented 1 assertion(s) passed. | |
11 ms | PhutilLibraryTestCase::testMethodVisibility 1 assertion(s) passed. |
Event Timeline
Thanks! I share a comment on the fly, maybe more comments soon after a test :)
src/work/ArcanistWorkEngine.php | ||
---|---|---|
242 | Multi-byte support for emojis |
src/work/ArcanistWorkEngine.php | ||
---|---|---|
201 | This should not be indented |
Setting Request Changes per the small review comments so far (as I am looking at https://we.phorge.it/differential/query/all/ and it helps to see correct statuses)
Hi @nib - still thanks and you are welcome in updating this patch using something like this:
arc patch D25872 (edits) arc diff
If you can't, we can eventually help. Thanks!
I've tested this and I'm impressed. You probably have changed my life.
Since the original workflow was completely borked I supposed this is the minimal viable product. But note that running the command twice causes this:
STDERR fatal: a branch named 'T15187-blabla' already exists
- Probably in this specific case it should just try to checkout there without creating the branch (?). I also don't think it should behave like arc patch that creates something different.
- Also, what should happen if the title changes a bit and if I run it again? Maybe it should detect tasks starting with Tsomething and use that?
What do you think about? Note that I'm still impressed and happy as-is lol
Hopefully the latest change will work for you. Now it checks existing git branches matching "T12345*" and if any exist, it will git checkout the first one, else it will create it from the task name.
So that should allow you to change the task title, and to use arc work T12345 as many times as you want without error.
@aklapper Would it make sense to move the branch-naming lines into a function in class ArcanistGitWorkEngine, since it the branch-naming is git-specific? E.g.
public function buildBranchName($task_ref) { $task_name = $task_ref->getName(); // regex, preg_replace, trim, etc return $branch_name; }
Probably yes so it's easier with Subversion and Mercurial in the future (?)
Probably something with "for task" in the name like buildBranchNameForTask($task_ref)
src/work/ArcanistWorkEngine.php | ||
---|---|---|
201 | And we can remove this newline <3 ihih |
I put all the changes into ArcanistWorkEngine.php for this diff. We're actually already using a version where the git-specific logic is moved into ArcanistGitWorkEngine.php.
I can make those changes as part of this diff if you prefer, or create a new diff specifically for moving the branch-naming logic. Let me know which approach you'd prefer.
FYI, I encountered some unit test errors when submitting this diff, but they appear to be related to PHP 8.4.4 deprecation warnings in Arcanist's codebase rather than issues with my changes.