2498 # if the file is in any of these sets, it was touched in the working |
2498 # if the file is in any of these sets, it was touched in the working |
2499 # directory parent and we are sure it needs to be reverted. |
2499 # directory parent and we are sure it needs to be reverted. |
2500 for table, (xlist, msg), dobackup in disptable: |
2500 for table, (xlist, msg), dobackup in disptable: |
2501 if abs not in table: |
2501 if abs not in table: |
2502 continue |
2502 continue |
2503 if xlist is None: |
2503 if xlist is not None: |
2504 if exact: |
2504 xlist.append(abs) |
2505 ui.warn(_('no changes needed to %s\n') % rel) |
2505 if (dobackup and os.path.lexists(target) and |
2506 break |
2506 abs in ctx and repo[None][abs].cmp(ctx[abs])): |
2507 xlist.append(abs) |
2507 bakname = "%s.orig" % rel |
2508 if (dobackup and os.path.lexists(target) and |
2508 ui.note(_('saving current version of %s as %s\n') % |
2509 abs in ctx and repo[None][abs].cmp(ctx[abs])): |
2509 (rel, bakname)) |
2510 bakname = "%s.orig" % rel |
2510 if not opts.get('dry_run'): |
2511 ui.note(_('saving current version of %s as %s\n') % |
2511 util.rename(target, bakname) |
2512 (rel, bakname)) |
2512 if ui.verbose or not exact: |
2513 if not opts.get('dry_run'): |
2513 if not isinstance(msg, basestring): |
2514 util.rename(target, bakname) |
2514 msg = msg(abs) |
2515 if ui.verbose or not exact: |
2515 ui.status(msg % rel) |
2516 if not isinstance(msg, basestring): |
2516 elif exact: |
2517 msg = msg(abs) |
2517 ui.warn(_('no changes needed to %s\n') % rel) |
2518 ui.status(msg % rel) |
|
2519 break |
2518 break |
2520 else: |
2519 else: |
2521 # Not touched in current dirstate. |
2520 # Not touched in current dirstate. |
2522 |
2521 |
2523 # file is unknown in parent, restore older version or ignore. |
2522 # file is unknown in parent, restore older version or ignore. |