##// END OF EJS Templates
revert: move manifest membership condition outside of the loop...
Pierre-Yves David -
r22153:fc8bc278 default
parent child Browse files
Show More
@@ -2386,6 +2386,18 b' def revert(ui, repo, ctx, parents, *pats'
2386 return _('forgetting %s\n')
2386 return _('forgetting %s\n')
2387 return _('removing %s\n')
2387 return _('removing %s\n')
2388
2388
2389 # split between files known in target manifest and the others
2390 smf = set(mf)
2391
2392 missingmodified = modified - smf
2393 modified -= missingmodified
2394 missingadded = added - smf
2395 added -= missingadded
2396 missingremoved = removed - smf
2397 removed -= missingremoved
2398 missingdeleted = deleted - smf
2399 deleted -= missingdeleted
2400
2389 # action to be actually performed by revert
2401 # action to be actually performed by revert
2390 # (<list of file>, message>) tuple
2402 # (<list of file>, message>) tuple
2391 actions = {'revert': ([], _('reverting %s\n')),
2403 actions = {'revert': ([], _('reverting %s\n')),
@@ -2396,18 +2408,16 b' def revert(ui, repo, ctx, parents, *pats'
2396 disptable = (
2408 disptable = (
2397 # dispatch table:
2409 # dispatch table:
2398 # file state
2410 # file state
2399 # action if in target manifest
2411 # action
2400 # action if not in target manifest
2412 # make backup
2401 # make backup if in target manifest
2413 (modified, (actions['revert'], True)),
2402 # make backup if not in target manifest
2414 (missingmodified, (actions['remove'], True)),
2403 (modified, (actions['revert'], True),
2415 (added, (actions['revert'], True)),
2404 (actions['remove'], True)),
2416 (missingadded, (actions['remove'], False)),
2405 (added, (actions['revert'], True),
2417 (removed, (actions['undelete'], True)),
2406 (actions['remove'], False)),
2418 (missingremoved, (None, False)),
2407 (removed, (actions['undelete'], True),
2419 (deleted, (actions['revert'], False)),
2408 (None, False)),
2420 (missingdeleted, (actions['remove'], False)),
2409 (deleted, (actions['revert'], False),
2410 (actions['remove'], False)),
2411 )
2421 )
2412
2422
2413 for abs, (rel, exact) in sorted(names.items()):
2423 for abs, (rel, exact) in sorted(names.items()):
@@ -2433,14 +2443,11 b' def revert(ui, repo, ctx, parents, *pats'
2433 # search the entry in the dispatch table.
2443 # search the entry in the dispatch table.
2434 # if the file is in any of this sets, it was touched in the working
2444 # if the file is in any of this sets, it was touched in the working
2435 # directory parent and we are sure it needs to be reverted.
2445 # directory parent and we are sure it needs to be reverted.
2436 for table, hit, miss in disptable:
2446 for table, (action, backup) in disptable:
2437 if abs not in table:
2447 if abs not in table:
2438 continue
2448 continue
2439 # file has changed in dirstate
2449 if action is not None:
2440 if mfentry:
2450 handle(action, backup)
2441 handle(*hit)
2442 elif miss[0] is not None:
2443 handle(*miss)
2444 break
2451 break
2445 else:
2452 else:
2446 # Not touched in current dirstate.
2453 # Not touched in current dirstate.
General Comments 0
You need to be logged in to leave comments. Login now