directaccess: disable directaccess for push and serve
authorLaurent Charignon <lcharignon@fb.com>
Tue, 16 Jun 2015 10:19:17 -0700
changeset 1368 c02cdb97ebfa
parent 1367 0c134ca37567
child 1369 4ed67cce8c23
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.
hgext/directaccess.py
tests/test-inhibit.t
--- a/hgext/directaccess.py	Tue Jun 16 10:08:48 2015 -0700
+++ b/hgext/directaccess.py	Tue Jun 16 10:19:17 2015 -0700
@@ -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	Tue Jun 16 10:08:48 2015 -0700
+++ b/tests/test-inhibit.t	Tue Jun 16 10:19:17 2015 -0700
@@ -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