remotemobprogramming / mob

Tool for smooth git handover.
https://mob.sh
MIT License
1.66k stars 149 forks source link

Add support for gerrit #409

Open nbarbey opened 6 months ago

nbarbey commented 6 months ago

Would it be possible to add an option to push the temporary branch to a gerrit server ? This would require to be able to push to gerrit "magic" refs/for/ instead of refs/heads For now when I try to use mob with a gerrit server I get this error :


ERROR remote: error: branch refs/heads/mob-session:
ERROR remote: Push to refs/for/mob-session to create a review, or get 'Push' rights to update the branch.
ERROR remote: User: nicolas.barbey
ERROR remote: Contact an administrator to fix the permissions
remote: Processing changes: refs: 1, done  
ERROR To ssh://review.***.ci:29418/***
ERROR ! [remote rejected]         mob-session -> mob-session (prohibited by Gerrit: not permitted: update)
ERROR error: impossible de pousser des références vers 'ssh://review.***:29418/**'
ERROR exit status 1
hollesse commented 6 months ago

Hi @nbarbey could you give me some more information how gerrit works and how your gerrit is configured? I just tried it myself with a gerrit running locally with docker. There I am able to do a mob start and mob next. So are you just allowed to push to refs/for? Would it be ok to push there? As I understood gerrit this creates a code review for someone else. Is that a problem?

nbarbey commented 5 months ago

Hello @hollesse ! Thank you for answering this ! Yes, gerrit is set up at my company in a way that we are only allowed to push to refs/for. Indeed, it creates a "code review"/"pull request" there. This is a mandatory step before merging the commit anyway. So that would be ok to have the temporary branch of the session there I think. Also there is a way to send to refs/for without triggering the CI tests by suffixing the branch name to %wip, putting the code review into a "Work In Progress" state.

hollesse commented 5 months ago

Okay it seems that we would need an configuration to create a custom git reference and if this is set use this instead of heads. Would you like to contribute and create a pull request for that @nbarbey ?

nbarbey commented 5 months ago

I tried this a bit. I struggled to warp my head into the code with the little time I had. When I stopped it seemed to me that head was implicit in some of the calls to the git command but I could not figure out where. Perhaps we should mob this out ;-)

hollesse commented 5 months ago

@nbarbey correct the head is implicit right now. We would need to make it explicit and afterwards configurable. I like the idea of doing it in a mob, but I need to check if I can find time for that. @gregorriegler Do you know if maybe you could find some time for that?

gregorriegler commented 5 months ago

@hollesse I am up for it, but would have to be an evening. Something like 17:00 - 19:00