Comments
Patch
@@ -6377,6 +6377,11 @@ def rollback(ui, repo, **opts):
commit transaction if it isn't checked out. Use --force to
override this protection.
+ The rollback command can be entirely disabled using the
+ `ui.norollback` configuration setting. If you're here because
+ you want to use rollback and it's disabled, you can re-enable
+ the command by setting `ui.norollback` to `true`.
+
This command is not intended for use on public repositories. Once
changes are visible for pull by other users, rolling a transaction
back locally is ineffective (someone else may already have pulled
@@ -6386,6 +6391,9 @@ def rollback(ui, repo, **opts):
Returns 0 on success, 1 if no rollback data is available.
"""
+ if ui.configbool('ui', 'norollback', False):
+ raise error.Abort(_('rollback is disabled and unsafe'),
+ hint=('see `hg help -v rollback` for information'))
return repo.rollback(dryrun=opts.get('dry_run'),
force=opts.get('force'))
@@ -196,3 +196,15 @@ corrupt journal test
checking files
1 files, 2 changesets, 2 total revisions
+rollback disabled by config
+ $ cat >> $HGRCPATH <<EOF
+ > [ui]
+ > norollback = true
+ > EOF
+ $ echo narf >> pinky-sayings.txt
+ $ hg add pinky-sayings.txt
+ $ hg ci -m 'First one.'
+ $ hg rollback
+ abort: rollback is disabled and unsafe
+ (see `hg help -v rollback` for information)
+ [255]