Show More
@@ -2407,7 +2407,6 b' def revert(ui, repo, ctx, parents, *pats' | |||||
2407 | dsmodified = set(changes[0]) |
|
2407 | dsmodified = set(changes[0]) | |
2408 | dsadded = set(changes[1]) |
|
2408 | dsadded = set(changes[1]) | |
2409 | dsremoved = set(changes[2]) |
|
2409 | dsremoved = set(changes[2]) | |
2410 | dsadded |= _deletedadded |
|
|||
2411 |
|
2410 | |||
2412 | # only take into account for removes between wc and target |
|
2411 | # only take into account for removes between wc and target | |
2413 | clean |= dsremoved - removed |
|
2412 | clean |= dsremoved - removed | |
@@ -2420,6 +2419,22 b' def revert(ui, repo, ctx, parents, *pats' | |||||
2420 | dsmodified |= modified & dsadded # dirstate added may needs backup |
|
2419 | dsmodified |= modified & dsadded # dirstate added may needs backup | |
2421 | modified -= dsmodified |
|
2420 | modified -= dsmodified | |
2422 |
|
2421 | |||
|
2422 | # There are three categories of added files | |||
|
2423 | # | |||
|
2424 | # 1. addition that just happened in the dirstate | |||
|
2425 | # (should be forgotten) | |||
|
2426 | # 2. file is added since target revision and has local changes | |||
|
2427 | # (should be backed up and removed) | |||
|
2428 | # 3. file is added since target revision and is clean | |||
|
2429 | # (should be removed) | |||
|
2430 | # | |||
|
2431 | # However we do not need to split them yet. The current revert code | |||
|
2432 | # will automatically recognize (1) when performing operation. And | |||
|
2433 | # the backup system is currently unabled to handle (2). | |||
|
2434 | # | |||
|
2435 | # So we just put them all in the same group. | |||
|
2436 | dsadded = added | |||
|
2437 | ||||
2423 | # if f is a rename, update `names` to also revert the source |
|
2438 | # if f is a rename, update `names` to also revert the source | |
2424 | cwd = repo.getcwd() |
|
2439 | cwd = repo.getcwd() | |
2425 | for f in dsadded: |
|
2440 | for f in dsadded: | |
@@ -2437,8 +2452,6 b' def revert(ui, repo, ctx, parents, *pats' | |||||
2437 |
|
2452 | |||
2438 | missingmodified = dsmodified - smf |
|
2453 | missingmodified = dsmodified - smf | |
2439 | dsmodified -= missingmodified |
|
2454 | dsmodified -= missingmodified | |
2440 | missingadded = dsadded - smf |
|
|||
2441 | dsadded -= missingadded |
|
|||
2442 |
|
2455 | |||
2443 | # action to be actually performed by revert |
|
2456 | # action to be actually performed by revert | |
2444 | # (<list of file>, message>) tuple |
|
2457 | # (<list of file>, message>) tuple | |
@@ -2455,8 +2468,7 b' def revert(ui, repo, ctx, parents, *pats' | |||||
2455 | (modified, (actions['revert'], False)), |
|
2468 | (modified, (actions['revert'], False)), | |
2456 | (dsmodified, (actions['revert'], True)), |
|
2469 | (dsmodified, (actions['revert'], True)), | |
2457 | (missingmodified, (actions['remove'], True)), |
|
2470 | (missingmodified, (actions['remove'], True)), | |
2458 |
(dsadded, (actions['reve |
|
2471 | (dsadded, (actions['remove'], True)), | |
2459 | (missingadded, (actions['remove'], False)), |
|
|||
2460 | (removed, (actions['add'], True)), |
|
2472 | (removed, (actions['add'], True)), | |
2461 | (dsremoved, (actions['undelete'], True)), |
|
2473 | (dsremoved, (actions['undelete'], True)), | |
2462 | (clean, (None, False)), |
|
2474 | (clean, (None, False)), |
@@ -908,12 +908,6 b' Test revert --all to "base" content' | |||||
908 |
|
908 | |||
909 | check revert output |
|
909 | check revert output | |
910 |
|
910 | |||
911 | Misbehavior: |
|
|||
912 |
|
||||
913 | - report "reverting" when file needs no changes |
|
|||
914 | | |
|
|||
915 | | - reverting removed_revert |
|
|||
916 |
|
||||
917 | $ hg revert --all --rev 'desc(base)' |
|
911 | $ hg revert --all --rev 'desc(base)' | |
918 | removing added_clean |
|
912 | removing added_clean | |
919 | removing added_deleted |
|
913 | removing added_deleted | |
@@ -936,7 +930,6 b' Misbehavior:' | |||||
936 | adding removed_clean |
|
930 | adding removed_clean | |
937 | reverting removed_deleted |
|
931 | reverting removed_deleted | |
938 | adding removed_removed |
|
932 | adding removed_removed | |
939 | reverting removed_revert |
|
|||
940 | adding removed_untracked-clean |
|
933 | adding removed_untracked-clean | |
941 | adding removed_untracked-revert |
|
934 | adding removed_untracked-revert | |
942 | adding removed_untracked-wc |
|
935 | adding removed_untracked-wc | |
@@ -1098,12 +1091,6 b' Test revert to "base" content with expli' | |||||
1098 | revert all files individually and check the output |
|
1091 | revert all files individually and check the output | |
1099 | (output is expected to be different than in the --all case) |
|
1092 | (output is expected to be different than in the --all case) | |
1100 |
|
1093 | |||
1101 | Misbehavior: |
|
|||
1102 |
|
||||
1103 | - fails to report no change to revert for |
|
|||
1104 | | |
|
|||
1105 | | - removed_revert |
|
|||
1106 |
|
||||
1107 | $ for file in `python ../gen-revert-cases.py filelist`; do |
|
1094 | $ for file in `python ../gen-revert-cases.py filelist`; do | |
1108 | > echo '### revert for:' $file; |
|
1095 | > echo '### revert for:' $file; | |
1109 | > hg revert $file --rev 'desc(base)'; |
|
1096 | > hg revert $file --rev 'desc(base)'; | |
@@ -1194,6 +1181,7 b' Misbehavior:' | |||||
1194 | ### revert for: removed_removed |
|
1181 | ### revert for: removed_removed | |
1195 |
|
1182 | |||
1196 | ### revert for: removed_revert |
|
1183 | ### revert for: removed_revert | |
|
1184 | no changes needed to removed_revert | |||
1197 |
|
1185 | |||
1198 | ### revert for: removed_untracked-clean |
|
1186 | ### revert for: removed_untracked-clean | |
1199 |
|
1187 |
General Comments 0
You need to be logged in to leave comments.
Login now