Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Unified Diff: patch.py

Issue 10915240: Fix the patch application sorting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « checkout.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: patch.py
diff --git a/patch.py b/patch.py
index e7bf56648bbdaffc03a974e696e1b06ddd638705..44282ddaf1a04b041fce16d680be7a3d927bb0ef 100644
--- a/patch.py
+++ b/patch.py
@@ -503,11 +503,13 @@ class PatchSet(object):
File move are first.
Deletes are last.
"""
- if p.source_filename:
- return (p.is_delete, p.source_filename_utf8, p.filename_utf8)
- else:
- # tuple are always greater than string, abuse that fact.
- return (p.is_delete, (p.filename_utf8,), p.filename_utf8)
+ # The bool is necessary because None < 'string' but the reverse is needed.
+ return (
+ p.is_delete,
+ # False is before True, so files *with* a source file will be first.
+ not bool(p.source_filename),
+ p.source_filename_utf8,
+ p.filename_utf8)
self.patches = sorted(patches, key=key)
« no previous file with comments | « checkout.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698