comparison mercurial/commands.py @ 2227:4f072bb06e89

deprecate undo command, replace with rollback command.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Mon, 08 May 2006 14:19:05 -0700
parents 8164e3f31638
children 332950340788
comparison
equal deleted inserted replaced
2226:abfed2a82b07 2227:4f072bb06e89
2230 names.append(abs) 2230 names.append(abs)
2231 repo.remove(names, True, wlock) 2231 repo.remove(names, True, wlock)
2232 return errs 2232 return errs
2233 2233
2234 def revert(ui, repo, *pats, **opts): 2234 def revert(ui, repo, *pats, **opts):
2235 """revert modified files or dirs to their states as of some revision 2235 """revert files or dirs to their states as of some revision
2236 2236
2237 With no revision specified, revert the named files or directories 2237 With no revision specified, revert the named files or directories
2238 to the contents they had in the parent of the working directory. 2238 to the contents they had in the parent of the working directory.
2239 This restores the contents of the affected files to an unmodified 2239 This restores the contents of the affected files to an unmodified
2240 state. If the working directory has two parents, you must 2240 state. If the working directory has two parents, you must
2358 show_stats=False) 2358 show_stats=False)
2359 repo.dirstate.update(add[0], 'a') 2359 repo.dirstate.update(add[0], 'a')
2360 repo.dirstate.update(undelete[0], 'n') 2360 repo.dirstate.update(undelete[0], 'n')
2361 repo.dirstate.update(remove[0], 'r') 2361 repo.dirstate.update(remove[0], 'r')
2362 return r 2362 return r
2363
2364 def rollback(ui, repo):
2365 """roll back the last transaction in this repository
2366
2367 Roll back the last transaction in this repository, restoring the
2368 project to its state prior to the transaction.
2369
2370 Transactions are used to encapsulate the effects of all commands
2371 that create new changesets or propagate existing changesets into a
2372 repository. For example, the following commands are transactional,
2373 and their effects can be rolled back:
2374
2375 commit
2376 import
2377 pull
2378 push (with this repository as destination)
2379 unbundle
2380
2381 This command should be used with care. There is only one level of
2382 rollback, and there is no way to undo a rollback.
2383
2384 This command is not intended for use on public repositories. Once
2385 changes are visible for pull by other users, rolling a transaction
2386 back locally is ineffective (someone else may already have pulled
2387 the changes). Furthermore, a race is possible with readers of the
2388 repository; for example an in-progress pull from the repository
2389 may fail if a rollback is performed.
2390 """
2391 repo.undo()
2363 2392
2364 def root(ui, repo): 2393 def root(ui, repo):
2365 """print the root (top) of the current working dir 2394 """print the root (top) of the current working dir
2366 2395
2367 Print the root directory of the current repository. 2396 Print the root directory of the current repository.
2674 gen = generator(util.filechunkiter(f, 4096)) 2703 gen = generator(util.filechunkiter(f, 4096))
2675 modheads = repo.addchangegroup(util.chunkbuffer(gen)) 2704 modheads = repo.addchangegroup(util.chunkbuffer(gen))
2676 return postincoming(ui, repo, modheads, opts['update']) 2705 return postincoming(ui, repo, modheads, opts['update'])
2677 2706
2678 def undo(ui, repo): 2707 def undo(ui, repo):
2679 """undo the last commit or pull 2708 """undo the last commit or pull (DEPRECATED)
2680 2709
2681 Roll back the last pull or commit transaction on the 2710 (DEPRECATED)
2682 repository, restoring the project to its earlier state. 2711 This command is now deprecated and will be removed in a future
2683 2712 release. Please use the rollback command instead. For usage
2684 This command should be used with care. There is only one level of 2713 instructions, see the rollback command.
2685 undo and there is no redo.
2686
2687 This command is not intended for use on public repositories. Once
2688 a change is visible for pull by other users, undoing it locally is
2689 ineffective. Furthemore a race is possible with readers of the
2690 repository, for example an ongoing pull from the repository will
2691 fail and rollback.
2692 """ 2714 """
2693 repo.undo() 2715 repo.undo()
2694 2716
2695 def update(ui, repo, node=None, merge=False, clean=False, force=None, 2717 def update(ui, repo, node=None, merge=False, clean=False, force=None,
2696 branch=None, **opts): 2718 branch=None, **opts):
3016 [('r', 'rev', '', _('revision to revert to')), 3038 [('r', 'rev', '', _('revision to revert to')),
3017 ('', 'no-backup', None, _('do not save backup copies of files')), 3039 ('', 'no-backup', None, _('do not save backup copies of files')),
3018 ('I', 'include', [], _('include names matching given patterns')), 3040 ('I', 'include', [], _('include names matching given patterns')),
3019 ('X', 'exclude', [], _('exclude names matching given patterns'))], 3041 ('X', 'exclude', [], _('exclude names matching given patterns'))],
3020 _('hg revert [-r REV] [NAME]...')), 3042 _('hg revert [-r REV] [NAME]...')),
3043 "rollback": (rollback, [], _('hg rollback')),
3021 "root": (root, [], _('hg root')), 3044 "root": (root, [], _('hg root')),
3022 "^serve": 3045 "^serve":
3023 (serve, 3046 (serve,
3024 [('A', 'accesslog', '', _('name of access log file to write to')), 3047 [('A', 'accesslog', '', _('name of access log file to write to')),
3025 ('d', 'daemon', None, _('run server in background')), 3048 ('d', 'daemon', None, _('run server in background')),