sapling icon indicating copy to clipboard operation
sapling copied to clipboard

[pr]: open PR from fork to upstream

Open vegerot opened this issue 2 years ago • 6 comments

❯ sl paths
default = ssh://[email protected]/vim/vim.git
github = ssh://[email protected]/vegerot/vim.git
upstream = ssh://[email protected]/vim/vim.git

I want to open a PR on default from a commit on github.

❯ sl pr submit
pushing 1 to ssh://[email protected]/vim/vim.git
abort: `git --git-dir /Users/m0c0j7y/workspace/github.com/vim/vim/.sl/store/git push --force ssh://[email protected]/vim/vim.git 550ada1e774a914c2269acba26a0bec279a9b920:refs/heads/pr11684` failed with exit code 128: stdout:
stderr: ERROR: Permission to vim/vim.git denied to vegerot.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I cannot find any docs in sl help pr submit that lets me specify a path

vegerot avatar Dec 09 '22 03:12 vegerot

Hi @vegerot thanks for reporting the issue. Currently, pr is pushing to the default path, how about making your own repo as the default path like below?

default = ssh://[email protected]/vegerot/vim.git
upstream = ssh://[email protected]/vim/vim.git

zzl0 avatar Dec 09 '22 16:12 zzl0

@zzl0 thanks, I'll try that!

Before I try it, just wondering: will sl pr open the PR from vegerot/vim:mybranch→vim/vim:master or vegerot/vim:mybranch→vegerot/vim:master?

vegerot avatar Dec 09 '22 18:12 vegerot

assuming you forked from vim/vim, it will be the former vegerot/vimvim/vim

zzl0 avatar Dec 09 '22 18:12 zzl0

Perfect! 🤩

FYI since I bet this a common problem for people contributing to open source, we should either document this workflow and/or add a --path parameter to sl pr submit

vegerot avatar Dec 09 '22 20:12 vegerot

@vegerot Thank you for the suggestion, I will update the document of the workflow.

For --path parameter, we need to think this together with other requirements, and it's on our plan.

zzl0 avatar Dec 09 '22 21:12 zzl0

I noticed in the documentation that in "hg" there is default and default-push. Would it be possible to use default-push for prs?

nemith avatar Dec 09 '22 22:12 nemith

Curiously when edited .sl/config as described above

% cat .sl/config 
%include builtin:git.rc

[paths]
upstream = https://github.com/facebook/sapling.git
default = https://github.com/discentem/sapling.git

sl pr pushed directly to main on https://github.com/discentem/sapling.git and immediately opened a PR to upstream. Is upstream a like hidden keyword that Sapling knows about already but is only surfaced via the .sl/config interface? ➕ 1 to this idea of adding a flag for this: https://github.com/facebook/sapling/issues/312#issuecomment-1344769084

discentem avatar Dec 20 '22 22:12 discentem

This magic "upstream" behavior doesn't seem to extend to ghstack either.

nemith avatar Dec 21 '22 22:12 nemith