##// END OF EJS Templates
rollback: add a config knob for entirely disabling the command...
Augie Fackler -
r29086:fe50341d default
parent child Browse files
Show More
@@ -6383,6 +6383,11 def rollback(ui, repo, **opts):
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
@@ -6392,6 +6397,9 def rollback(ui, repo, **opts):
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
@@ -196,3 +196,15 corrupt journal test
196 checking files
196 checking files
197 1 files, 2 changesets, 2 total revisions
197 1 files, 2 changesets, 2 total revisions
198
198
199 rollback disabled by config
200 $ cat >> $HGRCPATH <<EOF
201 > [ui]
202 > rollback = false
203 > EOF
204 $ echo narf >> pinky-sayings.txt
205 $ hg add pinky-sayings.txt
206 $ hg ci -m 'First one.'
207 $ hg rollback
208 abort: rollback is disabled because it is unsafe
209 (see `hg help -v rollback` for information)
210 [255]
General Comments 0
You need to be logged in to leave comments. Login now