I was inspired today by Rein's Hack && Ship post to write something similar for those of us stuck in the Dark Ages of Git-SVN. It took very little work on my part. Honestly, the originals did most of the work. I changed two lines.
What I'm trying to say is: All praise be to the original author, Rick Bradley, and to Rein for exposing them to the Rest of Us. Edit:Thanks also to Yossef Mendelssohn for the idea and his tips in the comments section, and to Kevin Barnes, because he's part of that crew surely had a hand in it -- and he's working on a sweet related script. Again, see Yossef's comment.
Hack-svn && Ship-svn: The Scripts
Hack-svn:
#!/bin/sh -x
CURRENT=`git name-rev HEAD --name-only`
git checkout master
git svn rebase
git checkout ${CURRENT}
git rebase master
Ship-svn:
#!/bin/sh -x
CURRENT=`git name-rev HEAD --name-only`
git checkout master
git merge ${CURRENT}
git svn dcommit
git checkout ${CURRENT}
You really are un perdedor
As you can see, I indeed only changed two lines to make them work for me. The names 'hack-svn' and 'ship-svn' are not nearly as fun as 'hack' and 'ship', whether reading them aloud, or typing them after completing a feature. However, I want to also have vanilla-git hack and ship available for vanilla-git projects. The name at least makes their function semi-obvious, if you know about hack && ship. I thought about just calling them 'hacks' and 'ships', giving them a bit of a Paris Hilton feel. Loves it?
Yes, I obsess over what to call scripts I write. It's a disease. When I recover, I'll start some sort of rehab clinic bearing my name.
So, have at it, my fellow git-svn-ers. You might also write a local alias for git svn rebase and git svn dcommit to make you feel like you aren't really using subversion. It's therepeutic.
Comments
I totally understand, I'm the exact same way with naming stuff. It's definitely a disease...
@aaron - Glad I'm not the only one. Maybe we should start a support group. Name-Over-Deliberaters Anonymous?
I'm part of the OG Consulting triumvirate that brought you hack and ship (Rick wrote the scripts, but I took the inspiration from Hackrocket's "Hack -> Ship" sign). I feel much the same way about naming, especially when I have to find the right name for a project I'm sharing, like on GitHub.
Also, about your git-svn scripts. Kevin (the third OG) was working on the same thing, even going so far as to make 'hack' and 'ship' DTRT based on whether you're in a git-svn repo or a regular git repo. In my experience, however, there's more difference between vanilla git and git-svn than just whether you git pull or git svn rebase. I've had enough troubles that I no longer dcommit from master. I always keep master as the state of the svn repo and dcommit from branches. Much fewer headaches that way.
@Yossef - Thanks for the tips, and the scripts. I may have to change my scripts per your recommendations, although I'll probably forget/neglect them until they blow up in my face.
I am definitely interested in the scripts on which Kevin is working. I had thought about making Hack and Ship take an option. I decided not to, because I thought that part of the beauty of Hack && Ship was that they were (as far as I can tell) shell independent and super simple. Actually, maybe rewriting them as ruby scripts would work....
Thanks, again.
Post new comment