Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
8365:94e91205d9b6 | 8366:0bf0045000b5 |
---|---|
261 else: | 261 else: |
262 act("remote created", "g", f, m2.flags(f)) | 262 act("remote created", "g", f, m2.flags(f)) |
263 | 263 |
264 return action | 264 return action |
265 | 265 |
266 def actioncmp(a1, a2): | 266 def actionkey(a): |
267 m1 = a1[1] | 267 return a[1] == 'r' and -1 or 0, a |
268 m2 = a2[1] | |
269 if m1 == m2: | |
270 return cmp(a1, a2) | |
271 if m1 == 'r': | |
272 return -1 | |
273 if m2 == 'r': | |
274 return 1 | |
275 return cmp(a1, a2) | |
276 | 268 |
277 def applyupdates(repo, action, wctx, mctx): | 269 def applyupdates(repo, action, wctx, mctx): |
278 "apply the merge action list to the working directory" | 270 "apply the merge action list to the working directory" |
279 | 271 |
280 updated, merged, removed, unresolved = 0, 0, 0, 0 | 272 updated, merged, removed, unresolved = 0, 0, 0, 0 |
281 ms = mergestate(repo) | 273 ms = mergestate(repo) |
282 ms.reset(wctx.parents()[0].node()) | 274 ms.reset(wctx.parents()[0].node()) |
283 moves = [] | 275 moves = [] |
284 action.sort(actioncmp) | 276 action.sort(key=actionkey) |
285 | 277 |
286 # prescan for merges | 278 # prescan for merges |
287 for a in action: | 279 for a in action: |
288 f, m = a[:2] | 280 f, m = a[:2] |
289 if m == 'm': # merge | 281 if m == 'm': # merge |