Somewhere on Shadow Earth, at Thu, Jan 27, 2011 at 12:19:28PM +1000, Michael G
Schwern wrote:
> On 2011.1.27 10:43 AM, Timothy Knox wrote:
> > Bonus hate: When I am refactoring software, I will sometimes rename a
> > variable or function or what-have-you. Before I submit the code to my
> > source repository, I'd like to ensure that I am not picking up any stray
> > diffs (debugging changes, forgot to sync before checkin, etc). It would
> > be awfully nice if diff gave one the ability to say, in essence, take
> > one of the files, and notionally perform the following substitution,
> > then diff the resultant with the other file. In other words, only show
> > me the diffs I don't recall making. HATE!
>
> Take advantage of the fact that diff doesn't try to be some huge, bloated
> refactoring tool...
I'm not asking for that, but given the bloat evidenced by the hate that
started this thread, I am asking for it to be carried to a logical
conclusion.
> perl -nwle 's{foo}{bar}' old_file | diff - new_file
>
> But I think what you really hate is your version control system.
Sure, but we are stuck with that. Our dev organisation is around 500
folks, so changing is just not gonna happen.
> The CVS way...
>
> ...refactor stuff...
> ...debug stuff...
> ...edit stuff...
> ...add a new feature...
> ...take a nap...
> ...refactor some more...
> cvs diff
> ...oh god what is all this crap I did...
Or in our case:
The Perforce way...
...refactor stuff...
...debug stuff...
...edit stuff...
...add a new feature...
...take a nap...
...refactor some more...
p4 diff
...oh god what is all this crap I did...
p4 resolve
...oh god what is all this crap I did...
Lather, rinse, repeat...
> The distributed way...
>
> ....refactor stuff....
> git diff
> ...looks ok so...
> git commit
> ....do some more work...
> git diff
> ....looks ok so...
> git commit
> ...now I'm done and ready to inflict it on everyone else...
> git push
>
> (or you can "git add ." or even "git commit --amend" if you don't like lots of
> little commits)
--
Timothy Knox <mailto:[email protected]>
"Any nitwit can understand computers, and many do."
-- Ted Nelson