Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 22232:91df98701e9e
revert: explode the action tuple in the for loop
noop is about to gain a message.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 24 Jun 2014 18:04:13 +0100 |
parents | 10d9e7908a3c |
children | 4ab61b24e20c |
comparison
equal
deleted
inserted
replaced
22231:10d9e7908a3c | 22232:91df98701e9e |
---|---|
2468 # (<list of file>, message>) tuple | 2468 # (<list of file>, message>) tuple |
2469 actions = {'revert': ([], _('reverting %s\n')), | 2469 actions = {'revert': ([], _('reverting %s\n')), |
2470 'add': ([], _('adding %s\n')), | 2470 'add': ([], _('adding %s\n')), |
2471 'remove': ([], removeforget), | 2471 'remove': ([], removeforget), |
2472 'undelete': ([], _('undeleting %s\n')), | 2472 'undelete': ([], _('undeleting %s\n')), |
2473 'noop': None, | 2473 'noop': (None, None), |
2474 } | 2474 } |
2475 | 2475 |
2476 | 2476 |
2477 # should we do a backup? | 2477 # should we do a backup? |
2478 backup = not opts.get('no_backup') | 2478 backup = not opts.get('no_backup') |
2495 # target file to be touch on disk (relative to cwd) | 2495 # target file to be touch on disk (relative to cwd) |
2496 target = repo.wjoin(abs) | 2496 target = repo.wjoin(abs) |
2497 # search the entry in the dispatch table. | 2497 # search the entry in the dispatch table. |
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, 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 None: |
2504 if exact: | 2504 if exact: |
2505 ui.warn(_('no changes needed to %s\n') % rel) | 2505 ui.warn(_('no changes needed to %s\n') % rel) |
2506 break | 2506 break |
2507 xlist[0].append(abs) | 2507 xlist.append(abs) |
2508 if (dobackup and os.path.lexists(target) and | 2508 if (dobackup and os.path.lexists(target) and |
2509 abs in ctx and repo[None][abs].cmp(ctx[abs])): | 2509 abs in ctx and repo[None][abs].cmp(ctx[abs])): |
2510 bakname = "%s.orig" % rel | 2510 bakname = "%s.orig" % rel |
2511 ui.note(_('saving current version of %s as %s\n') % | 2511 ui.note(_('saving current version of %s as %s\n') % |
2512 (rel, bakname)) | 2512 (rel, bakname)) |
2513 if not opts.get('dry_run'): | 2513 if not opts.get('dry_run'): |
2514 util.rename(target, bakname) | 2514 util.rename(target, bakname) |
2515 if ui.verbose or not exact: | 2515 if ui.verbose or not exact: |
2516 msg = xlist[1] | |
2517 if not isinstance(msg, basestring): | 2516 if not isinstance(msg, basestring): |
2518 msg = msg(abs) | 2517 msg = msg(abs) |
2519 ui.status(msg % rel) | 2518 ui.status(msg % rel) |
2520 break | 2519 break |
2521 else: | 2520 else: |