D1762: update: support updating to hidden cset if directaccess config is set

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Tue Dec 26 19:17:06 UTC 2017


pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch adds support for updating to a hidden changeset without using
  --hidden if `experimental.directacces=True` is set. The update command will
  print out a warning in such cases saying:
  
    `updating to a hidden changeset <hash>`

REPOSITORY
  rHG Mercurial

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

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

CHANGE DETAILS

diff --git a/tests/test-directaccess.t b/tests/test-directaccess.t
--- a/tests/test-directaccess.t
+++ b/tests/test-directaccess.t
@@ -143,6 +143,15 @@
   $ hg status --change 28ad74
   A c
 
+`hg update`
+
+  $ hg up 28ad74
+  updating to a hidden changeset 28ad74487de9
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg up 3
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
 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
@@ -5524,7 +5524,11 @@
 
         # if we defined a bookmark, we have to remember the original name
         brev = rev
-        rev = scmutil.revsingle(repo, rev, rev).rev()
+        repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
+        ctx = scmutil.revsingle(repo, rev, rev)
+        rev = ctx.rev()
+        if repo.filtername == 'visible-hidden':
+            ui.warn(_("updating to a hidden changeset %s\n") % ctx.hex()[:12])
 
         repo.ui.setconfig('ui', 'forcemerge', tool, 'update')
 



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


More information about the Mercurial-devel mailing list