Hello! So I tried converting https://github.com/wikimedia/qa-browsertests/pull/1 into a Gerrit changeset (https://gerrit.wikimedia.org/r/#/c/54097/) , and was mostly successful. It is also a relatively painless process - at least for single commits.
This assumes you (person doing the GitHub -> Gerrit bridge) have a Gerrit account. I wrote a small script that sortof makes this easy:
https://gist.github.com/yuvipanda/5174162
This only does things one time - it moves a set of commits in a pull request to a squashed single commit on gerrit, assuming your current directory is a cloned version of the gerrit repo you want to commit to. It should not to be too hard to write an actual, idempotent sync script that maintains a 1-to-1 correspondence between Pull Requests and Gerrit Changesets, and I'll attempt to do that tomorrow.
Note that this is a shitty bash script (to put it mildly) - but that seems to be all I can write at 5:30 AM :) I'll probably rewrite it to be a proper python one soon. That should also allow me to use the GitHub API to also mirror the GitHub Pull Request Title / Description to Gerrit.
I also offer to manually sync pull requests into gerrit as they come until the automatic Gerrit integration is ready. Shall be writing another small script tomorrow to have me 'watch' all the wikimedia/* GitHub repositories.
Thank you :) I'll update this thread as the script gets less shitty. Do let me know if you have build a far more complete script :)
On Sat, Mar 16, 2013 at 1:11 AM, Yuvi Panda yuvipanda@gmail.com wrote:
So I tried converting https://github.com/wikimedia/qa-browsertests/pull/1 into a Gerrit changeset (https://gerrit.wikimedia.org/r/#/c/54097/) , and was mostly successful.
Thanks. :)
Željko
Couldn't you also just fetch the pull request, rebase it on master with the -i flag, and set the commits to squash?
*--* *Tyler Romeo* Stevens Institute of Technology, Class of 2015 Major in Computer Science www.whizkidztech.com | tylerromeo@gmail.com
On Mon, Mar 18, 2013 at 2:22 PM, Željko Filipin zfilipin@wikimedia.orgwrote:
On Sat, Mar 16, 2013 at 1:11 AM, Yuvi Panda yuvipanda@gmail.com wrote:
So I tried converting https://github.com/wikimedia/qa-browsertests/pull/1 into a Gerrit changeset (https://gerrit.wikimedia.org/r/#/c/54097/) , and was mostly successful.
Thanks. :)
Željko _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
On Tue, Mar 19, 2013 at 12:37 AM, Tyler Romeo tylerromeo@gmail.com wrote:
Couldn't you also just fetch the pull request, rebase it on master with the -i flag, and set the commits to squash?
That is what I first did. Too manual for my tastes :) In this case I only have to deal with one edit operation (for the commit message), rather than a s/pick/s/ for rebase -i.
This was a first cut from about 5 mins of work - I'm sure it could be improved in many many ways
On Mon, Mar 18, 2013 at 3:10 PM, Yuvi Panda yuvipanda@gmail.com wrote:
That is what I first did. Too manual for my tastes :) In this case I only have to deal with one edit operation (for the commit message), rather than a s/pick/s/ for rebase -i.
This was a first cut from about 5 mins of work - I'm sure it could be improved in many many ways
:P Good point.
*--* *Tyler Romeo* Stevens Institute of Technology, Class of 2015 Major in Computer Science www.whizkidztech.com | tylerromeo@gmail.com
On 03/15/2013 08:11 PM, Yuvi Panda wrote:
Hello! So I tried converting https://github.com/wikimedia/qa-browsertests/pull/1 into a Gerrit changeset (https://gerrit.wikimedia.org/r/#/c/54097/) , and was mostly successful. It is also a relatively painless process - at least for single commits.
This is really good to see.
Note that this is a shitty bash script (to put it mildly) - but that seems to be all I can write at 5:30 AM :) I'll probably rewrite it to be a proper python one soon. That should also allow me to use the GitHub API to also mirror the GitHub Pull Request Title / Description to Gerrit.
Also, force-removing the rebase-apply directory is worrisome. I think most or all of the rebase commands have --abort options. If a rebase is in progress, can you exit and prompt the user to finish or abort, rather than blowing it apply?
Matt Flaschen
Matthew Flaschen mflaschen@wikimedia.org wrote:
[...]
Note that this is a shitty bash script (to put it mildly) - but that seems to be all I can write at 5:30 AM :) I'll probably rewrite it to be a proper python one soon. That should also allow me to use the GitHub API to also mirror the GitHub Pull Request Title / Description to Gerrit.
Also, force-removing the rebase-apply directory is worrisome. I think most or all of the rebase commands have --abort options. If a rebase is in progress, can you exit and prompt the user to finish or abort, rather than blowing it apply?
The nice thing about Git is that you can create new workspaces at little cost -- "git clone --reference $LOCALREPO $GERRITURL $TEMPDIR" (or "git clone $LOCALREPO $TEMPDIR" if $LOCALREPO is up-to-date) will give you a clean checkout in $TEMPDIR, where you can then easily run all kinds of rebases, squashes and whatnot, and when you either have pushed the resulting commit to Gerrit or aborted be- cause you ran into some problems, you can just remove the whole directory. No need to worry about the state of your working copy or how you might mess up your branches, stashes & Co.
Tim
On Tue, Mar 19, 2013 at 3:53 AM, Matthew Flaschen mflaschen@wikimedia.org wrote:
Also, force-removing the rebase-apply directory is worrisome. I think most or all of the rebase commands have --abort options. If a rebase is in progress, can you exit and prompt the user to finish or abort, rather than blowing it apply?
Good point. I was just locally testing on an uninteresting (to me) repo, so that was fine. Will keep in mind while writing the 'proper' script.
-- Yuvi Panda T http://yuvi.in/blog
This should work:
WIKIMEDIA_REPOS=/path/where/you/have/your/clones REPO=$1 # qa/browsertests PULL=$2 # https://github.com/brainwane/qa-browsertests.git
TEMP=`mktemp --tmpdir -d pull-request.XXXXXXX` git clone --reference="$WIKIMEDIA_REPOS/$REPO" "$PULL" "$TEMP" cd "$TEMP"
if [ ! -f .gitreview ]; then cat > .gitreview <<EOF [gerrit] host=gerrit.wikimedia.org port=29418 project=$REPO.git defaultbranch=master defaultrebase=0 EOF fi
git-review -R
rm -rf "$TEMP"
Bump! This is now fully automatic! Enabled for the following repos:
qa/browsertests extensions/PostEdit extensions/GuidedTour extensions/GettingStarted extensions/EventLogging extensions/MobileFrontend
(I've asked the people who are major contributors to the repos and gotten agreement to turn it on)
So everytime a pull request is opened on GitHub for their respective repositories, a Gerrit Changeset will appear in about 4-5 seconds. Updating the Pull Request will also update the Gerrit Changeset. Comment Syncing coming soon.
Code is at https://github.com/yuvipanda/SuchABot. It runs on Tools Labs. More detailed description at https://www.mediawiki.org/wiki/User:Yuvipanda/G2G
With a little bit more experimentation, perhaps we can figure out a nice workflow, while keeping Gerrit our 'Canonical' Repository.
Thanks to everyone who helped!
-- Yuvi Panda T http://yuvi.in/blog
On Wednesday, May 22, 2013, Yuvi Panda wrote:
Bump! This is now fully automatic! Enabled for the following repos:
qa/browsertests extensions/PostEdit extensions/GuidedTour extensions/GettingStarted extensions/EventLogging extensions/MobileFrontend
(I've asked the people who are major contributors to the repos and gotten agreement to turn it on)
So everytime a pull request is opened on GitHub for their respective repositories, a Gerrit Changeset will appear in about 4-5 seconds. Updating the Pull Request will also update the Gerrit Changeset. Comment Syncing coming soon.
Code is at https://github.com/yuvipanda/SuchABot. It runs on Tools Labs. More detailed description at https://www.mediawiki.org/wiki/User:Yuvipanda/G2G
With a little bit more experimentation, perhaps we can figure out a nice workflow, while keeping Gerrit our 'Canonical' Repository.
Thanks to everyone who helped!
I volunteered to be a guinea pig for this, with a pull request to GuidedTour. I'm a good proxy for a newbie since I've never actually committed new code to Gerrit, even though I review/comment pretty often.
Steven
-- Yuvi Panda T http://yuvi.in/blog
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org javascript:; https://lists.wikimedia.org/mailman/listinfo/wikitech-l
def log(s): print s
:D
Seriously, though, this is pretty awesome. Also good to see the sh module getting some use.
*-- * *Tyler Romeo* Stevens Institute of Technology, Class of 2015 Major in Computer Science www.whizkidztech.com | tylerromeo@gmail.com
On Wed, May 22, 2013 at 4:45 PM, Steven Walling steven.walling@gmail.comwrote:
On Wednesday, May 22, 2013, Yuvi Panda wrote:
Bump! This is now fully automatic! Enabled for the following repos:
qa/browsertests extensions/PostEdit extensions/GuidedTour extensions/GettingStarted extensions/EventLogging extensions/MobileFrontend
(I've asked the people who are major contributors to the repos and gotten agreement to turn it on)
So everytime a pull request is opened on GitHub for their respective repositories, a Gerrit Changeset will appear in about 4-5 seconds. Updating the Pull Request will also update the Gerrit Changeset. Comment Syncing coming soon.
Code is at https://github.com/yuvipanda/SuchABot. It runs on Tools Labs. More detailed description at https://www.mediawiki.org/wiki/User:Yuvipanda/G2G
With a little bit more experimentation, perhaps we can figure out a nice workflow, while keeping Gerrit our 'Canonical' Repository.
Thanks to everyone who helped!
I volunteered to be a guinea pig for this, with a pull request to GuidedTour. I'm a good proxy for a newbie since I've never actually committed new code to Gerrit, even though I review/comment pretty often.
Steven
-- Yuvi Panda T http://yuvi.in/blog
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org javascript:; https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
On Thu, May 23, 2013 at 3:17 AM, Tyler Romeo tylerromeo@gmail.com wrote:
def log(s): print s
:D
The entire codebase could use some cleanup :) Also I had replaced the prints with appropriate logging sometime in the past, but changed it back because lazyness.
Seriously, though, this is pretty awesome. Also good to see the sh module getting some use.
Oh yes, sh is awesome!
-- Yuvi Panda T http://yuvi.in/blog
wikitech-l@lists.wikimedia.org