Very cool! Gary
On Wed, Jan 6, 2016 at 5:49 AM, Luc Maisonobe <l...@spaceroots.org> wrote: > Hi all, > > As discussed a few weeks ago, I ported the new field-based ode feature > from MATH_3_X to master. I was finally able to do that without losing > the about hundred commits history, by replaying them with some scripting. > > In case this is of interest for some of you, here is how I managed to > do that. > > First, I had to find the commit lists in the MATH_3_X branch that > were of interest, concentrating only on the real code change commits > (i.e. ignoring the merge commits that occurred two or three time > between the topic branch field-ode and MATH_3_X branch). This was > done by identifying a start and an end commit and listing the > intermediate ones with the following command: > > git rev-list ^4685d03~1 b5276e9 --author=Luc --max-parents=1 --reverse > > I put this list in a file for later looping over this. > > Then I wrote a small script that extracted from one commit identifier > the commit message in one temporary file, and the diff in another > temporary file, with all math3 strings replaced with math4. The > diff was then applied, spurious .orig and .rej files eliminated, and > the commit performed with the same message as the original commit. Here > are the few commands: > > git show --pretty=format:"%s%n%n%b" --no-patch $1 \ > > $tmpdir/commit-message > git show --pretty=format:"" $1 | sed 's,math3,math4,g' \ > > $tmpdir/commit-patch > > patch -p1 < $tmpdir/commit-patch && | > find . -name '*.orig' -exec rm {} \; \ > -o -name '*.rej' -exec rm {} \; && \ > git add . && \ > git commit -F $tmpdir/commit-message > > It worked quite well, with only a few glitches that forced me to > interrupt the loop, remove a few commits, correct the command, and > restart the loop. > > After that, I replayed a number of additional commits picked up > individually one at a time, for commits that occurred more recently > than the range before and were interspersed with other commits in > the MATH_3_X branch. So at the end, I had 101 commits. > > All of this was done on a local tmp branch, so I coud roll back and > restart from scratch easily if anything went wrong. When I was certain > that this tmp branch was complete, I merged it into master. > > You will see the last step in a few minutes, with a git push that will > update master with the 101 commits that are in the pipe. I'm sorry for > the noise. > > At the end, we will have a master branch with the same feature as the > MATH_3_X branch, and a full history of the development of this feature. > > best regards, > Luc > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > > -- E-Mail: garydgreg...@gmail.com | ggreg...@apache.org Java Persistence with Hibernate, Second Edition <http://www.manning.com/bauer3/> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> Spring Batch in Action <http://www.manning.com/templier/> Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory