RESOLVED FIXED 9322
Teach svn-create-patch to sort its output
https://bugs.webkit.org/show_bug.cgi?id=9322
Summary Teach svn-create-patch to sort its output
David Kilzer (:ddkilzer)
Reported 2006-06-05 22:14:29 PDT
After Bug 9299 landed, there were still a few improvements to make (see Bug 9299 Comment #5). This bug handles sorting the output of svn-create-patch so that binary files appear after text file patches, and the patches appear in alphabetical (and deterministic) order.
Attachments
Patch v1 (7.69 KB, patch)
2006-06-05 22:36 PDT, David Kilzer (:ddkilzer)
darin: review+
David Kilzer (:ddkilzer)
Comment 1 2006-06-05 22:36:13 PDT
Created attachment 8725 [details] Patch v1 I took no prisoners in cleaning up the perl code, but I may have been too aggressive. (I was tempted to remove 'use' statements, too, but held off.) Changes (in no particular order): - Sorted 'use' statements alphabetically. - Reworded some die() messages. - Extracted path canonicalization to canonicalizePath() method and switched to using standard Perl modules instead of regular expressions assuming forward slashes. - Moved non-subroutine code together (or moved all subroutines to the end of the file) and added an 'exit 0;' statement so you know where the main code ends. Subroutines are alphabetized. - Moved list-of-path cleanup into the else block of the first if/else statement because it's only needed there. If no arguments are given, "." is used by default and is the only path needed. Changed a while() loop to a for() loop since I thought it read better; also replaced another regex with dirname(). - Created new generateFileList() subroutine. It uses "svn diff" instead of "svn stat" since (a) "svn diff" was roughly 4x faster than "svn stat" in a local test and (b) it's easier to know if a file is binary or not using "svn diff". - Completely gutted diff() and renamed to generateDiff(). It only has to handle creating a patch for one file at a time now. I also removed all of the chdir() business since Subversion handles the full paths quite nicely. That cleaned up a lot of logic in the patch path fix-up as well. Should I have kept this code?
Darin Adler
Comment 2 2006-06-06 09:42:38 PDT
Comment on attachment 8725 [details] Patch v1 Looks fine. But I think it would be even better if it used the sort from run-webkit-tests. It's called "pathcmp". r=me
David Kilzer (:ddkilzer)
Comment 3 2006-06-06 20:09:54 PDT
Committed revision 14758.
Note You need to log in before you can comment on or make changes to this bug.