diff mercurial/commands.py @ 35518:02fdb8c018aa

update: support updating to hidden cset if directaccess config is set 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 when updating to a hidden changeset saying: `updating to a hidden changeset <hash>` The warning is also printed when directaccess is not used and --hidden is passed which I think is good behaviour. Tests are added for the directaccess part and updated output of tests which have case of updating to hidden cset using `--hidden`. Differential Revision: https://phab.mercurial-scm.org/D1762
author Pulkit Goyal <7895pulkit@gmail.com>
date Wed, 27 Dec 2017 00:14:00 +0530
parents ba0fb0e33c3a
children 31fe397f2bda
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Dec 26 22:54:45 2017 +0530
+++ b/mercurial/commands.py	Wed Dec 27 00:14:00 2017 +0530
@@ -5528,7 +5528,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 ctx.hidden():
+            ui.warn(_("updating to a hidden changeset %s\n") % ctx.hex()[:12])
 
         repo.ui.setconfig('ui', 'forcemerge', tool, 'update')