Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 29086:fe50341de1ff
rollback: add a config knob for entirely disabling the command
This is of pretty high value for organizations that used to use p4 (as
an example), since `p4 rollback` is what we call `hg backout`.
author | Augie Fackler <augie@google.com> |
---|---|
date | Tue, 03 May 2016 16:33:25 -0400 |
parents | 29a7d591ff42 |
children | a032ebea4e97 |
comparison
equal
deleted
inserted
replaced
29085:df838803c1d4 | 29086:fe50341de1ff |
---|---|
6381 | 6381 |
6382 To avoid permanent data loss, rollback will refuse to rollback a | 6382 To avoid permanent data loss, rollback will refuse to rollback a |
6383 commit transaction if it isn't checked out. Use --force to | 6383 commit transaction if it isn't checked out. Use --force to |
6384 override this protection. | 6384 override this protection. |
6385 | 6385 |
6386 The rollback command can be entirely disabled by setting the | |
6387 ``ui.rollback`` configuration setting to false. If you're here | |
6388 because you want to use rollback and it's disabled, you can | |
6389 re-enable the command by setting ``ui.rollback`` to true. | |
6390 | |
6386 This command is not intended for use on public repositories. Once | 6391 This command is not intended for use on public repositories. Once |
6387 changes are visible for pull by other users, rolling a transaction | 6392 changes are visible for pull by other users, rolling a transaction |
6388 back locally is ineffective (someone else may already have pulled | 6393 back locally is ineffective (someone else may already have pulled |
6389 the changes). Furthermore, a race is possible with readers of the | 6394 the changes). Furthermore, a race is possible with readers of the |
6390 repository; for example an in-progress pull from the repository | 6395 repository; for example an in-progress pull from the repository |
6391 may fail if a rollback is performed. | 6396 may fail if a rollback is performed. |
6392 | 6397 |
6393 Returns 0 on success, 1 if no rollback data is available. | 6398 Returns 0 on success, 1 if no rollback data is available. |
6394 """ | 6399 """ |
6400 if not ui.configbool('ui', 'rollback', True): | |
6401 raise error.Abort(_('rollback is disabled because it is unsafe'), | |
6402 hint=('see `hg help -v rollback` for information')) | |
6395 return repo.rollback(dryrun=opts.get('dry_run'), | 6403 return repo.rollback(dryrun=opts.get('dry_run'), |
6396 force=opts.get('force')) | 6404 force=opts.get('force')) |
6397 | 6405 |
6398 @command('root', []) | 6406 @command('root', []) |
6399 def root(ui, repo): | 6407 def root(ui, repo): |