Patchwork D1763: revert: support reverting to hidden cset if directaccess config is set

login
register
mail settings
Submitter phabricator
Date Dec. 26, 2017, 7:17 p.m.
Message ID <differential-rev-PHID-DREV-gqduhgssnzjm65fj5t6d-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/26449/
State Superseded
Headers show

Comments

phabricator - Dec. 26, 2017, 7:17 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch adds support for reverting files to a hidden changeset if
  `experimental.directacess=True` is set.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1763

AFFECTED FILES
  mercurial/commands.py
  tests/test-directaccess.t

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-directaccess.t b/tests/test-directaccess.t
--- a/tests/test-directaccess.t
+++ b/tests/test-directaccess.t
@@ -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
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4584,7 +4584,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'))):