changeset 1464:c02cdb97ebfa

directaccess: disable directaccess for push and serve Before this patch, push and serve were subject to directaccess. This patch makes them throw error when trying to access hidden hashes.
author Laurent Charignon <lcharignon@fb.com>
date Tue, 16 Jun 2015 10:19:17 -0700
parents 0c134ca37567
children 4ed67cce8c23
files hgext/directaccess.py tests/test-inhibit.t
diffstat 2 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/directaccess.py
+++ b/hgext/directaccess.py
@@ -25,6 +25,8 @@
     ('nowarning', None, 'update'),
     ('nowarning', None, 'export'),
     ('nowarning',  'evolve', 'prune'),
+    ('error', None, 'push'),
+    ('error', None, 'serve'),
 ]
 
 def reposetup(ui, repo):
--- a/tests/test-inhibit.t
+++ b/tests/test-inhibit.t
@@ -721,5 +721,37 @@
   $ hg up 15
   abort: Cannot use inhibit without the direct access extension
   [255]
+  $ echo "directaccess=$(echo $(dirname $TESTDIR))/hgext/directaccess.py" >> $HGRCPATH
+  $ cd ..
 
 
+hg push should not allow directaccess unless forced with --hidden
+We copy the inhibhit repo to inhibit2 and make some changes to push to inhibit
+
+  $ cp -r inhibit inhibit2
+  $ pwd=$(pwd)
+  $ cd inhibit
+  $ mkcommit pk
+  $ hg id
+  003a4735afde tip
+  $ echo "OO" > pk
+  $ hg amend
+  $ hg id
+  71eb4f100663 tip
+
+Hidden commits cannot be pushed without --hidden
+  $ hg push -r 003a4735afde file://$pwd/inhibit2
+  pushing to file://$TESTTMP/inhibit2
+  abort: hidden revision '003a4735afde'!
+  (use --hidden to access hidden revisions)
+  [255]
+
+Visible commits can still be pushed
+  $ hg push -r 71eb4f100663 file://$pwd/inhibit2
+  pushing to file://$TESTTMP/inhibit2
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  2 new obsolescence markers