sapling
sapling copied to clipboard
gerrit support
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'
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 sl push --to :refs/for/main
?
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/
.
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'
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.