changeset 35519:31fe397f2bda

revert: support reverting to hidden cset if directaccess config is set This patch adds support for reverting files to a hidden changeset if `experimental.directacess=True` is set. Differential Revision: https://phab.mercurial-scm.org/D1763
author Pulkit Goyal <7895pulkit@gmail.com>
date Wed, 27 Dec 2017 00:24:53 +0530
parents 02fdb8c018aa
children 711149d8e676
files mercurial/commands.py tests/test-directaccess.t
diffstat 2 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Dec 27 00:14:00 2017 +0530
+++ b/mercurial/commands.py	Wed Dec 27 00:24:53 2017 +0530
@@ -4588,7 +4588,10 @@
         raise error.Abort(_('uncommitted merge with no revision specified'),
                          hint=_("use 'hg update' or see 'hg help revert'"))
 
-    ctx = scmutil.revsingle(repo, opts.get('rev'))
+    rev = opts.get('rev')
+    if rev:
+        repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
+    ctx = scmutil.revsingle(repo, rev)
 
     if (not (pats or opts.get('include') or opts.get('exclude') or
              opts.get('all') or opts.get('interactive'))):
--- a/tests/test-directaccess.t	Wed Dec 27 00:14:00 2017 +0530
+++ b/tests/test-directaccess.t	Wed Dec 27 00:24:53 2017 +0530
@@ -152,6 +152,19 @@
   $ hg up 3
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
+`hg revert`
+
+  $ hg revert -r 28ad74 --all
+  reverting c
+
+  $ hg diff
+  diff -r 2443a0e66469 c
+  --- a/c	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/c	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,2 +1,1 @@
+   foo
+  -bar
+
 Commands with undefined cmdtype should not work right now
 
   $ hg phase -r 28ad74