| Index: appengine/chromium_rietveld/new_static/model/patch_file.js
|
| diff --git a/appengine/chromium_rietveld/new_static/model/patch_file.js b/appengine/chromium_rietveld/new_static/model/patch_file.js
|
| index 60c83f06b5c525c3cc6d174017e89ae302fd00ec..d65f331220958b5828105714ecaf7dcaafd7205f 100644
|
| --- a/appengine/chromium_rietveld/new_static/model/patch_file.js
|
| +++ b/appengine/chromium_rietveld/new_static/model/patch_file.js
|
| @@ -7,8 +7,8 @@
|
| function PatchFile(patchset, name)
|
| {
|
| this.name = name || "";
|
| + this.prefix = name || "";
|
| this.extension = "";
|
| - this.prefix = "";
|
| this.language = "";
|
| this.containsEmbeddedLanguages = false;
|
| this.status = "";
|
| @@ -26,11 +26,13 @@ function PatchFile(patchset, name)
|
| this.draftCount = 0;
|
| this.diff = null;
|
| this.isLayoutTest = this.name.startsWith("LayoutTests/");
|
| + this.isHeader = false;
|
| Object.preventExtensions(this);
|
|
|
| var dotIndex = this.name.lastIndexOf(".");
|
| if (dotIndex != -1) {
|
| this.extension = this.name.from(dotIndex + 1);
|
| + this.isHeader = PatchFile.HEADER_EXTENSIONS[this.extension] || false;
|
| this.prefix = this.name.to(dotIndex);
|
| this.language = PatchFile.SYNTAX_LANGUAGES[this.extension] || "";
|
| this.containsEmbeddedLanguages = PatchFile.MIXED_LANGUAGES[this.language];
|
| @@ -78,20 +80,20 @@ PatchFile.SYNTAX_LANGUAGES = {
|
| "xml": "xml",
|
| };
|
|
|
| +PatchFile.HEADER_EXTENSIONS = {
|
| + "h": true,
|
| + "hxx": true,
|
| + "hpp": true,
|
| +};
|
| +
|
| PatchFile.compare = function(a, b)
|
| {
|
| - if (a.isLayoutTest && b.isLayoutTest)
|
| - return a.name.localeCompare(b.name);
|
| - if (a.isLayoutTest)
|
| - return 1;
|
| - if (b.isLayoutTest)
|
| - return -1;
|
| + if (a.isLayoutTest != b.isLayoutTest)
|
| + return b.isLayoutTest ? -1 : 1;
|
| if (a.prefix != b.prefix)
|
| - return a.name.localeCompare(b.name);
|
| - if (a.extension == "h" && (b.extension == "cpp" || b.extension == "cc"))
|
| - return -1;
|
| - if (b.extension == "h" && (a.extension == "cpp" || a.extension == "cc"))
|
| - return 1;
|
| + return a.prefix.localeCompare(b.prefix);
|
| + if (a.isHeader != b.isHeader)
|
| + return a.isHeader ? -1 : 1;
|
| return a.extension.localeCompare(b.extension);
|
| };
|
|
|
|
|