So that I don't forget, and in the hopes of picking up tips from more experienced users, I'm going to write down my notes on using git to work on OpenLayers without any commit access. OpenLayers is a big project, and enhancing it in a significant way takes time and care. It's worth doing this work within a revision control system. The project has SVN sandboxes, but you can't use them offline (which I've been quite a bit this summer), you have to apply for them (I'm impatient), and my OpenLayers guru is annoyed by them. For these reasons, I've gone with a DVCS, and chose git on account of its nice bridge for Subversion:
To begin, clone the OpenLayers trunk. As of today, there have been 9623 revisions. Don't fetch all of them! In this example, I'm going to fetch a small revision range just short of the SVN head so that I can illustrate rebasing later.
Now I have cloned OpenLayers and begin by default in a branch named "master". I'll do my work around http://trac.openlayers.org/ticket/1366 in a new branch named "atom".
I've already produced a patch using the methods I'm noting here, and will apply it to the new branch for the sake of this demo.
$ patch -p1 < atom-format-2.patch patching file lib/OpenLayers.js patching file lib/OpenLayers/Format/Atom.js patching file tests/Format/Atom.html patching file tests/list-tests.html $ git commit -a [atom 315def2] Apply patch from http://trac.openlayers.org/attachment/ticket/1366/atom-format-2.patch. 4 files changed, 1171 insertions(+), 0 deletions(-) create mode 100644 lib/OpenLayers/Format/Atom.js create mode 100644 tests/Format/Atom.html
If I were to run "git diff master" I'd recover that same patch. Now, there's a new attachment on my favorite OpenLayers ticket. A patch would have been nice, but a file is better than nothing. I'll create a new branch named "atom-pwr" based on "atom", copy the attached file and overwrite Format/Atom.js in the new branch.
Running "git diff atom" shows me the difference between atom-pwr and atom branches. I'll commit the changes to atom-pwr.
A patch to the OpenLayers trunk incorporating all these changes is generated with:
Now, lib/OpenLayers/Control/GetFeature.js was added in r9623. To keep up with these changes, use
git-svn rebase. First on the master branch:
And then on the development branch:
Now a patch against the current head is generated by:
As nothing was changed in the files I'm working on between r9621 and r9623, this patch is identical to the one I started with. Up the new patch goes to the OpenLayers issue tracker to make things as easy as possible for an actual committer.