##// END OF EJS Templates
revert: special case 'hg revert --all'...
Durham Goode -
r22573:f528bfb2 default
parent child Browse files
Show More
@@ -2480,34 +2480,43 b' def revert(ui, repo, ctx, parents, *pats'
2480 # walk dirstate to fill `names`
2480 # walk dirstate to fill `names`
2481
2481
2482 m = scmutil.match(repo[None], pats, opts)
2482 m = scmutil.match(repo[None], pats, opts)
2483 m.bad = lambda x, y: False
2483 if not m.always() or node != parent:
2484 for abs in repo.walk(m):
2484 m.bad = lambda x, y: False
2485 names[abs] = m.rel(abs), m.exact(abs)
2485 for abs in repo.walk(m):
2486
2486 names[abs] = m.rel(abs), m.exact(abs)
2487 # walk target manifest to fill `names`
2487
2488
2488 # walk target manifest to fill `names`
2489 def badfn(path, msg):
2489
2490 if path in names:
2490 def badfn(path, msg):
2491 return
2491 if path in names:
2492 if path in ctx.substate:
2492 return
2493 return
2493 if path in ctx.substate:
2494 path_ = path + '/'
2495 for f in names:
2496 if f.startswith(path_):
2497 return
2494 return
2498 ui.warn("%s: %s\n" % (m.rel(path), msg))
2495 path_ = path + '/'
2499
2496 for f in names:
2500 m = scmutil.match(ctx, pats, opts)
2497 if f.startswith(path_):
2501 m.bad = badfn
2498 return
2502 for abs in ctx.walk(m):
2499 ui.warn("%s: %s\n" % (m.rel(path), msg))
2503 if abs not in names:
2500
2504 names[abs] = m.rel(abs), m.exact(abs)
2501 m = scmutil.match(ctx, pats, opts)
2505
2502 m.bad = badfn
2506 # Find status of all file in `names`.
2503 for abs in ctx.walk(m):
2507 m = scmutil.matchfiles(repo, names)
2504 if abs not in names:
2508
2505 names[abs] = m.rel(abs), m.exact(abs)
2509 changes = repo.status(node1=node, match=m,
2506
2510 unknown=True, ignored=True, clean=True)
2507 # Find status of all file in `names`.
2508 m = scmutil.matchfiles(repo, names)
2509
2510 changes = repo.status(node1=node, match=m,
2511 unknown=True, ignored=True, clean=True)
2512 else:
2513 changes = repo.status(match=m)
2514 for kind in changes:
2515 for abs in kind:
2516 names[abs] = m.rel(abs), m.exact(abs)
2517
2518 m = scmutil.matchfiles(repo, names)
2519
2511 modified = set(changes[0])
2520 modified = set(changes[0])
2512 added = set(changes[1])
2521 added = set(changes[1])
2513 removed = set(changes[2])
2522 removed = set(changes[2])
General Comments 0
You need to be logged in to leave comments. Login now