SVN and D'Oh.
Nov. 18th, 2007 10:19 amToday is a day when I'm going to have to spend a certain amount of time fixing some coding mistakes I made yesterday. I was clearly too tired when I was programming. I found a bug in my algorithm, in that it wasn't compatible with the overall processing structure of the program I was working on.
Rather than fix my algorithm, I spent several hours reconfiguring how the program handled its data. Some of that work was a useful bit of refactoring. Most was just messing around in modules that were best left untouched.
This morning I can see that there is a trivial rewrite of my algorithm which is perfectly compatible with the code's old way of doing things. So, I am going to move a copy of the current program aside, revert it to the previous commit in the repository, and then cherry pick amongst the diffs to see what changes should and should not get propagated.
I can't help but think that looking through diffs by hand was precisely sort of thing that repositories like SVN were intended to eliminate. The problem is that its often a bad idea to commit things that are only half-changed, so one tries to do an entire refactoring in one pass, and THEN commit.
Now, one can create a new branch, refactor with intermediate commits, and then merge the whole branch when one has it working, but this is a problem in that
Rather than fix my algorithm, I spent several hours reconfiguring how the program handled its data. Some of that work was a useful bit of refactoring. Most was just messing around in modules that were best left untouched.
This morning I can see that there is a trivial rewrite of my algorithm which is perfectly compatible with the code's old way of doing things. So, I am going to move a copy of the current program aside, revert it to the previous commit in the repository, and then cherry pick amongst the diffs to see what changes should and should not get propagated.
I can't help but think that looking through diffs by hand was precisely sort of thing that repositories like SVN were intended to eliminate. The problem is that its often a bad idea to commit things that are only half-changed, so one tries to do an entire refactoring in one pass, and THEN commit.
Now, one can create a new branch, refactor with intermediate commits, and then merge the whole branch when one has it working, but this is a problem in that
- creating a new branch is a hassle, as is merging it back in, and
- usually you don't need it.
no subject
Date: 2007-11-18 05:50 pm (UTC)no subject
Date: 2007-11-18 06:50 pm (UTC)no subject
Date: 2007-11-18 06:59 pm (UTC)What you're describing turns out to be one of the major advantages of distributed version control systems. With a distributed system, once you check out of a repository, you've automatically made your own private branch. Then, you can just check in as you please on your local system, and when you're happy with it you send it back to the server. If you want to play with this sort of thing now, you could look into either svk or git-svn; they both add a distributed VCS interface on top of a Subversion repository.
no subject
Date: 2007-11-18 09:39 pm (UTC)