sapling icon indicating copy to clipboard operation
sapling copied to clipboard

gerrit support

Open mrtnlrsn opened this issue 1 year ago • 4 comments

I tried using sapling with gerrit review server.

To create a review commit are pushed to /refs/for/main (or more generic refs/for/BRANCH). That does not seem to be possible:

sl push --to /refs/for/main
fatal: invalid refspec '0bd2f0e49c563aecb3d425a8cefaea999566ddc2:refs/heads//refs/for/main'

mrtnlrsn avatar Jan 18 '23 21:01 mrtnlrsn

Seems reasonable to support pushing to arbitrary refs. We could add detection for "refs/" prefix and, if present, use verbatim, but that would preclude having a branch named "refs/foo". @quark-zju WDYT about allowing arbitrary ref when prefixed by ":", e.g. sl push --to :refs/for/main?

muirdm avatar Jan 27 '23 01:01 muirdm

It's a bit tricky since we want round-trip the references. Right now they do not map well to remote bookmarks (which is designed to be general purpose for both Mononoke and git). Perhaps we can special case if the name starts with refs/.

quark-zju avatar Jan 27 '23 01:01 quark-zju

I also encountered this today. It would be nice if there was some work around.

❯ sl push -t gerrit/refs/for/master
Enumerating objects: 17, done.
Counting objects: 100% (17/17), done.
Delta compression using up to 32 threads
Compressing objects: 100% (8/8), done.
Writing objects: 100% (9/9), 2.63 KiB | 2.63 MiB/s, done.
Total 9 (delta 5), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (5/5)
remote: error: branch refs/heads/refs/for/master:
remote: You need 'Create' rights to create new references.
remote: User: uhthomas
remote: Contact an administrator to fix the permissions
remote: Processing changes: refs: 1, done    
To ssh://review.gerrithub.io:29418/cue-lang/cue
 ! [remote rejected]   8be5d079e5bcaa2ddcf40599e46a2cf423ddc6cb -> refs/for/master (prohibited by Gerrit: not permitted: create)
error: failed to push some refs to 'ssh://review.gerrithub.io:29418/cue-lang/cue'

uhthomas avatar Oct 20 '23 22:10 uhthomas

As a current git-branchless user, gerrit support is really the only reason why I can't use sapling for our monorepo at work.

Documentation would also be nice. If gerrit becomes supported and I manage to get things working I can see myself contributing a documentation page similar to the one for github.

saolof avatar Oct 23 '23 09:10 saolof