Hey,
The new version of git-review released today (1.22) includes a patch I wrote that makes it possible to work against a single 'origin' remote. This amounts to a workaround for git-review's tendency to frighten you into thinking you're about to submit more patches than the ones you are working on. It makes git-review more pleasant to work with, in my opinion.
To enable this behavior, you first need to upgrade to the latest version of git-review, by running "pip install -U git-review". Then you need to create a configuration file: either /etc/git-review/git-review.conf (system-wide) or ~/.config/git-review/git-review.conf (user-specific).
The file should contain these two lines:
[gerrit] defaultremote = origin
Once you've made the change, any new Gerrit repos you clone using an authenticated URI will just work.
You'll need to perform an additional step to migrate existing repositories. In each repository, run the following commands:
git remote set-url origin $(git config --get remote.gerrit.url) git remote rm gerrit git review -s
Hope you find this useful.
On Fri, May 31, 2013 at 6:14 PM, Ori Livneh ori@wikimedia.org wrote:
The new version of git-review released today (1.22) includes a patch I wrote that makes it possible to work against a single 'origin' remote. This amounts to a workaround for git-review's tendency to frighten you into thinking you're about to submit more patches than the ones you are working on. It makes git-review more pleasant to work with, in my opinion.
Sweet!
To enable this behavior, you first need to upgrade to the latest version of git-review, by running "pip install -U git-review". Then you need to create a configuration file: either /etc/git-review/git-review.conf (system-wide) or ~/.config/git-review/git-review.conf (user-specific).
Bummer we can't just use ~/.gitconfig, but hey, it's still an improvement :)
-Chad
On 05/31/2013 06:14 PM, Ori Livneh wrote:
Hey,
The new version of git-review released today (1.22) includes a patch I wrote that makes it possible to work against a single 'origin' remote.
Cool, thank you.
Matt Flaschen
<quote name="Ori Livneh" date="2013-05-31" time="15:14:21 -0700">
Hey,
The new version of git-review released today (1.22) includes a patch I wrote that makes it possible to work against a single 'origin' remote.
I just want to point out that both Ori and Krenair contributed to this release of git-review (a couple patches each): https://review.openstack.org/gitweb?p=openstack-infra/git-review.git;a=log;h...
Thanks, you two!
Greg
Hey,
Did you add this useful documentation on meta? If yes, please provide me the link so I can add this to my "toread/todo" list.
Le vendredi 31 mai 2013 à 15:14 -0700, Ori Livneh a écrit :
Hey,
The new version of git-review released today (1.22) includes a patch I wrote that makes it possible to work against a single 'origin' remote. This amounts to a workaround for git-review's tendency to frighten you into thinking you're about to submit more patches than the ones you are working on. It makes git-review more pleasant to work with, in my opinion.
To enable this behavior, you first need to upgrade to the latest version of git-review, by running "pip install -U git-review". Then you need to create a configuration file: either /etc/git-review/git-review.conf (system-wide) or ~/.config/git-review/git-review.conf (user-specific).
The file should contain these two lines:
[gerrit] defaultremote = origin
Once you've made the change, any new Gerrit repos you clone using an authenticated URI will just work.
You'll need to perform an additional step to migrate existing repositories. In each repository, run the following commands:
git remote set-url origin $(git config --get remote.gerrit.url) git remote rm gerrit git review -s
Hope you find this useful. _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
On Sat, Jun 1, 2013 at 12:14 AM, Ori Livneh ori@wikimedia.org wrote:
This amounts to a workaround for git-review's tendency to frighten you into thinking you're about to submit more patches than the ones you are working on.
Thanks Ori, I have tested it with a couple of repositories and it works great. No more warning messages.
Željko
Thank you!
On 05/31/2013 03:14 PM, Ori Livneh wrote:
Hey,
The new version of git-review released today (1.22) includes a patch I wrote that makes it possible to work against a single 'origin' remote. This amounts to a workaround for git-review's tendency to frighten you into thinking you're about to submit more patches than the ones you are working on. It makes git-review more pleasant to work with, in my opinion.
To enable this behavior, you first need to upgrade to the latest version of git-review, by running "pip install -U git-review". Then you need to create a configuration file: either /etc/git-review/git-review.conf (system-wide) or ~/.config/git-review/git-review.conf (user-specific).
The file should contain these two lines:
[gerrit] defaultremote = origin
Once you've made the change, any new Gerrit repos you clone using an authenticated URI will just work.
You'll need to perform an additional step to migrate existing repositories. In each repository, run the following commands:
git remote set-url origin $(git config --get remote.gerrit.url) git remote rm gerrit git review -s
Hope you find this useful. _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
I wonder if "origin" should be made the default setting for gerrit - after all every new git clone automatically uses "origin". The fewer "surprise!" moments devs have, the more productive we become.
On Wed, Jun 5, 2013 at 6:42 PM, Juliusz Gonera jgonera@wikimedia.orgwrote:
Thank you!
On 05/31/2013 03:14 PM, Ori Livneh wrote:
Hey,
The new version of git-review released today (1.22) includes a patch I wrote that makes it possible to work against a single 'origin' remote. This amounts to a workaround for git-review's tendency to frighten you into thinking you're about to submit more patches than the ones you are working on. It makes git-review more pleasant to work with, in my opinion.
To enable this behavior, you first need to upgrade to the latest version of git-review, by running "pip install -U git-review". Then you need to create a configuration file: either /etc/git-review/git-review.**conf (system-wide) or ~/.config/git-review/git-**review.conf (user-specific).
The file should contain these two lines:
[gerrit] defaultremote = origin
Once you've made the change, any new Gerrit repos you clone using an authenticated URI will just work.
You'll need to perform an additional step to migrate existing repositories. In each repository, run the following commands:
git remote set-url origin $(git config --get remote.gerrit.url) git remote rm gerrit git review -s
Hope you find this useful. ______________________________**_________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/**mailman/listinfo/wikitech-lhttps://lists.wikimedia.org/mailman/listinfo/wikitech-l
______________________________**_________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/**mailman/listinfo/wikitech-lhttps://lists.wikimedia.org/mailman/listinfo/wikitech-l
Not if they fork from our github mirror and their origin is their own repo.
Personally my origin is the github remote I push my unfinished branches of code too. I use 'core' for the actual gerrit remote. And I didn't even fork. I did this before we had a github mirror.
Daniel, I am not saying it will solve everyone's usage scenarios, but I think one would agree that for the majority of the developers, "origin" is set by default. Even gerrit's own usage of "navigate to gerrit.wikimedia.org, and copy "git clone" command from the project page" uses "origin", not "-o gerrit". So lets try to make it easy for common case first, without requiring magic "git remote rename" or "-o ...".
On Wed, Jun 5, 2013 at 6:51 PM, Daniel Friesen daniel@nadir-seen-fire.comwrote:
Not if they fork from our github mirror and their origin is their own repo.
Personally my origin is the github remote I push my unfinished branches of code too. I use 'core' for the actual gerrit remote. And I didn't even fork. I did this before we had a github mirror.
-- ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://danielfriesen.name/]
On Wed, 05 Jun 2013 15:45:32 -0700, Yuri Astrakhan < yastrakhan@wikimedia.org> wrote:
I wonder if "origin" should be made the default setting for gerrit - after
all every new git clone automatically uses "origin". The fewer "surprise!" moments devs have, the more productive we become.
______________________________**_________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/**mailman/listinfo/wikitech-lhttps://lists.wikimedia.org/mailman/listinfo/wikitech-l
I agree it would be nice for our repos (or git-review setup steps) would have sane defaults instead of ones almost everyone will want to change to not be annoyed.
-- View this message in context: http://wikimedia.7.x6.nabble.com/New-git-review-lets-you-configure-origin-as... Sent from the Wikipedia Developers mailing list archive at Nabble.com.
On Thu, Jun 6, 2013 at 12:37 AM, Aaron Schulz aschulz4587@gmail.com wrote:
I agree it would be nice for our repos (or git-review setup steps) would have sane defaults instead of ones almost everyone will want to change to not be annoyed.
Setting defaultremote=origin in each repository's .gitreview file wouldn't work well. We'd need to fix git-review further, first.
git-review expects the remote that is used for interacting with Gerrit to be using SSH. This is a bug, but it's easy to see how it arose: if the remote is named 'gerrit', it's not totally insane for git-review to assume that it created it, and since it only creates SSH remotes, this one must be, too, right?
So what happens if you set defaultremote to 'origin', then clone the repository using https? Well, this:
~$ git clone https://gerrit.wikimedia.org/r/analytics/glass Cloning into 'glass'... ~$ cd glass ~/glass$ git review -s Problems encountered installing commit-msg hook The following command failed with exit code 1 "scp -P None gerrit.wikimedia.org:hooks/commit-msg .git/hooks/commit-msg" ----------------------- Bad port ' None' -----------------------
I'm not sure what the correct behavior should be. It's tempting to tell git-review to upgrade the remote to use SSH, but it's sneaky to change a read-only remote to pushable one. If the 'origin' points at another site altogether (like GitHub), it's even thornier. (If nothing else, though, the error message should be better.)
So the current situation may in fact be optimal. By default, 'git-review' will use 'gerrit' as a remote name, which is fine, since it's not likely to exist. So newbies get the same experience as before: slightly odd, but not broken. And if you're a power user and know to configure ~/.config/git-review/git-review.conf to specify defaultremote=origin, then you just have to remember to clone Gerrit repositories using ssh://, which you're probably doing anyway. Note that if you do that, there's no need to migrate anything:
~$ git clone ssh://ori@gerrit.wikimedia.org:29418/analytics/glass.git Cloning into 'glass'... ~$ cd glass ~/glass$ git review -s (success; no output.)
Ori
Le 06/06/13 00:45, Yuri Astrakhan a écrit :
I wonder if "origin" should be made the default setting for gerrit - after all every new git clone automatically uses "origin". The fewer "surprise!" moments devs have, the more productive we become.
This is how I name my git remotes:
For Gerrit based repos:
gerrit : upstream Gerrit ssh (either Wikimedia hosted or third party) anonymous : upstream gerrit HTTPS wikimedia : Gerrit ssh url when we have a fork of a third party repo which already takes the 'gerrit' name
So given a Gerrit repo hosted by a third party I will have:
gerrit ssh://third party repo wikimedia ssh://our gerrit repo
And doing git-review will let me interact with upstream. If I want to update our fork I just: git push wikimedia gerrit/master:master .
For Github:
On a forked repo: origin or upstream: the upstream repo hashar : my github fork
To update my fork:
git fetch origin git push hashar origin/master:master
My own repo:
github : name of my repo
git push github mybranch
That is fairly complicated though and I often have to do a git remote -v before doing any operation.
Tried setting up the global config in /etc. git-review's gone wild with an exception (very sorry, I switched the terminal off and cannot provide the backtrace; I remember it wanted 'updates' section or some kind of). Luckly ~/.config/ worked well, thanks!
On Sat, Jun 1, 2013 at 1:14 AM, Ori Livneh ori@wikimedia.org wrote:
Hey,
The new version of git-review released today (1.22) includes a patch I wrote that makes it possible to work against a single 'origin' remote. This amounts to a workaround for git-review's tendency to frighten you into thinking you're about to submit more patches than the ones you are working on. It makes git-review more pleasant to work with, in my opinion.
To enable this behavior, you first need to upgrade to the latest version of git-review, by running "pip install -U git-review". Then you need to create a configuration file: either /etc/git-review/git-review.conf (system-wide) or ~/.config/git-review/git-review.conf (user-specific).
The file should contain these two lines:
[gerrit] defaultremote = origin
Once you've made the change, any new Gerrit repos you clone using an authenticated URI will just work.
You'll need to perform an additional step to migrate existing repositories. In each repository, run the following commands:
git remote set-url origin $(git config --get remote.gerrit.url) git remote rm gerrit git review -s
Hope you find this useful. _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
This is great! Origin and gerrit remotes disagreeing could potentially cause havoc. saper and I went through some tutorials telling people to use `git clone -o gerrit` when starting development, but this is much cleaner. I added it to https://www.mediawiki.org/wiki/Gerrit/Tutorial#Prepare_to_work_with_gerrit
For existing repos you wrote:
You'll need to perform an additional step to migrate existing repositories. In each repository, run the following commands:
git remote set-url origin $(git config --get remote.gerrit.url) git remote rm gerrit git review -s
If you don't do this, your first git review in each project after adding git - review.conf will do the git review -s step for you.
If you have local branches tracking a "gerrit" remote (because you followed the git advice/lore to always begin feature work with git checkout -b my_new_feature -t gerrit/master ) then they'll now be disconnected, and you'll have empty sections for them in the project's ~/.config.
When you try to update your local master branch, git nicely tells you how to fix this:
MyProjRepo% git pull --ff-only There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
*git branch --set-upstream-to=origin/**<branch>** master*
So do this for your local branches tracking the remote master on gerrit:
MyProjRepo% git branch --set-upstream-to origin/master master MyProjRepo% git branch --set-upstream-to origin/master my_new_feature
etc.
-- =S Page
This was working great for me on several machines, but it did not work on one machine[1][2].
Adding something like this to git-review.conf fixes the problem:
[updates] check=off
Željko -- 1: https://bugzilla.wikimedia.org/show_bug.cgi?id=55732 2: https://bugs.launchpad.net/git-review/+bug/1243044
On Sat, Jun 1, 2013 at 12:14 AM, Ori Livneh ori@wikimedia.org wrote:
Hey,
The new version of git-review released today (1.22) includes a patch I wrote that makes it possible to work against a single 'origin' remote. This amounts to a workaround for git-review's tendency to frighten you into thinking you're about to submit more patches than the ones you are working on. It makes git-review more pleasant to work with, in my opinion.
To enable this behavior, you first need to upgrade to the latest version of git-review, by running "pip install -U git-review". Then you need to create a configuration file: either /etc/git-review/git-review.conf (system-wide) or ~/.config/git-review/git-review.conf (user-specific).
The file should contain these two lines:
[gerrit] defaultremote = origin
Once you've made the change, any new Gerrit repos you clone using an authenticated URI will just work.
You'll need to perform an additional step to migrate existing repositories. In each repository, run the following commands:
git remote set-url origin $(git config --get remote.gerrit.url) git remote rm gerrit git review -s
Hope you find this useful. _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
wikitech-l@lists.wikimedia.org