Show More
@@ -2318,10 +2318,10 b' def revert(ui, repo, ctx, parents, *pats' | |||||
2318 |
|
2318 | |||
2319 | # action to be actually performed by revert |
|
2319 | # action to be actually performed by revert | |
2320 | # (<list of file>, message>) tuple |
|
2320 | # (<list of file>, message>) tuple | |
2321 |
|
|
2321 | actions = {'revert': ([], _('reverting %s\n')), | |
2322 |
add |
|
2322 | 'add': ([], _('adding %s\n')), | |
2323 |
remove |
|
2323 | 'remove': ([], removeforget), | |
2324 |
undelete |
|
2324 | 'undelete': ([], _('undeleting %s\n'))} | |
2325 |
|
2325 | |||
2326 | disptable = ( |
|
2326 | disptable = ( | |
2327 | # dispatch table: |
|
2327 | # dispatch table: | |
@@ -2330,10 +2330,10 b' def revert(ui, repo, ctx, parents, *pats' | |||||
2330 | # action if not in target manifest |
|
2330 | # action if not in target manifest | |
2331 | # make backup if in target manifest |
|
2331 | # make backup if in target manifest | |
2332 | # make backup if not in target manifest |
|
2332 | # make backup if not in target manifest | |
2333 | (modified, revert, remove, True, True), |
|
2333 | (modified, actions['revert'], actions['remove'], True, True), | |
2334 | (added, revert, remove, True, False), |
|
2334 | (added, actions['revert'], actions['remove'], True, False), | |
2335 | (removed, undelete, None, True, False), |
|
2335 | (removed, actions['undelete'], None, True, False), | |
2336 | (deleted, revert, remove, False, False), |
|
2336 | (deleted, actions['revert'], actions['remove'], False, False), | |
2337 | ) |
|
2337 | ) | |
2338 |
|
2338 | |||
2339 | for abs, (rel, exact) in sorted(names.items()): |
|
2339 | for abs, (rel, exact) in sorted(names.items()): | |
@@ -2374,7 +2374,7 b' def revert(ui, repo, ctx, parents, *pats' | |||||
2374 | # file is unknown in parent, restore older version or ignore. |
|
2374 | # file is unknown in parent, restore older version or ignore. | |
2375 | if abs not in repo.dirstate: |
|
2375 | if abs not in repo.dirstate: | |
2376 | if mfentry: |
|
2376 | if mfentry: | |
2377 | handle(add, True) |
|
2377 | handle(actions['add'], True) | |
2378 | elif exact: |
|
2378 | elif exact: | |
2379 | ui.warn(_('file not managed: %s\n') % rel) |
|
2379 | ui.warn(_('file not managed: %s\n') % rel) | |
2380 | continue |
|
2380 | continue | |
@@ -2394,11 +2394,12 b' def revert(ui, repo, ctx, parents, *pats' | |||||
2394 | # manifests, do nothing |
|
2394 | # manifests, do nothing | |
2395 | if (pmf[abs] != mfentry or |
|
2395 | if (pmf[abs] != mfentry or | |
2396 | pmf.flags(abs) != mf.flags(abs)): |
|
2396 | pmf.flags(abs) != mf.flags(abs)): | |
2397 | handle(revert, False) |
|
2397 | handle(actions['revert'], False) | |
2398 | else: |
|
2398 | else: | |
2399 | handle(remove, False) |
|
2399 | handle(actions['remove'], False) | |
|
2400 | ||||
2400 | if not opts.get('dry_run'): |
|
2401 | if not opts.get('dry_run'): | |
2401 |
_performrevert(repo, parents, ctx, |
|
2402 | _performrevert(repo, parents, ctx, actions) | |
2402 |
|
2403 | |||
2403 | if targetsubs: |
|
2404 | if targetsubs: | |
2404 | # Revert the subrepos on the revert list |
|
2405 | # Revert the subrepos on the revert list | |
@@ -2407,8 +2408,8 b' def revert(ui, repo, ctx, parents, *pats' | |||||
2407 | finally: |
|
2408 | finally: | |
2408 | wlock.release() |
|
2409 | wlock.release() | |
2409 |
|
2410 | |||
2410 |
def _performrevert(repo, parents, ctx, |
|
2411 | def _performrevert(repo, parents, ctx, actions): | |
2411 | """function that actually perform all the action computed for revert |
|
2412 | """function that actually perform all the actions computed for revert | |
2412 |
|
2413 | |||
2413 | This is an independent function to let extension to plug in and react to |
|
2414 | This is an independent function to let extension to plug in and react to | |
2414 | the imminent revert. |
|
2415 | the imminent revert. | |
@@ -2422,7 +2423,7 b' def _performrevert(repo, parents, ctx, r' | |||||
2422 | repo.wwrite(f, fc.data(), fc.flags()) |
|
2423 | repo.wwrite(f, fc.data(), fc.flags()) | |
2423 |
|
2424 | |||
2424 | audit_path = pathutil.pathauditor(repo.root) |
|
2425 | audit_path = pathutil.pathauditor(repo.root) | |
2425 | for f in remove[0]: |
|
2426 | for f in actions['remove'][0]: | |
2426 | if repo.dirstate[f] == 'a': |
|
2427 | if repo.dirstate[f] == 'a': | |
2427 | repo.dirstate.drop(f) |
|
2428 | repo.dirstate.drop(f) | |
2428 | continue |
|
2429 | continue | |
@@ -2442,25 +2443,25 b' def _performrevert(repo, parents, ctx, r' | |||||
2442 | normal = repo.dirstate.normallookup |
|
2443 | normal = repo.dirstate.normallookup | |
2443 | else: |
|
2444 | else: | |
2444 | normal = repo.dirstate.normal |
|
2445 | normal = repo.dirstate.normal | |
2445 | for f in revert[0]: |
|
2446 | for f in actions['revert'][0]: | |
2446 | checkout(f) |
|
2447 | checkout(f) | |
2447 | if normal: |
|
2448 | if normal: | |
2448 | normal(f) |
|
2449 | normal(f) | |
2449 |
|
2450 | |||
2450 | for f in add[0]: |
|
2451 | for f in actions['add'][0]: | |
2451 | checkout(f) |
|
2452 | checkout(f) | |
2452 | repo.dirstate.add(f) |
|
2453 | repo.dirstate.add(f) | |
2453 |
|
2454 | |||
2454 | normal = repo.dirstate.normallookup |
|
2455 | normal = repo.dirstate.normallookup | |
2455 | if node == parent and p2 == nullid: |
|
2456 | if node == parent and p2 == nullid: | |
2456 | normal = repo.dirstate.normal |
|
2457 | normal = repo.dirstate.normal | |
2457 | for f in undelete[0]: |
|
2458 | for f in actions['undelete'][0]: | |
2458 | checkout(f) |
|
2459 | checkout(f) | |
2459 | normal(f) |
|
2460 | normal(f) | |
2460 |
|
2461 | |||
2461 | copied = copies.pathcopies(repo[parent], ctx) |
|
2462 | copied = copies.pathcopies(repo[parent], ctx) | |
2462 |
|
2463 | |||
2463 | for f in add[0] + undelete[0] + revert[0]: |
|
2464 | for f in actions['add'][0] + actions['undelete'][0] + actions['revert'][0]: | |
2464 | if f in copied: |
|
2465 | if f in copied: | |
2465 | repo.dirstate.copy(copied[f], f) |
|
2466 | repo.dirstate.copy(copied[f], f) | |
2466 |
|
2467 |
General Comments 0
You need to be logged in to leave comments.
Login now