Le 13/11/2015 07:04, Gergo Tisza a écrit :
On Thu, Nov 12, 2015 at 1:10 AM, Antoine Musso
<hashar+wmf(a)free.fr> wrote:
On that last point, git-review 1.26 comes with a
new option 'usepushurl'
which makes git-review reuse the origin repo and just set the push url
to the ssh:// url. The 'gerrit' remote will no more be needed.
Ie in your ~/.gitconfig :
[gitreview]
usepushurl = 1
It's not really new, on older versions you needed to set the name with the
defaultremote parameter. (It's even included in the tutorial
<https://www.mediawiki.org/wiki/Gerrit/Tutorial#Configuring_git-review>,
although I am not sure that's a good idea.) The problem is that the same
setting cannot be used on vagrant, which needs an anonymous origin for
automated (ie. passwordless) updates and an authenticated gerrit remote for
pushes (T59680 <https://phabricator.wikimedia.org/T59680>); and
vagrant-based and other checkouts behaving differently will confuse the
hell out of beginners. I would rather stick with cscott's recommendation to
just run git review -u all the time.
The defaultremote is a different system. The git remote have two URLS:
one for fetching and another for pushing. When the setting is enabled
git-review -s change the push URL to point to Gerrit while the fetch one
is left untouched (ie: kept anonymous).
Example using GitHub to fetch but push to Gerrit:
$ git clone
https://github.com/wikimedia/cdb
Cloning into 'cdb'...
$ git-review -s
Adding a git push url to 'origin' that maps to:
^^^^^^^^
ssh://hashar@gerrit.wikimedia.org:29418/cdb.git
$ git remote -v
origin
https://github.com/wikimedia/cdb (fetch)
origin ssh://hashar@gerrit.wikimedia.org:29418/cdb.git (push)
$
We fetch from GitHub:
$ git fetch --verbose
= [up to
date] master -> origin/master
And push to Gerrit:
$ git push --verbose --dry-run
Pushing to ssh://hashar@gerrit.wikimedia.org:29418/cdb.git
To ssh://hashar@gerrit.wikimedia.org:29418/cdb.git
= [up to date] master -> master
Everything up-to-date
Profit \O/
More importantly, I'm not sure it's worth to
spend a lot of time on
improving our gerrit documentation now that we are supposedly a few months
away from ditching gerrit completely.
We can still tune it a bit when it makes senses. But yeah with
Differential that will be superseed even if phasing out Gerrit is more a
few quarters than a few months :-(
--
Antoine "hashar" Musso