Arc land --keep-branch no longer works

Reproduction Instructions
Complete steps which allow someone else who does not have access to your environment to reproduce the bug.

$ arc land --keep-branch 27ce29a
Usage Exception: Argument "--keep-branch" is unrecognized. Use "--" to indicate the end of flags.
$ arc help land | grep -m1 -C1 keep-branch
Any obsolete refs that point at commits which were published are deleted,
unless the --keep-branch flag is passed.

Phabricator/Arcanist Version
Output from Config > Version Information or arc version.

$ arc version
arcanist 92f860ae9b2fc0b2c50061f1f6bba6bf04af5f8c (11 Jun 2020)

Oh, I see the flag has been updated to --keep-branches, but the docs still reference the old flag.

Maybe you could add one of those amusing “Assuming X is the British spelling of Y” corrections for this?

Thanks, this should be fixed by

Flags do auto-correct, but the correction is algorithmic and extends only a maximum distance of one error (insertion, omission, or transposition). So --keep-branche or --keep-branchez will work, but not --keep-branch.

I’m hesitant to special case this because it’s the only flag which would use some kind of aliasing rule and I believe use of this flag is fairly rare.

That’s a shame. I don’t know how you collect metrics on which commands are most used, but I can tell you that I use this command routinely.

hmm, Don’t you have tab-completions set up? I can type arc la<tab> --k<tab and it’s expends to arc land --keep-branches

Why do you want to keep your branches after using arc land to land your changes?

1 Like

I typically develop complex features on a branch, one small(ish) change per commit. I diff each commit as it’s ready. Once they’re reviewed, I land them, so I’m typically always landing commits at the base of a multi-commit branch:

arc land --keep-branches (git log --format="%h" master.. | tail -1) && git fetch origin master:master && git rebase master

No. In fact, I didn’t know that was an option. But the docs say it’s only available for bash, and I use fish. (Also, the path mentioned in the doc doesn’t exist in the repo.)

1 Like

If you have commits master > A > B > C with branch feature1 pointed at C, my expectation is that arc land A will no longer delete branch feature1 (I’m surprised it ever did?), and will instead rebase feature1 so that your working copy is now ... > A' > B' > C', with master pointed at A' and feature1 pointed at C'.

I haven’t actually tested this, so this specific sequence may not currently work, but that’s the intent and should be the behavior after T13547 resolves.

Yeah, only bash is supported; I found this file, but it’s obviously outdated. A really enterprising hacker can try to build one that keeps itself updated by following the bash example…)

(The doc is outdated, too - now run arc shell-complete to install the completion script).

Ah interesting. I’ll try that next time I land. Thanks.