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