Jump to content

Gerrit/git-review/upgrade

From mediawiki.org
Issue on Ubuntu 18.04. and deriatives when trying to upload a patch-set
johndoe@pandorea ~/MediaWiki/other/translatewiki $ git review -R
Could not connect to gerrit.
Enter your gerrit username: john
Trying again with ssh://john@gerrit.wikimedia.org:29418/translatewiki
Creating a git remote called 'gerrit' that maps to:
	ssh://john@gerrit.wikimedia.org:29418/translatewiki

This repository is now set up for use with git-review. You can set the
default username for future repositories with:
  git config --global --add gitreview.username "john"

Your change was committed before the commit hook was installed.
Amending the commit to add a gerrit change id.
remote: error: branch refs/publish/master/wblm:        
remote: If you are using git-review, update to at least git-review 1.27. Otherwise:        
remote: You need 'Create' rights to create new references.        
remote: User: john        
remote: Contact an administrator to fix the permissions        
remote: 
remote: Processing changes: refs: 1
remote: Processing changes: refs: 1, done            
To ssh://gerrit.wikimedia.org:29418/translatewiki
 ! [remote rejected]   HEAD -> refs/publish/master/wblm (prohibited by Gerrit: not permitted: create)
error: failed to push some refs to 'ssh://john@gerrit.wikimedia.org:29418/translatewiki'

The patch-set gets rejected. :(

Check version of git-review
johndoe@pandorea ~/MediaWiki/other/translatewiki $ git-review --version
git-review version 1.26.0-1

Ouch, git-review minimum requirement of 1.27.0 is not met. :(

Check version of git
johndoe@pandorea ~/MediaWiki/other/translatewiki $ git --version
git version 2.17.1

Cool, git 1.8 as minimum requirement is met. :)

Solution - step 1 - remove outdated packaged version of git-review
johndoe@pandorea ~/MediaWiki/other/translatewiki $ sudo apt-get purge git-review
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.       
Statusinformationen werden eingelesen.... Fertig
Die folgenden Pakete werden ENTFERNT:
  git-review*
0 aktualisiert, 0 neu installiert, 1 zu entfernen und 0 nicht aktualisiert.
Nach dieser Operation werden 156 kB Plattenplatz freigegeben.
Möchten Sie fortfahren? [J/n] j
(Lese Datenbank ... 387803 Dateien und Verzeichnisse sind derzeit installiert.)
Entfernen von git-review (1.26.0-1) ...
Trigger für man-db (2.8.3-2ubuntu0.1) werden verarbeitet ...
Solution - step 2 - install latest version of git-review via pip
johndoe@pandorea ~/MediaWiki/other/translatewiki $ sudo pip install git-review
Collecting git-review
  Downloading https://files.pythonhosted.org/packages/d9/88/86360bc710b1485ca49c94481b92b5069f859354ec462d8793ec8ed4e45b/git_review-1.28.0-py2.py3-none-any.whl (46kB)
    100% |████████████████████████████████| 51kB 1.0MB/s 
Requirement already satisfied: requests>=1.1 in /usr/lib/python2.7/dist-packages (from git-review)
Requirement already satisfied: six in /usr/lib/python2.7/dist-packages (from git-review)
Installing collected packages: git-review
Successfully installed git-review-1.28.0
Check version of git-review again
johndoe@pandorea ~/MediaWiki/other/translatewiki $ git-review --version
git-review version 1.28.0

Cool, git-review 1.27.0 as minimum requirement is met. :)

Try upload the patch-set again
johndoe@pandorea ~/MediaWiki/other/translatewiki $ git review -R
remote: 
remote: Processing changes: refs: 1, new: 1
remote: Processing changes: refs: 1, new: 1
remote: Processing changes: refs: 1, new: 1, done            
remote: 
remote: SUCCESS        
remote: 
remote:   https://gerrit.wikimedia.org/r/c/translatewiki/+/630343 Add translation support for the Wikibase Local Media extension [NEW]        
remote: 
To ssh://gerrit.wikimedia.org:29418/translatewiki
 * [new branch]        HEAD -> refs/for/master%topic=wblm

Voilà! Paradise regained. The patch-set was accepted.

Links