Page MenuHomeFreeBSD

git-arc: Add a "commit" subcommand
AcceptedPublic

Authored by saper_saper.info on Tue, Aug 25, 1:23 AM.
Tags
None
Referenced Files
F170945380: D59164.id184946.diff
Mon, Sep 7, 6:59 PM
F170912989: D59164.diff
Mon, Sep 7, 1:09 PM
F170871906: D59164.id185907.diff
Mon, Sep 7, 4:37 AM
F170837320: D59164.id186080.diff
Sun, Sep 6, 11:00 PM
Unknown Object (File)
Sun, Sep 6, 6:17 PM
Unknown Object (File)
Sun, Sep 6, 4:54 PM
Unknown Object (File)
Sun, Sep 6, 6:50 AM
Unknown Object (File)
Sat, Sep 5, 9:31 AM
Subscribers

Details

Reviewers
dteske
markj
Summary

If a patch fails to apply and some conflict
needs to be resolve, allow the user to fetch
the metadata of the change and use them to commit
the code using them.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 76557
Build 73440: arc lint + arc unit

Event Timeline

tools/tools/git/git-arc.1
338

Missing word? Did you mean:

Try to apply the patch ...

I get what you're trying to do. However, I would suggest that instead of a separate sub-command which cannot stand on its own, that we try to leverage common knowledge.

If we emulate "git rebase" by implementing a "--continue" and "--abort" then when a patch fails to apply, we can tell the user that they should try and resolve conflicts and then execute one of:

git arc patch --continue
git arc patch --abort

The combination of (1) catching the error and (2) telling the user to use one of these two (3) saves the user from having to retype the diff argument, at (4) the simple cost of a small cache file that is cleaned up on success.

That would provide direct access to the final patch_commit stage without inventing a partial wrapper over the process as a new sub-command.

Also, --abort could restore the tree from before patch started.

I get what you're trying to do. However, I would suggest that instead of a separate sub-command which cannot stand on its own, that we try to leverage common knowledge.

If we emulate "git rebase" by implementing a "--continue" and "--abort" then when a patch fails to apply, we can tell the user that they should try and resolve conflicts and then execute one of:

git arc patch --continue
git arc patch --abort

The combination of (1) catching the error and (2) telling the user to use one of these two (3) saves the user from having to retype the diff argument, at (4) the simple cost of a small cache file that is cleaned up on success.

That would provide direct access to the final patch_commit stage without inventing a partial wrapper over the process as a new sub-command.

Also, --abort could restore the tree from before patch started.

I like this proposal. Ideally git arc patch would behave similarly to git am.

Well, this patch solved my immediate need, which was a direct access to the patch_commit shell function.

I don't think I will implement any workflow and hand-holding functions.

As it stands, the resolve function is stateless. Yes, it needs a parameter but at least it is explicit.
Initially I tried to write this as a -C option to patch, but then I realized -c might have multiple revision IDs, while -C would need one and only one.

That is why I decided to introduce another subcommand, at first I wanted to name it commit but then I opted for resolve. Maybe commit would be a better name for this function -> git arc patch D59164 + git arc commit D59164 could be roughly equivalent to git arc patch -c D59164

We would need to decide where to store the state ("current revision ID we are working on"). Unfortunately Phabricator and arc do not provide an equivalent to the refs/changes/D59164/1 references, which are git objects managed by Gerrit code review utility. If the user decides to change branches with git checkout or perform some other operation that affects where we are, the state information we store will become stale and we will probably not be able to convince other git subcommands to remove it.

Ok. I agree with your assessment. I'd like to see resolve changed to commit for clarity. I think that's all that is needed.

I also agree that storing the diff handle can bite us, say, if a stale reference got left behind. I'm fine with requiring the diff reference as an argument.

saper_saper.info retitled this revision from git-arc: Add a "resolve" subcommand to git-arc: Add a "commit" subcommand.Sat, Sep 5, 12:58 AM

The subcommand is now named "commit", thank you!

Looks good. Once @markj has weighed-in (and presumably approved), one of us can commit it

This revision is now accepted and ready to land.Sat, Sep 5, 1:18 AM
This revision now requires review to proceed.Sun, Sep 6, 10:14 PM

Thanks for the rebase to get it on top of the current git-arc (that has -t tags), resolving the conflict.

@markj ping

This revision is now accepted and ready to land.Sun, Sep 6, 11:33 PM

Just some minor suggestions if you have the bandwidth/desire

tools/tools/git/git-arc.1
101–102

Minor suggestion

106

Minor suggestion