2018-01-23 23:09:16 +03:00
|
|
|
$ . helpers-usechg.sh
|
|
|
|
|
2015-05-27 22:54:51 +03:00
|
|
|
#require killdaemons
|
|
|
|
|
|
|
|
This test checks behavior related to bundle1 that changed or is likely
|
|
|
|
to change with bundle2. Feel free to factor out any part of the test
|
|
|
|
which does not need to exist to keep bundle1 working.
|
|
|
|
|
|
|
|
$ cat << EOF >> $HGRCPATH
|
2016-08-03 16:34:03 +03:00
|
|
|
> [devel]
|
2015-05-27 22:54:51 +03:00
|
|
|
> # This test is dedicated to interaction through old bundle
|
2016-08-03 16:34:03 +03:00
|
|
|
> legacy.exchange = bundle1
|
2015-05-27 22:54:51 +03:00
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ hg init test
|
|
|
|
$ cd test
|
|
|
|
$ echo a > a
|
|
|
|
$ hg ci -Ama
|
|
|
|
adding a
|
|
|
|
$ cd ..
|
|
|
|
$ hg clone test test2
|
|
|
|
updating to branch default
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ cd test2
|
|
|
|
$ echo a >> a
|
|
|
|
$ hg ci -mb
|
|
|
|
$ req() {
|
2018-02-08 22:19:42 +03:00
|
|
|
> hg serve -p 0 --port-file .p -d --pid-file=hg.pid -E errors.log
|
|
|
|
> HGPORT=`cat .p`
|
|
|
|
> rm .p
|
2015-05-27 22:54:51 +03:00
|
|
|
> cat hg.pid >> $DAEMON_PIDS
|
|
|
|
> hg --cwd ../test2 push http://localhost:$HGPORT/
|
|
|
|
> exitstatus=$?
|
2015-06-08 22:55:40 +03:00
|
|
|
> killdaemons.py
|
2015-05-27 22:54:51 +03:00
|
|
|
> echo % serve errors
|
|
|
|
> cat errors.log
|
|
|
|
> return $exitstatus
|
|
|
|
> }
|
|
|
|
$ cd ../test
|
|
|
|
|
|
|
|
expect ssl error
|
|
|
|
|
|
|
|
$ req
|
2018-02-08 02:18:29 +03:00
|
|
|
pushing to http://localhost:$HGPORT/ (glob)
|
2015-05-27 22:54:51 +03:00
|
|
|
searching for changes
|
2018-04-12 02:04:30 +03:00
|
|
|
devel-warn: using deprecated bundlev1 format
|
|
|
|
at: */changegroup.py:* (makechangegroup) (glob)
|
2015-05-27 22:54:51 +03:00
|
|
|
abort: HTTP Error 403: ssl required
|
|
|
|
% serve errors
|
|
|
|
[255]
|
|
|
|
|
|
|
|
expect authorization error
|
|
|
|
|
|
|
|
$ echo '[web]' > .hg/hgrc
|
|
|
|
$ echo 'push_ssl = false' >> .hg/hgrc
|
|
|
|
$ req
|
2018-02-08 02:18:29 +03:00
|
|
|
pushing to http://localhost:$HGPORT/ (glob)
|
2015-05-27 22:54:51 +03:00
|
|
|
searching for changes
|
2018-04-12 02:04:30 +03:00
|
|
|
devel-warn: using deprecated bundlev1 format
|
|
|
|
at: */changegroup.py:* (makechangegroup) (glob)
|
2015-05-27 22:54:51 +03:00
|
|
|
abort: authorization failed
|
|
|
|
% serve errors
|
|
|
|
[255]
|
|
|
|
|
|
|
|
expect authorization error: must have authorized user
|
|
|
|
|
|
|
|
$ echo 'allow_push = unperson' >> .hg/hgrc
|
|
|
|
$ req
|
2018-02-08 02:18:29 +03:00
|
|
|
pushing to http://localhost:$HGPORT/ (glob)
|
2015-05-27 22:54:51 +03:00
|
|
|
searching for changes
|
2018-04-12 02:04:30 +03:00
|
|
|
devel-warn: using deprecated bundlev1 format
|
|
|
|
at: */changegroup.py:* (makechangegroup) (glob)
|
2015-05-27 22:54:51 +03:00
|
|
|
abort: authorization failed
|
|
|
|
% serve errors
|
|
|
|
[255]
|
|
|
|
|
|
|
|
expect success
|
|
|
|
|
tests: invoke printenv.py via sh -c for test portability
On Windows platform, invoking printenv.py directly via hook is
problematic, because:
- unless binding between *.py suffix and python runtime, application
selector dialog is displayed, and running test is blocked at each
printenv.py invocations
- it isn't safe to assume binding between *.py suffix and python
runtime, because application binding is easily broken
For example, installing IDE (VisualStudio with Python Tools, or
so) often requires binding between source files and IDE itself.
This patch invokes printenv.py via sh -c for test portability. This is
a kind of follow up for 9e4331825bea, which eliminated explicit
"python" for printenv.py. There are already other 'sh -c "printenv.py"'
in *.t files, and this fix should be reasonable.
This changes were confirmed in cases below:
- without any application binding for *.py suffix
- with binding between *.py suffix and VisualStudio
This patch also replaces "echo + redirection" style with "heredoc"
style, because:
- hook command line is parsed by cmd.exe as shell at first, and
- single quotation can't quote arguments on cmd.exe, therefore,
- "printenv.py foobar" should be quoted by double quotation, but
- nested quoting (or tricky escaping) isn't readable
2016-10-28 20:44:45 +03:00
|
|
|
$ cat >> .hg/hgrc <<EOF
|
|
|
|
> allow_push = *
|
|
|
|
> [hooks]
|
|
|
|
> changegroup = sh -c "printenv.py changegroup 0"
|
|
|
|
> pushkey = sh -c "printenv.py pushkey 0"
|
|
|
|
> EOF
|
2015-05-27 22:54:51 +03:00
|
|
|
$ req
|
2018-02-08 02:18:29 +03:00
|
|
|
pushing to http://localhost:$HGPORT/ (glob)
|
2015-05-27 22:54:51 +03:00
|
|
|
searching for changes
|
2018-04-12 02:04:30 +03:00
|
|
|
devel-warn: using deprecated bundlev1 format
|
|
|
|
at: */changegroup.py:* (makechangegroup) (glob)
|
2015-05-27 22:54:51 +03:00
|
|
|
remote: adding changesets
|
|
|
|
remote: adding manifests
|
|
|
|
remote: adding file changes
|
|
|
|
remote: added 1 changesets with 1 changes to 1 files
|
2017-04-04 01:56:29 +03:00
|
|
|
remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
|
2015-05-27 22:54:51 +03:00
|
|
|
% serve errors
|
|
|
|
$ hg rollback
|
|
|
|
repository tip rolled back to revision 0 (undo serve)
|
|
|
|
|
|
|
|
expect success, server lacks the httpheader capability
|
|
|
|
|
|
|
|
$ CAP=httpheader
|
|
|
|
$ . "$TESTDIR/notcapable"
|
|
|
|
$ req
|
2018-02-08 02:18:29 +03:00
|
|
|
pushing to http://localhost:$HGPORT/ (glob)
|
2015-05-27 22:54:51 +03:00
|
|
|
searching for changes
|
2018-04-12 02:04:30 +03:00
|
|
|
devel-warn: using deprecated bundlev1 format
|
|
|
|
at: */changegroup.py:* (makechangegroup) (glob)
|
2015-05-27 22:54:51 +03:00
|
|
|
remote: adding changesets
|
|
|
|
remote: adding manifests
|
|
|
|
remote: adding file changes
|
|
|
|
remote: added 1 changesets with 1 changes to 1 files
|
2017-04-04 01:56:29 +03:00
|
|
|
remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
|
2015-05-27 22:54:51 +03:00
|
|
|
% serve errors
|
|
|
|
$ hg rollback
|
|
|
|
repository tip rolled back to revision 0 (undo serve)
|
|
|
|
|
|
|
|
expect success, server lacks the unbundlehash capability
|
|
|
|
|
|
|
|
$ CAP=unbundlehash
|
|
|
|
$ . "$TESTDIR/notcapable"
|
|
|
|
$ req
|
2018-02-08 02:18:29 +03:00
|
|
|
pushing to http://localhost:$HGPORT/ (glob)
|
2015-05-27 22:54:51 +03:00
|
|
|
searching for changes
|
2018-04-12 02:04:30 +03:00
|
|
|
devel-warn: using deprecated bundlev1 format
|
|
|
|
at: */changegroup.py:* (makechangegroup) (glob)
|
2015-05-27 22:54:51 +03:00
|
|
|
remote: adding changesets
|
|
|
|
remote: adding manifests
|
|
|
|
remote: adding file changes
|
|
|
|
remote: added 1 changesets with 1 changes to 1 files
|
2017-04-04 01:56:29 +03:00
|
|
|
remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
|
2015-05-27 22:54:51 +03:00
|
|
|
% serve errors
|
|
|
|
$ hg rollback
|
|
|
|
repository tip rolled back to revision 0 (undo serve)
|
|
|
|
|
2015-09-18 15:32:43 +03:00
|
|
|
expect success, pre-d1b16a746db6 server supports the unbundle capability, but
|
|
|
|
has no parameter
|
|
|
|
|
|
|
|
$ cat <<EOF > notcapable-unbundleparam.py
|
|
|
|
> from mercurial import extensions, httppeer
|
|
|
|
> def capable(orig, self, name):
|
|
|
|
> if name == 'unbundle':
|
|
|
|
> return True
|
|
|
|
> return orig(self, name)
|
|
|
|
> def uisetup(ui):
|
|
|
|
> extensions.wrapfunction(httppeer.httppeer, 'capable', capable)
|
|
|
|
> EOF
|
|
|
|
$ cp $HGRCPATH $HGRCPATH.orig
|
|
|
|
$ cat <<EOF >> $HGRCPATH
|
|
|
|
> [extensions]
|
|
|
|
> notcapable-unbundleparam = `pwd`/notcapable-unbundleparam.py
|
|
|
|
> EOF
|
|
|
|
$ req
|
2018-02-08 02:18:29 +03:00
|
|
|
pushing to http://localhost:$HGPORT/ (glob)
|
2015-09-18 15:32:43 +03:00
|
|
|
searching for changes
|
2018-04-12 02:04:30 +03:00
|
|
|
devel-warn: using deprecated bundlev1 format
|
|
|
|
at: */changegroup.py:* (makechangegroup) (glob)
|
2015-09-18 15:32:43 +03:00
|
|
|
remote: adding changesets
|
|
|
|
remote: adding manifests
|
|
|
|
remote: adding file changes
|
|
|
|
remote: added 1 changesets with 1 changes to 1 files
|
|
|
|
remote: changegroup hook: * (glob)
|
|
|
|
% serve errors
|
|
|
|
$ hg rollback
|
|
|
|
repository tip rolled back to revision 0 (undo serve)
|
|
|
|
$ mv $HGRCPATH.orig $HGRCPATH
|
|
|
|
|
2015-05-27 22:54:51 +03:00
|
|
|
expect push success, phase change failure
|
|
|
|
|
|
|
|
$ cat > .hg/hgrc <<EOF
|
|
|
|
> [web]
|
|
|
|
> push_ssl = false
|
|
|
|
> allow_push = *
|
|
|
|
> [hooks]
|
tests: invoke printenv.py via sh -c for test portability
On Windows platform, invoking printenv.py directly via hook is
problematic, because:
- unless binding between *.py suffix and python runtime, application
selector dialog is displayed, and running test is blocked at each
printenv.py invocations
- it isn't safe to assume binding between *.py suffix and python
runtime, because application binding is easily broken
For example, installing IDE (VisualStudio with Python Tools, or
so) often requires binding between source files and IDE itself.
This patch invokes printenv.py via sh -c for test portability. This is
a kind of follow up for 9e4331825bea, which eliminated explicit
"python" for printenv.py. There are already other 'sh -c "printenv.py"'
in *.t files, and this fix should be reasonable.
This changes were confirmed in cases below:
- without any application binding for *.py suffix
- with binding between *.py suffix and VisualStudio
This patch also replaces "echo + redirection" style with "heredoc"
style, because:
- hook command line is parsed by cmd.exe as shell at first, and
- single quotation can't quote arguments on cmd.exe, therefore,
- "printenv.py foobar" should be quoted by double quotation, but
- nested quoting (or tricky escaping) isn't readable
2016-10-28 20:44:45 +03:00
|
|
|
> prepushkey = sh -c "printenv.py prepushkey 1"
|
2015-05-27 22:54:51 +03:00
|
|
|
> EOF
|
|
|
|
$ req
|
2018-02-08 02:18:29 +03:00
|
|
|
pushing to http://localhost:$HGPORT/ (glob)
|
2015-05-27 22:54:51 +03:00
|
|
|
searching for changes
|
2018-04-12 02:04:30 +03:00
|
|
|
devel-warn: using deprecated bundlev1 format
|
|
|
|
at: */changegroup.py:* (makechangegroup) (glob)
|
2015-05-27 22:54:51 +03:00
|
|
|
remote: adding changesets
|
|
|
|
remote: adding manifests
|
|
|
|
remote: adding file changes
|
|
|
|
remote: added 1 changesets with 1 changes to 1 files
|
|
|
|
% serve errors
|
|
|
|
|
|
|
|
expect phase change success
|
|
|
|
|
tests: invoke printenv.py via sh -c for test portability
On Windows platform, invoking printenv.py directly via hook is
problematic, because:
- unless binding between *.py suffix and python runtime, application
selector dialog is displayed, and running test is blocked at each
printenv.py invocations
- it isn't safe to assume binding between *.py suffix and python
runtime, because application binding is easily broken
For example, installing IDE (VisualStudio with Python Tools, or
so) often requires binding between source files and IDE itself.
This patch invokes printenv.py via sh -c for test portability. This is
a kind of follow up for 9e4331825bea, which eliminated explicit
"python" for printenv.py. There are already other 'sh -c "printenv.py"'
in *.t files, and this fix should be reasonable.
This changes were confirmed in cases below:
- without any application binding for *.py suffix
- with binding between *.py suffix and VisualStudio
This patch also replaces "echo + redirection" style with "heredoc"
style, because:
- hook command line is parsed by cmd.exe as shell at first, and
- single quotation can't quote arguments on cmd.exe, therefore,
- "printenv.py foobar" should be quoted by double quotation, but
- nested quoting (or tricky escaping) isn't readable
2016-10-28 20:44:45 +03:00
|
|
|
$ cat >> .hg/hgrc <<EOF
|
|
|
|
> prepushkey = sh -c "printenv.py prepushkey 0"
|
|
|
|
> EOF
|
2015-05-27 22:54:51 +03:00
|
|
|
$ req
|
2018-02-08 02:18:29 +03:00
|
|
|
pushing to http://localhost:$HGPORT/ (glob)
|
2015-05-27 22:54:51 +03:00
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
% serve errors
|
|
|
|
[1]
|
|
|
|
$ hg rollback
|
|
|
|
repository tip rolled back to revision 0 (undo serve)
|
|
|
|
|
|
|
|
expect authorization error: all users denied
|
|
|
|
|
|
|
|
$ echo '[web]' > .hg/hgrc
|
|
|
|
$ echo 'push_ssl = false' >> .hg/hgrc
|
|
|
|
$ echo 'deny_push = *' >> .hg/hgrc
|
|
|
|
$ req
|
2018-02-08 02:18:29 +03:00
|
|
|
pushing to http://localhost:$HGPORT/ (glob)
|
2015-05-27 22:54:51 +03:00
|
|
|
searching for changes
|
2018-04-12 02:04:30 +03:00
|
|
|
devel-warn: using deprecated bundlev1 format
|
|
|
|
at: */changegroup.py:* (makechangegroup) (glob)
|
2015-05-27 22:54:51 +03:00
|
|
|
abort: authorization failed
|
|
|
|
% serve errors
|
|
|
|
[255]
|
|
|
|
|
|
|
|
expect authorization error: some users denied, users must be authenticated
|
|
|
|
|
|
|
|
$ echo 'deny_push = unperson' >> .hg/hgrc
|
|
|
|
$ req
|
2018-02-08 02:18:29 +03:00
|
|
|
pushing to http://localhost:$HGPORT/ (glob)
|
2015-05-27 22:54:51 +03:00
|
|
|
searching for changes
|
2018-04-12 02:04:30 +03:00
|
|
|
devel-warn: using deprecated bundlev1 format
|
|
|
|
at: */changegroup.py:* (makechangegroup) (glob)
|
2015-05-27 22:54:51 +03:00
|
|
|
abort: authorization failed
|
|
|
|
% serve errors
|
|
|
|
[255]
|
|
|
|
|
|
|
|
$ cd ..
|