Patchwork D1762: update: support updating 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-psnycb47rlhab7w3trko-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/26448/
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 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




To: pulkit, #hg-reviewers
Cc: mercurial-devel
phabricator - Dec. 27, 2017, 12:29 p.m.
yuja requested changes to this revision.
yuja added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> commands.py:5530
> +        rev = ctx.rev()
> +        if repo.filtername == 'visible-hidden':
> +            ui.warn(_("updating to a hidden changeset %s\n") % ctx.hex()[:12])

`filtername == "visible-hidden"` doesn't mean `ctx` is obsolete.

Maybe we can check `ctx.hidden()`? It's probably okay to warn
hidden working parent no matter if directaccess is enabled or not.

REPOSITORY
  rHG Mercurial

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

To: pulkit, #hg-reviewers, yuja
Cc: yuja, 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
@@ -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')