# HG changeset patch # User Christian Delahousse # Date 2015-11-12 23:00:08 # Node ID 080276d377d9131c1fd4f538f7def95d669eba9f # Parent dda0aa3baeddc95a3834bed1fc718c747f224bbf revert: allow configuring the .orig file location diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -3082,7 +3082,7 @@ def revert(ui, repo, ctx, parents, *pats xlist.append(abs) if dobackup and (backup <= dobackup or wctx[abs].cmp(ctx[abs])): - bakname = "%s.orig" % rel + bakname = origpath(ui, repo, rel) ui.note(_('saving current version of %s as %s\n') % (rel, bakname)) if not opts.get('dry_run'): diff --git a/tests/test-revert.t b/tests/test-revert.t --- a/tests/test-revert.t +++ b/tests/test-revert.t @@ -86,6 +86,16 @@ Test creation of backup (.orig) files saving current version of e as e.orig reverting e +Test creation of backup (.orig) file in configured file location +---------------------------------------------------------------- + + $ echo z > e + $ hg revert --all -v --config 'ui.origbackuppath=.hg/origbackups' + creating directory: $TESTTMP/repo/.hg/origbackups + saving current version of e as $TESTTMP/repo/.hg/origbackups/e.orig + reverting e + $ rm -rf .hg/origbackups + revert on clean file (no change) --------------------------------