Show More
@@ -2366,10 +2366,30 b' def revert(ui, repo, ctx, parents, *pats' | |||||
2366 | # get the list of subrepos that must be reverted |
|
2366 | # get the list of subrepos that must be reverted | |
2367 | targetsubs = sorted(s for s in ctx.substate if m(s)) |
|
2367 | targetsubs = sorted(s for s in ctx.substate if m(s)) | |
2368 |
|
2368 | |||
2369 |
# Find status of all file in `names`. |
|
2369 | # Find status of all file in `names`. | |
2370 | m = scmutil.matchfiles(repo, names) |
|
2370 | m = scmutil.matchfiles(repo, names) | |
2371 | changes = repo.status(node1=parent, match=m)[:4] |
|
2371 | ||
2372 | dsmodified, dsadded, dsremoved, dsdeleted = map(set, changes) |
|
2372 | changes = repo.status(node1=node, match=m, clean=True) | |
|
2373 | modified = set(changes[0]) | |||
|
2374 | added = set(changes[1]) | |||
|
2375 | removed = set(changes[2]) | |||
|
2376 | deleted = set(changes[3]) | |||
|
2377 | ||||
|
2378 | # We need to account for the state of file in the dirstate | |||
|
2379 | # | |||
|
2380 | # Even, when we revert agains something else than parent. this will | |||
|
2381 | # slightly alter the behavior of revert (doing back up or not, delete | |||
|
2382 | # or just forget etc) | |||
|
2383 | if parent == node: | |||
|
2384 | dsmodified = modified | |||
|
2385 | dsadded = added | |||
|
2386 | dsremoved = removed | |||
|
2387 | modified, added, removed = set(), set(), set() | |||
|
2388 | else: | |||
|
2389 | changes = repo.status(node1=parent, match=m) | |||
|
2390 | dsmodified = set(changes[0]) | |||
|
2391 | dsadded = set(changes[1]) | |||
|
2392 | dsremoved = set(changes[2]) | |||
2373 |
|
2393 | |||
2374 | # if f is a rename, update `names` to also revert the source |
|
2394 | # if f is a rename, update `names` to also revert the source | |
2375 | cwd = repo.getcwd() |
|
2395 | cwd = repo.getcwd() | |
@@ -2395,8 +2415,8 b' def revert(ui, repo, ctx, parents, *pats' | |||||
2395 | dsadded -= missingadded |
|
2415 | dsadded -= missingadded | |
2396 | missingremoved = dsremoved - smf |
|
2416 | missingremoved = dsremoved - smf | |
2397 | dsremoved -= missingremoved |
|
2417 | dsremoved -= missingremoved | |
2398 |
missingdeleted = |
|
2418 | missingdeleted = deleted - smf | |
2399 |
|
|
2419 | deleted -= missingdeleted | |
2400 |
|
2420 | |||
2401 | # action to be actually performed by revert |
|
2421 | # action to be actually performed by revert | |
2402 | # (<list of file>, message>) tuple |
|
2422 | # (<list of file>, message>) tuple | |
@@ -2416,7 +2436,7 b' def revert(ui, repo, ctx, parents, *pats' | |||||
2416 | (missingadded, (actions['remove'], False)), |
|
2436 | (missingadded, (actions['remove'], False)), | |
2417 | (dsremoved, (actions['undelete'], True)), |
|
2437 | (dsremoved, (actions['undelete'], True)), | |
2418 | (missingremoved, (None, False)), |
|
2438 | (missingremoved, (None, False)), | |
2419 |
( |
|
2439 | (deleted, (actions['revert'], False)), | |
2420 | (missingdeleted, (actions['remove'], False)), |
|
2440 | (missingdeleted, (actions['remove'], False)), | |
2421 | ) |
|
2441 | ) | |
2422 |
|
2442 |
General Comments 0
You need to be logged in to leave comments.
Login now