818 if opts['parent']: |
818 if opts['parent']: |
819 raise util.Abort(_('cannot use --parent on non-merge changeset')) |
819 raise util.Abort(_('cannot use --parent on non-merge changeset')) |
820 parent = p1 |
820 parent = p1 |
821 hg.clean(repo, node, show_stats=False) |
821 hg.clean(repo, node, show_stats=False) |
822 revert_opts = opts.copy() |
822 revert_opts = opts.copy() |
|
823 revert_opts['all'] = True |
823 revert_opts['rev'] = hex(parent) |
824 revert_opts['rev'] = hex(parent) |
824 revert(ui, repo, **revert_opts) |
825 revert(ui, repo, **revert_opts) |
825 commit_opts = opts.copy() |
826 commit_opts = opts.copy() |
826 commit_opts['addremove'] = False |
827 commit_opts['addremove'] = False |
827 if not commit_opts['message'] and not commit_opts['logfile']: |
828 if not commit_opts['message'] and not commit_opts['logfile']: |
2286 If a file has been deleted, it is recreated. If the executable |
2287 If a file has been deleted, it is recreated. If the executable |
2287 mode of a file was changed, it is reset. |
2288 mode of a file was changed, it is reset. |
2288 |
2289 |
2289 If names are given, all files matching the names are reverted. |
2290 If names are given, all files matching the names are reverted. |
2290 |
2291 |
2291 If no arguments are given, all files in the repository are reverted. |
2292 If no arguments are given, no files are reverted. |
2292 """ |
2293 """ |
|
2294 |
|
2295 if not pats and not opts['all']: |
|
2296 raise util.Abort(_('no files or directories specified')) |
|
2297 |
2293 parent, p2 = repo.dirstate.parents() |
2298 parent, p2 = repo.dirstate.parents() |
2294 if opts['rev']: |
2299 if opts['rev']: |
2295 node = repo.lookup(opts['rev']) |
2300 node = repo.lookup(opts['rev']) |
2296 elif p2 != nullid: |
2301 elif p2 != nullid: |
2297 raise util.Abort(_('working dir has two parents; ' |
2302 raise util.Abort(_('working dir has two parents; ' |
3042 ('X', 'exclude', [], _('exclude names matching the given patterns')), |
3047 ('X', 'exclude', [], _('exclude names matching the given patterns')), |
3043 ('n', 'dry-run', None, _('do not perform actions, just print output'))], |
3048 ('n', 'dry-run', None, _('do not perform actions, just print output'))], |
3044 _('hg rename [OPTION]... SOURCE... DEST')), |
3049 _('hg rename [OPTION]... SOURCE... DEST')), |
3045 "^revert": |
3050 "^revert": |
3046 (revert, |
3051 (revert, |
3047 [('r', 'rev', '', _('revision to revert to')), |
3052 [('', 'all', None, _('revert all changes when no arguments given')), |
|
3053 ('r', 'rev', '', _('revision to revert to')), |
3048 ('', 'no-backup', None, _('do not save backup copies of files')), |
3054 ('', 'no-backup', None, _('do not save backup copies of files')), |
3049 ('I', 'include', [], _('include names matching given patterns')), |
3055 ('I', 'include', [], _('include names matching given patterns')), |
3050 ('X', 'exclude', [], _('exclude names matching given patterns')), |
3056 ('X', 'exclude', [], _('exclude names matching given patterns')), |
3051 ('n', 'dry-run', None, _('do not perform actions, just print output'))], |
3057 ('n', 'dry-run', None, _('do not perform actions, just print output'))], |
3052 _('hg revert [-r REV] [NAME]...')), |
3058 _('hg revert [-r REV] [NAME]...')), |