[PATCH 2 of 2 evolve-ext-V2] directaccess: disable directaccess for push and serve

Laurent Charignon lcharignon at fb.com
Tue Jun 16 13:46:26 CDT 2015


# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1434475157 25200
#      Tue Jun 16 10:19:17 2015 -0700
# Node ID dbeaa8f760e0e1a3557fa7ca785f655107bd5df7
# Parent  0878226593514af85c74897b290af6f99902eb47
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.

diff --git a/hgext/directaccess.py b/hgext/directaccess.py
--- a/hgext/directaccess.py
+++ b/hgext/directaccess.py
@@ -25,6 +25,8 @@ directaccesslevel = [
     ('nowarning', None, 'update'),
     ('nowarning', None, 'export'),
     ('nowarning',  'evolve', 'prune'),
+    ('error', None, 'push'),
+    ('error', None, 'serve'),
 ]
 
 def reposetup(ui, repo):
diff --git a/tests/test-inhibit.t b/tests/test-inhibit.t
--- a/tests/test-inhibit.t
+++ b/tests/test-inhibit.t
@@ -721,5 +721,37 @@ Inhibit should not work without directac
   $ 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


More information about the Mercurial-devel mailing list