repo upload without review (repo push function)

739 views Asked by At

We use the git-repo tool in our project, but we don't use gerrit for code review. So far we used regular git commands to push our changes, but due to the growing amount of repos it would be cool to use the repo upload feature.

repo upload requires a review server in the manifest. I tried to add the regular git remote, but this didn't work.

A potential solution is to write a repo forall -c ... command that does the git push in all repos. Still I like the built-in function of repo upload and wonder if it is possible to have similiar functionallity without gerrit review. Ideally something like repo push.

According to the help of repo such a command is not available:

$ repo help --all
usage: repo COMMAND [ARGS]
The complete list of recognized repo commands are:
  abandon        Permanently abandon a development branch
  branch         View current topic branches
  branches       View current topic branches
  checkout       Checkout a branch for development
  cherry-pick    Cherry-pick a change.
  diff           Show changes between commit and working tree
  diffmanifests  Manifest diff utility
  download       Download and checkout a change
  forall         Run a shell command in each project
  gitc-delete    Delete a GITC Client.
  gitc-init      Initialize a GITC Client.
  grep           Print lines matching a pattern
  help           Display detailed help on a command
  info           Get info on the manifest branch, current branch or unmerged branches
  init           Initialize repo in the current directory
  list           List projects and their associated directories
  manifest       Manifest inspection utility
  overview       Display overview of unmerged project branches
  prune          Prune (delete) already merged topics
  rebase         Rebase local branches on upstream branch
  selfupdate     Update repo to the latest version
  smartsync      Update working tree to the latest known good revision
  stage          Stage file(s) for commit
  start          Start a new branch for development
  status         Show the working tree status
  sync           Update working tree to the latest revision
  upload         Upload changes for code review
  version        Display the version of repo
See 'repo help <command>' for more information on a specific command.

Does somebody know if it is possible to push changes with repo without gerrit review?

1

There are 1 answers

0
Eyal Gerber On

I don't think there is something under repo that does what you are asking for. If there is, I would love to learn about it too. But I ended up writing a simple bash script that does just what you are asking for and that's what I use too in my repo project.

Simply run this script from your main repo repository which contains your manifest file.

#!/bin/bash
    
#go through each subrepo and push local commits
for directory in $(repo status | cut -d" " -f 2); do
    (
        cd $directory;  #go into the subrepo
        Current_Branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')    #current checked out local branch - taken from https://stackoverflow.com/a/2111099/4441211
        git push origin $Current_Branch
    )
done