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

login
register
mail settings
Submitter phabricator
Date Jan. 4, 2018, 9:06 a.m.
Message ID <14839f44bcbd5b514dfdf86c3a6b0caf@localhost.localdomain>
Download mbox | patch
Permalink /patch/26538/
State Not Applicable
Headers show

Comments

phabricator - Jan. 4, 2018, 9:06 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG02fdb8c018aa: update: support updating to hidden cset if directaccess config is set (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1762?vs=4660&id=4685

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-directaccess.t
  tests/test-log.t
  tests/test-obsmarker-template.t
  tests/test-obsolete.t
  tests/test-rebase-obsolete.t
  tests/test-update-branches.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t
--- a/tests/test-update-branches.t
+++ b/tests/test-update-branches.t
@@ -520,6 +520,7 @@ 
 the bookmark with it
   $ hg up --quiet 0          # we should be able to update to 3 directly
   $ hg up --quiet --hidden 3 # but not implemented yet.
+  updating to a hidden changeset 6efa171f091b
   $ hg book -f bm
   $ hg up
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -530,6 +531,7 @@ 
 Test that 5 is detected as a valid destination from 1
   $ hg up --quiet 0          # we should be able to update to 3 directly
   $ hg up --quiet --hidden 3 # but not implemented yet.
+  updating to a hidden changeset 6efa171f091b
   $ hg up 5
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -280,6 +280,7 @@ 
 even though it is hidden (until we're moved there).
 
   $ hg --hidden up -qr 'first(hidden())'
+  updating to a hidden changeset 42ccdea3bb16
   $ hg rebase --rev 13 --dest 15
   rebasing 13:98f6af4ee953 "C"
   $ hg log -G
@@ -610,6 +611,7 @@ 
 Test hidden changesets in the rebase set (issue4504)
 
   $ hg up --hidden 9
+  updating to a hidden changeset 4bde274eefcf
   3 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ echo J > J
   $ hg add J
@@ -725,6 +727,7 @@ 
   $ hg commit --amend -m B1
   $ hg commit --amend -m B2
   $ hg up --hidden 'desc(B0)'
+  updating to a hidden changeset a8b11f55fb19
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ echo C > C
   $ hg add C
@@ -748,6 +751,7 @@ 
 Even when the chain include missing node
 
   $ hg up --hidden 'desc(B0)'
+  updating to a hidden changeset a8b11f55fb19
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ echo D > D
   $ hg add D
@@ -862,6 +866,7 @@ 
   $ hg add bar
   $ hg commit --amend -m "10'"
   $ hg up 10 --hidden
+  updating to a hidden changeset 121d9e3bc4c6
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ echo "bar" > foo
   $ hg add foo
@@ -1595,6 +1600,7 @@ 
   $ rm .hg/localtags
 
   $ hg update -q $C --hidden
+  updating to a hidden changeset 7829726be4dc
   $ hg rebase -s $B -d $D
   rebasing 1:2ec65233581b "B"
   merging D
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -62,6 +62,7 @@ 
   $ hg tip
   -1:000000000000 (public) [tip ] 
   $ hg up --hidden tip --quiet
+  updating to a hidden changeset 97b7c2d76b18
 
 Killing a single changeset with itself should fail
 (simple local safeguard)
diff --git a/tests/test-obsmarker-template.t b/tests/test-obsmarker-template.t
--- a/tests/test-obsmarker-template.t
+++ b/tests/test-obsmarker-template.t
@@ -75,6 +75,7 @@ 
 Check templates
 ---------------
   $ hg up 'desc(A0)' --hidden
+  updating to a hidden changeset 471f378eab4c
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 Predecessors template should show current revision as it is the working copy
@@ -146,6 +147,7 @@ 
      summary:     ROOT
   
   $ hg up 'desc(A1)' --hidden
+  updating to a hidden changeset a468dc9b3633
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 Predecessors template should show current revision as it is the working copy
@@ -413,6 +415,7 @@ 
 ---------------
 
   $ hg up 'obsolete()' --hidden
+  updating to a hidden changeset 471597cad322
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 Predecessors template should show current revision as it is the working copy
@@ -620,6 +623,7 @@ 
 ---------------
 
   $ hg up 'desc(A0)' --hidden
+  updating to a hidden changeset 471f378eab4c
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
 
 Predecessors template should show current revision as it is the working copy
@@ -644,6 +648,7 @@ 
   o  ea207398892e
   
   $ hg up 'desc(B0)' --hidden
+  updating to a hidden changeset 0dec01379d3b
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 Predecessors template should show both predecessors as they should be both
@@ -809,6 +814,7 @@ 
      summary:     ROOT
   
   $ hg update --hidden 'desc(A0)'
+  updating to a hidden changeset 471f378eab4c
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg commit --amend -m "A2"
   $ hg log --hidden -G
@@ -880,6 +886,7 @@ 
 ---------------
 
   $ hg up 'desc(A0)' --hidden
+  updating to a hidden changeset 471f378eab4c
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 Predecessors template should show current revision as it is the working copy
@@ -1144,6 +1151,7 @@ 
 ---------------
 
   $ hg up 'desc(A0)' --hidden
+  updating to a hidden changeset 471f378eab4c
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
 
 Predecessors template should show current revision as it is the working copy
@@ -1168,6 +1176,7 @@ 
   o  ea207398892e
   
   $ hg up 'desc(B0)' --hidden
+  updating to a hidden changeset 0dec01379d3b
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 Predecessors template should both predecessors as they are visible
@@ -1198,6 +1207,7 @@ 
   o  ea207398892e
   
   $ hg up 'desc(B1)' --hidden
+  updating to a hidden changeset b7ea6d14e664
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 Predecessors template should both predecessors as they are visible
@@ -1599,6 +1609,7 @@ 
   
 
   $ hg up -r "desc(B0)" --hidden
+  updating to a hidden changeset 0dec01379d3b
   2 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg tlog
   o  f897c6137566
@@ -2059,6 +2070,7 @@ 
   o  ea207398892e
   
   $ hg up --hidden 4
+  updating to a hidden changeset 9bd10a0775e4
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg rebase -r 7 -d 8 --config extensions.rebase=
   rebasing 7:ba2ed02b0c9a "Add A,B,C"
@@ -2303,6 +2315,7 @@ 
   obsoleted 1 changesets
 
   $ hg up -r "desc(A0)" --hidden
+  updating to a hidden changeset 471f378eab4c
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg commit --amend -m "A2"
   $ hg debugobsolete --record-parent `getid "."`
@@ -2312,6 +2325,7 @@ 
 ------------
 
   $ hg up "desc(A0)" --hidden
+  updating to a hidden changeset 471f378eab4c
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg tlog
   @  471f378eab4c
@@ -2465,6 +2479,7 @@ 
 ---------------
 
   $ hg up 'desc("A0")' --hidden
+  updating to a hidden changeset 471597cad322
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 # todo: the obsfate output is not ideal
@@ -2476,6 +2491,7 @@ 
   o  ea207398892e
   
   $ hg up -r 'desc("A2")' --hidden
+  updating to a hidden changeset 0d0ef4bdf70e
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
   $ hg fatelog --hidden
diff --git a/tests/test-log.t b/tests/test-log.t
--- a/tests/test-log.t
+++ b/tests/test-log.t
@@ -1824,6 +1824,7 @@ 
 test that parent prevent a changeset to be hidden
 
   $ hg up 1 -q --hidden
+  updating to a hidden changeset a765632148dc
   $ hg log --template='{rev}:{node}\n'
   1:a765632148dc55d38c35c4f247c618701886cb2f
   0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
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
@@ -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')