Page MenuHomePhabricator

arc land doesn't default --onto to a tracked branch if it is a remote
Closed, ResolvedPublic

Description

Thank you for landing rARCa03c6079bb71d4f8d4cd4c8c661642f753349760—the members of my team who want to land directly on to remote branches will be very happy about it.

In my testing, it seems to work well, but I noticed that, if I'm on a local branch that's tracking a remote branch and I run "arc land", it defaults to landing on to master. If I want to land it on another remote branch, I have to explicitly specify it with --onto, e.g. arc land --onto release/xyz.

Since arc land currently defaults to landing on to the local tracked branch, if there is one, it would be helpful if it could also default to landing on to a remote tracked branch, now that there's support for it. That would prevent me from forgetting to specify --onto and accidentally landing onto master.

Event Timeline

edibiase updated the task description. (Show Details)
edibiase added a project: Arcanist.
edibiase added a subscriber: edibiase.

I think this is fixed by D14357, although I'm surprised by the original behavior. Here's what I get after D14357:

First, I pushed a branch into the remote:

$ git push origin HEAD:notmaster

I checked it out locally with a different name:

$ git checkout -b localnotmaster origin/notmaster
Branch localnotmaster set up to track remote branch notmaster from origin.
Switched to a new branch 'localnotmaster'

If I land from it, behavior is now to target origin/notmaster (which I think is correct/desired):

$ arc land --preview
Landing current branch 'localnotmaster'.
 TARGET  Landing onto "notmaster", selected by following tracking branches upstream to the closest remote.
 REMOTE  Using remote "origin", selected by following tracking branches upstream to the closest remote.
 FETCH  Fetching origin/notmaster...
Usage Exception: There are no commits on "localnotmaster" which are not already present on the target.

Then I checked out a local tracking branch:

$ git checkout -tb localfeature
Branch localfeature set up to track local branch localnotmaster.
Switched to a new branch 'localfeature'

So chain is now:

(remote) origin/notmaster -> (local) localnotmaster -> (local) localfeature

Landing from here seems good, too:

$ arc land --preview
Landing current branch 'localfeature'.
 TARGET  Landing onto "notmaster", selected by following tracking branches upstream to the closest remote.
 REMOTE  Using remote "origin", selected by following tracking branches upstream to the closest remote.
 FETCH  Fetching origin/notmaster...
Usage Exception: There are no commits on "localfeature" which are not already present on the target.

Awesome; D14357 does seem to fix this. Thanks! (Also, the new help documentation for arc land looks great.)

One thing I noticed in testing this out is that the local branch doesn't seem to be deleted once it's been landed: T9660. This happens both with and without D14357 applied.