comparison tests/test-bundle2-exchange.t @ 27633:37d7cf569cf3

wireproto: support disabling bundle1 only if repo is generaldelta I recently implemented the server.bundle1* options to control whether bundle1 exchange is allowed. After thinking about Mozilla's strategy for handling generaldelta rollout a bit more, I think server operators need an additional lever: disable bundle1 if and only if the repo is generaldelta. bundle1 exchange for non-generaldelta repos will not have the potential for CPU explosion that generaldelta repos do. Therefore, it makes sense for server operators to continue to allow bundle1 exchange for non-generaldelta repos without having to set a per-repo hgrc option to change the policy depending on whether the repo is generaldelta. This patch introduces a new set of options to control bundle1 behavior for generaldelta repos. These options enable server operators to limit bundle1 restrictions to the class of repos that can be performance issues. It also allows server operators to tie bundle1 access to store format. In many server environments (including Mozilla's), legacy repos will not be generaldelta and new repos will or might be. New repos often aren't bound by legacy access requirements, so setting a global policy that disallows access to new/generaldelta repos via bundle1 could be a reasonable policy in many server environments. This patch makes this policy very easy to implement (modify global hgrc, add options to existing generaldelta repos to grandfather them in).
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 20 Dec 2015 11:56:24 -0800
parents b288fb2724bf
children d6d3cf5fda6f
comparison
equal deleted inserted replaced
27632:9fea6b38a8da 27633:37d7cf569cf3
975 abort: remote error: 975 abort: remote error:
976 incompatible Mercurial client; bundle2 required 976 incompatible Mercurial client; bundle2 required
977 (see https://www.mercurial-scm.org/wiki/IncompatibleClient) 977 (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
978 [255] 978 [255]
979 $ killdaemons.py 979 $ killdaemons.py
980 $ cd ..
981
982 bundle1 can still pull non-generaldelta repos when generaldelta bundle1 disabled
983
984 $ hg --config format.usegeneraldelta=false init notgdserver
985 $ cd notgdserver
986 $ cat > .hg/hgrc << EOF
987 > [server]
988 > bundle1gd.pull = false
989 > EOF
990
991 $ touch foo
992 $ hg -q commit -A -m initial
993 $ hg serve -p $HGPORT -d --pid-file=hg.pid
994 $ cat hg.pid >> $DAEMON_PIDS
995
996 $ hg --config experimental.bundle2-exp=false clone http://localhost:$HGPORT/ not-bundle2-1
997 requesting all changes
998 adding changesets
999 adding manifests
1000 adding file changes
1001 added 1 changesets with 1 changes to 1 files
1002 updating to branch default
1003 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1004
1005 $ killdaemons.py
1006 $ cd ../bundle2onlyserver
1007
1008 bundle1 pull can be disabled for generaldelta repos only
1009
1010 $ cat > .hg/hgrc << EOF
1011 > [server]
1012 > bundle1gd.pull = false
1013 > EOF
1014
1015 $ hg serve -p $HGPORT -d --pid-file=hg.pid
1016 $ cat hg.pid >> $DAEMON_PIDS
1017 $ hg --config experimental.bundle2-exp=false clone http://localhost:$HGPORT/ not-bundle2
1018 requesting all changes
1019 abort: remote error:
1020 incompatible Mercurial client; bundle2 required
1021 (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
1022 [255]
1023
1024 $ killdaemons.py
980 1025
981 Verify the global server.bundle1 option works 1026 Verify the global server.bundle1 option works
982 1027
983 $ cat > .hg/hgrc << EOF 1028 $ cat > .hg/hgrc << EOF
984 > [server] 1029 > [server]
991 abort: remote error: 1036 abort: remote error:
992 incompatible Mercurial client; bundle2 required 1037 incompatible Mercurial client; bundle2 required
993 (see https://www.mercurial-scm.org/wiki/IncompatibleClient) 1038 (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
994 [255] 1039 [255]
995 $ killdaemons.py 1040 $ killdaemons.py
1041
1042 $ cat > .hg/hgrc << EOF
1043 > [server]
1044 > bundle1gd = false
1045 > EOF
1046 $ hg serve -p $HGPORT -d --pid-file=hg.pid
1047 $ cat hg.pid >> $DAEMON_PIDS
1048
1049 $ hg --config experimental.bundle2-exp=false clone http://localhost:$HGPORT/ not-bundle2
1050 requesting all changes
1051 abort: remote error:
1052 incompatible Mercurial client; bundle2 required
1053 (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
1054 [255]
1055
1056 $ killdaemons.py
1057
1058 $ cd ../notgdserver
1059 $ cat > .hg/hgrc << EOF
1060 > [server]
1061 > bundle1gd = false
1062 > EOF
1063 $ hg serve -p $HGPORT -d --pid-file=hg.pid
1064 $ cat hg.pid >> $DAEMON_PIDS
1065
1066 $ hg --config experimental.bundle2-exp=false clone http://localhost:$HGPORT/ not-bundle2-2
1067 requesting all changes
1068 adding changesets
1069 adding manifests
1070 adding file changes
1071 added 1 changesets with 1 changes to 1 files
1072 updating to branch default
1073 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1074
1075 $ killdaemons.py
1076 $ cd ../bundle2onlyserver
996 1077
997 Verify bundle1 pushes can be disabled 1078 Verify bundle1 pushes can be disabled
998 1079
999 $ cat > .hg/hgrc << EOF 1080 $ cat > .hg/hgrc << EOF
1000 > [server] 1081 > [server]