Very cool :) Way simpler than the process I've been doing by hand. Regarding avoiding the ASF git remote, folks can probably use the github mirror as a safe alternative to pull from. It can't be pushed to, but it's always exactly the same as the official source.
- Ian On Fri, May 22, 2015 at 1:17 AM, Chris Hillery <[email protected]> wrote: > Ian sent me some proposed docs for "how to push to Apache safely". I said > "that really oughta be scripted", so I've banged something out. > > *Usage:* > > git asf commit <sha> > > This will as safely as possible: > > - Get the latest code from Gerrit > > - Get the latest state from Apache (automatically figures out which > project, AsterixDB or Hyracks, based on your Gerrit URL) > > - Ensure that the tip of Apache's master branch is a direct parent of the > SHA you're pushing > > - Pushes it > > This process should ensure that nobody accidentally pushes more than they > intended, as it enforces that only a single commit (ie, the output of a > single Gerrit review) is pushed at a time. > > *Prerequisites:* > > - git-asf assumes you have a git remote named "gerrit" pointing to the > right place; you can use "git gerrit init" to set up > > - git-asf also assumes that you have a .netrc or equivalent set up so that > you can push to an https://git-wip-us.apache.org/ git remote > > - git-asf does NOT assume you have a git remote pointing to the ASF, and > in fact I'd very strongly urge you NOT to have one > > - git-asf does NOT create any local branches, nor assume anything about > any branches you may already have > > *To get the code:* > > If you already are using git-gerrit, just do a "git pull" to get the > latest. Otherwise, pick a handy directory and "git clone git:// > github.com/ceejatec/git-gerrit". > > Once you have the code, ensure the "git-asf" command is on your PATH. (I > like to put a symlink to it in ~/bin, which I already have on my PATH.) > > Let me know if you try this out and if it works or doesn't work for you! > > Ceej > aka Chris Hillery >
