sapling icon indicating copy to clipboard operation
sapling copied to clipboard

`sl push` diagnostics provide incomplete information

Open rbehrends opened this issue 3 years ago • 0 comments

Doing sl push will result in the error message abort: use '--to' to specify destination bookmark in a couple of situations where it is difficult for the user to figure out the actual problem.

  1. When you've already pushed the current commit and try to push it again, you get the above message rather than the response that the remote target is already up to date. In fact, that's the error message that you get when you then do sl push --to $(sl log -r . -T '{hoistednames}')
  2. When you've amended a commit, you get the same message, not noting that local and remote bookmarks have diverged.

The reason appears to be an implementation artifact in that _guesspushtobookmark() only returns None as an error state, from which alone you can't infer the underlying cause.

In addition, the user experience in the second case is suboptimal. Explicitly having to specify the remote branch being pushed to after amending a commit is a potential source of errors (e.g. typos). I understand that this may not be trivial to support, but hg-git has a somewhat better (though still imperfect) story here in how it relates local bookmarks to remote branches by relying on the active bookmark.

rbehrends avatar Nov 30 '22 21:11 rbehrends