Title: [164642] trunk/Websites/bugs.webkit.org
- Revision
- 164642
- Author
- [email protected]
- Date
- 2014-02-25 04:44:42 -0800 (Tue, 25 Feb 2014)
Log Message
PrettyPatch.rb should be more descriptive for "git diff -M" styled patches
https://bugs.webkit.org/show_bug.cgi?id=125514
Patch by Jozsef Berta <[email protected]> on 2014-02-25
Reviewed by Csaba Osztrogonác.
* PrettyPatch/PrettyPatch.rb: PrettyPatch.rb is modified to show which file was renamed or moved.
Modified Paths
Diff
Modified: trunk/Websites/bugs.webkit.org/ChangeLog (164641 => 164642)
--- trunk/Websites/bugs.webkit.org/ChangeLog 2014-02-25 10:33:26 UTC (rev 164641)
+++ trunk/Websites/bugs.webkit.org/ChangeLog 2014-02-25 12:44:42 UTC (rev 164642)
@@ -1,3 +1,12 @@
+2014-02-25 Jozsef Berta <[email protected]>
+
+ PrettyPatch.rb should be more descriptive for "git diff -M" styled patches
+ https://bugs.webkit.org/show_bug.cgi?id=125514
+
+ Reviewed by Csaba Osztrogonác.
+
+ * PrettyPatch/PrettyPatch.rb: PrettyPatch.rb is modified to show which file was renamed or moved.
+
2013-12-16 Dániel Bátyai <[email protected]>
PrettyPatch.rb doesn't handle diffs where lines matching /^--/ are missing properly
Modified: trunk/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb (164641 => 164642)
--- trunk/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb 2014-02-25 10:33:26 UTC (rev 164641)
+++ trunk/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb 2014-02-25 12:44:42 UTC (rev 164642)
@@ -61,6 +61,8 @@
/^diff/
]
+ RENAME_FROM = /^rename from (.*)/
+
BINARY_FILE_MARKER_FORMAT = /^Cannot display: file marked as a binary type.$/
IMAGE_FILE_MARKER_FORMAT = /^svn:mime-type = image\/png$/
@@ -150,10 +152,13 @@
[nil, file_path]
end
- def self.linkifyFilename(filename)
- url, pathBeneathTrunk = find_url_and_path(filename)
-
- url.nil? ? filename : "<a href=''>#{filename}</a>"
+ def self.linkifyFilename(filename, force)
+ if force
+ "<a href=''>#{filename}</a>"
+ else
+ url, pathBeneathTrunk = find_url_and_path(filename)
+ url.nil? ? filename : "<a href=''>#{filename}</a>"
+ end
end
@@ -184,7 +189,7 @@
font-family: sans-serif;
font-size: 1em;
margin-left: 0.5em;
- display: table-cell;
+ display: inline;
width: 100%;
padding: 0.5em;
}
@@ -560,6 +565,8 @@
startOfSections = i + 1
end
break
+ when RENAME_FROM
+ @renameFrom = RENAME_FROM.match(lines[i])[1]
end
end
lines_with_contents = lines[startOfSections...lines.length]
@@ -616,7 +623,13 @@
def to_html
str = "<div class='FileDiff'>\n"
- str += "<h1>#{PrettyPatch.linkifyFilename(@filename)}</h1>\n"
+ if @renameFrom
+ str += "<h1>#{@filename}</h1>"
+ str += "was renamed from"
+ str += "<h1>#{PrettyPatch.linkifyFilename(@renameFrom.to_s, true)}</h1>"
+ else
+ str += "<h1>#{PrettyPatch.linkifyFilename(@filename, false)}</h1>\n"
+ end
if @image then
str += self.image_to_html
elsif @git_image then
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes