diff mercurial/merge.py @ 8366:0bf0045000b5

some modernization cleanups, forward compatibility
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Wed, 13 May 2009 14:08:39 +0200
parents b87a50b7125c
children 3f4f14eab085
line wrap: on
line diff
--- a/mercurial/merge.py	Tue May 12 10:03:36 2009 -0400
+++ b/mercurial/merge.py	Wed May 13 14:08:39 2009 +0200
@@ -263,16 +263,8 @@
 
     return action
 
-def actioncmp(a1, a2):
-    m1 = a1[1]
-    m2 = a2[1]
-    if m1 == m2:
-        return cmp(a1, a2)
-    if m1 == 'r':
-        return -1
-    if m2 == 'r':
-        return 1
-    return cmp(a1, a2)
+def actionkey(a):
+    return a[1] == 'r' and -1 or 0, a
 
 def applyupdates(repo, action, wctx, mctx):
     "apply the merge action list to the working directory"
@@ -281,7 +273,7 @@
     ms = mergestate(repo)
     ms.reset(wctx.parents()[0].node())
     moves = []
-    action.sort(actioncmp)
+    action.sort(key=actionkey)
 
     # prescan for merges
     for a in action: