2017-03-10 09:40:52 +03:00
|
|
|
#require killdaemons serve
|
2010-09-26 22:41:32 +04:00
|
|
|
|
|
|
|
$ hg init test
|
|
|
|
$ cd test
|
|
|
|
$ echo foo>foo
|
|
|
|
$ mkdir foo.d foo.d/bAr.hg.d foo.d/baR.d.hg
|
|
|
|
$ echo foo>foo.d/foo
|
|
|
|
$ echo bar>foo.d/bAr.hg.d/BaR
|
|
|
|
$ echo bar>foo.d/baR.d.hg/bAR
|
|
|
|
$ hg commit -A -m 1
|
|
|
|
adding foo
|
|
|
|
adding foo.d/bAr.hg.d/BaR
|
|
|
|
adding foo.d/baR.d.hg/bAR
|
|
|
|
adding foo.d/foo
|
2011-02-21 02:57:19 +03:00
|
|
|
$ hg serve -p $HGPORT -d --pid-file=../hg1.pid -E ../error.log
|
2016-03-15 12:51:54 +03:00
|
|
|
$ hg serve --config server.uncompressed=False -p $HGPORT1 -d --pid-file=../hg2.pid
|
2010-09-26 22:41:32 +04:00
|
|
|
|
|
|
|
Test server address cannot be reused
|
|
|
|
|
2012-06-19 21:45:00 +04:00
|
|
|
#if windows
|
|
|
|
$ hg serve -p $HGPORT1 2>&1
|
2017-04-02 01:30:51 +03:00
|
|
|
abort: cannot start server at 'localhost:$HGPORT1': * (glob)
|
2012-06-19 21:45:00 +04:00
|
|
|
[255]
|
|
|
|
#else
|
2010-09-26 22:41:32 +04:00
|
|
|
$ hg serve -p $HGPORT1 2>&1
|
2017-02-16 11:13:29 +03:00
|
|
|
abort: cannot start server at 'localhost:$HGPORT1': Address already in use
|
2010-09-26 22:41:32 +04:00
|
|
|
[255]
|
2012-06-19 21:45:00 +04:00
|
|
|
#endif
|
2010-09-26 22:41:32 +04:00
|
|
|
$ cd ..
|
|
|
|
$ cat hg1.pid hg2.pid >> $DAEMON_PIDS
|
|
|
|
|
|
|
|
clone via stream
|
|
|
|
|
|
|
|
$ hg clone --uncompressed http://localhost:$HGPORT/ copy 2>&1
|
|
|
|
streaming all changes
|
|
|
|
6 files to transfer, 606 bytes of data
|
2011-04-29 13:04:39 +04:00
|
|
|
transferred * bytes in * seconds (*/sec) (glob)
|
2014-10-31 22:56:25 +03:00
|
|
|
searching for changes
|
|
|
|
no changes found
|
2010-09-26 22:41:32 +04:00
|
|
|
updating to branch default
|
|
|
|
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg verify -R copy
|
|
|
|
checking changesets
|
|
|
|
checking manifests
|
|
|
|
crosschecking files in changesets and manifests
|
|
|
|
checking files
|
|
|
|
4 files, 1 changesets, 4 total revisions
|
|
|
|
|
|
|
|
try to clone via stream, should use pull instead
|
|
|
|
|
|
|
|
$ hg clone --uncompressed http://localhost:$HGPORT1/ copy2
|
|
|
|
requesting all changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 4 changes to 4 files
|
|
|
|
updating to branch default
|
|
|
|
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
|
|
|
|
clone via pull
|
|
|
|
|
|
|
|
$ hg clone http://localhost:$HGPORT1/ copy-pull
|
|
|
|
requesting all changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 4 changes to 4 files
|
|
|
|
updating to branch default
|
|
|
|
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg verify -R copy-pull
|
|
|
|
checking changesets
|
|
|
|
checking manifests
|
|
|
|
crosschecking files in changesets and manifests
|
|
|
|
checking files
|
|
|
|
4 files, 1 changesets, 4 total revisions
|
|
|
|
$ cd test
|
|
|
|
$ echo bar > bar
|
|
|
|
$ hg commit -A -d '1 0' -m 2
|
|
|
|
adding bar
|
|
|
|
$ cd ..
|
|
|
|
|
2012-08-08 19:04:02 +04:00
|
|
|
clone over http with --update
|
|
|
|
|
|
|
|
$ hg clone http://localhost:$HGPORT1/ updated --update 0
|
|
|
|
requesting all changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 2 changesets with 5 changes to 5 files
|
|
|
|
updating to branch default
|
|
|
|
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg log -r . -R updated
|
|
|
|
changeset: 0:8b6053c928fe
|
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
summary: 1
|
|
|
|
|
|
|
|
$ rm -rf updated
|
|
|
|
|
2011-05-02 14:36:23 +04:00
|
|
|
incoming via HTTP
|
|
|
|
|
|
|
|
$ hg clone http://localhost:$HGPORT1/ --rev 0 partial
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 4 changes to 4 files
|
|
|
|
updating to branch default
|
|
|
|
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ cd partial
|
|
|
|
$ touch LOCAL
|
|
|
|
$ hg ci -qAm LOCAL
|
|
|
|
$ hg incoming http://localhost:$HGPORT1/ --template '{desc}\n'
|
|
|
|
comparing with http://localhost:$HGPORT1/
|
|
|
|
searching for changes
|
|
|
|
2
|
|
|
|
$ cd ..
|
|
|
|
|
2010-09-26 22:41:32 +04:00
|
|
|
pull
|
|
|
|
|
|
|
|
$ cd copy-pull
|
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
|
|
|
|
> [hooks]
|
|
|
|
> changegroup = sh -c "printenv.py changegroup"
|
|
|
|
> EOF
|
2010-09-26 22:41:32 +04:00
|
|
|
$ hg pull
|
2010-10-09 07:36:11 +04:00
|
|
|
pulling from http://localhost:$HGPORT1/
|
2010-09-26 22:41:32 +04:00
|
|
|
searching for changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files
|
2017-03-31 12:53:56 +03:00
|
|
|
changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=http://localhost:$HGPORT1/
|
2010-09-26 22:41:32 +04:00
|
|
|
(run 'hg update' to get a working copy)
|
|
|
|
$ cd ..
|
2011-02-21 02:57:19 +03:00
|
|
|
|
|
|
|
clone from invalid URL
|
|
|
|
|
|
|
|
$ hg clone http://localhost:$HGPORT/bad
|
|
|
|
abort: HTTP Error 404: Not Found
|
|
|
|
[255]
|
|
|
|
|
2011-08-05 02:39:54 +04:00
|
|
|
test http authentication
|
2012-04-04 02:00:47 +04:00
|
|
|
+ use the same server to test server side streaming preference
|
2011-08-05 02:39:54 +04:00
|
|
|
|
|
|
|
$ cd test
|
|
|
|
$ cat << EOT > userpass.py
|
|
|
|
> import base64
|
|
|
|
> from mercurial.hgweb import common
|
|
|
|
> def perform_authentication(hgweb, req, op):
|
|
|
|
> auth = req.env.get('HTTP_AUTHORIZATION')
|
|
|
|
> if not auth:
|
|
|
|
> raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, 'who',
|
|
|
|
> [('WWW-Authenticate', 'Basic Realm="mercurial"')])
|
2012-08-08 19:04:02 +04:00
|
|
|
> if base64.b64decode(auth.split()[1]).split(':', 1) != ['user', 'pass']:
|
2011-08-05 02:39:54 +04:00
|
|
|
> raise common.ErrorResponse(common.HTTP_FORBIDDEN, 'no')
|
|
|
|
> def extsetup():
|
|
|
|
> common.permhooks.insert(0, perform_authentication)
|
|
|
|
> EOT
|
2016-03-15 12:51:54 +03:00
|
|
|
$ hg serve --config extensions.x=userpass.py -p $HGPORT2 -d --pid-file=pid \
|
2014-02-05 04:41:36 +04:00
|
|
|
> --config server.preferuncompressed=True \
|
|
|
|
> --config web.push_ssl=False --config web.allow_push=* -A ../access.log
|
2011-08-05 02:39:54 +04:00
|
|
|
$ cat pid >> $DAEMON_PIDS
|
|
|
|
|
2014-01-16 04:46:20 +04:00
|
|
|
$ cat << EOF > get_pass.py
|
|
|
|
> import getpass
|
|
|
|
> def newgetpass(arg):
|
|
|
|
> return "pass"
|
|
|
|
> getpass.getpass = newgetpass
|
|
|
|
> EOF
|
|
|
|
|
2012-08-08 19:04:02 +04:00
|
|
|
$ hg id http://localhost:$HGPORT2/
|
2014-01-16 04:46:20 +04:00
|
|
|
abort: http authorization required for http://localhost:$HGPORT2/
|
2011-08-05 02:39:54 +04:00
|
|
|
[255]
|
2014-01-16 04:46:20 +04:00
|
|
|
$ hg id http://localhost:$HGPORT2/
|
|
|
|
abort: http authorization required for http://localhost:$HGPORT2/
|
2011-08-05 02:39:54 +04:00
|
|
|
[255]
|
2014-01-16 04:46:20 +04:00
|
|
|
$ hg id --config ui.interactive=true --config extensions.getpass=get_pass.py http://user@localhost:$HGPORT2/
|
|
|
|
http authorization required for http://localhost:$HGPORT2/
|
|
|
|
realm: mercurial
|
|
|
|
user: user
|
|
|
|
password: 5fed3813f7f5
|
2011-08-05 02:39:54 +04:00
|
|
|
$ hg id http://user:pass@localhost:$HGPORT2/
|
|
|
|
5fed3813f7f5
|
2012-08-08 19:04:02 +04:00
|
|
|
$ echo '[auth]' >> .hg/hgrc
|
2011-08-05 02:39:54 +04:00
|
|
|
$ echo 'l.schemes=http' >> .hg/hgrc
|
|
|
|
$ echo 'l.prefix=lo' >> .hg/hgrc
|
|
|
|
$ echo 'l.username=user' >> .hg/hgrc
|
|
|
|
$ echo 'l.password=pass' >> .hg/hgrc
|
2012-08-08 19:04:02 +04:00
|
|
|
$ hg id http://localhost:$HGPORT2/
|
2011-08-05 02:39:54 +04:00
|
|
|
5fed3813f7f5
|
2012-08-08 19:04:02 +04:00
|
|
|
$ hg id http://localhost:$HGPORT2/
|
2011-08-05 02:39:54 +04:00
|
|
|
5fed3813f7f5
|
2012-08-08 19:04:02 +04:00
|
|
|
$ hg id http://user@localhost:$HGPORT2/
|
2011-08-05 02:39:54 +04:00
|
|
|
5fed3813f7f5
|
2012-04-04 02:00:47 +04:00
|
|
|
$ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1
|
|
|
|
streaming all changes
|
|
|
|
7 files to transfer, 916 bytes of data
|
|
|
|
transferred * bytes in * seconds (*/sec) (glob)
|
2014-10-31 22:56:25 +03:00
|
|
|
searching for changes
|
|
|
|
no changes found
|
2012-04-04 02:00:47 +04:00
|
|
|
updating to branch default
|
|
|
|
5 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2014-12-13 01:06:36 +03:00
|
|
|
--pull should override server's preferuncompressed
|
|
|
|
$ hg clone --pull http://user:pass@localhost:$HGPORT2/ dest-pull 2>&1
|
|
|
|
requesting all changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 2 changesets with 5 changes to 5 files
|
|
|
|
updating to branch default
|
|
|
|
5 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2012-04-04 02:00:47 +04:00
|
|
|
|
2012-08-08 19:04:02 +04:00
|
|
|
$ hg id http://user2@localhost:$HGPORT2/
|
2014-01-16 04:46:20 +04:00
|
|
|
abort: http authorization required for http://localhost:$HGPORT2/
|
2011-08-05 02:39:54 +04:00
|
|
|
[255]
|
|
|
|
$ hg id http://user:pass2@localhost:$HGPORT2/
|
|
|
|
abort: HTTP Error 403: no
|
|
|
|
[255]
|
|
|
|
|
2014-02-05 04:41:36 +04:00
|
|
|
$ hg -R dest tag -r tip top
|
|
|
|
$ hg -R dest push http://user:pass@localhost:$HGPORT2/
|
|
|
|
pushing to http://user:***@localhost:$HGPORT2/
|
|
|
|
searching for changes
|
|
|
|
remote: adding changesets
|
|
|
|
remote: adding manifests
|
|
|
|
remote: adding file changes
|
|
|
|
remote: added 1 changesets with 1 changes to 1 files
|
|
|
|
$ hg rollback -q
|
|
|
|
|
2016-07-15 19:39:36 +03:00
|
|
|
$ sed 's/.*] "/"/' < ../access.log
|
2014-02-05 04:41:36 +04:00
|
|
|
"GET /?cmd=capabilities HTTP/1.1" 200 -
|
2016-12-25 01:22:18 +03:00
|
|
|
"GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
2014-02-05 04:41:36 +04:00
|
|
|
"GET /?cmd=capabilities HTTP/1.1" 200 -
|
2016-12-25 01:22:18 +03:00
|
|
|
"GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
2014-02-05 04:41:36 +04:00
|
|
|
"GET /?cmd=capabilities HTTP/1.1" 200 -
|
2016-12-25 01:22:18 +03:00
|
|
|
"GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
2014-02-05 04:41:36 +04:00
|
|
|
"GET /?cmd=capabilities HTTP/1.1" 200 -
|
2016-12-25 01:22:18 +03:00
|
|
|
"GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
2014-02-05 04:41:36 +04:00
|
|
|
"GET /?cmd=capabilities HTTP/1.1" 200 -
|
2016-12-25 01:22:18 +03:00
|
|
|
"GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
2014-02-05 04:41:36 +04:00
|
|
|
"GET /?cmd=capabilities HTTP/1.1" 200 -
|
2016-12-25 01:22:18 +03:00
|
|
|
"GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
2014-02-05 04:41:36 +04:00
|
|
|
"GET /?cmd=capabilities HTTP/1.1" 200 -
|
2016-12-25 01:22:18 +03:00
|
|
|
"GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
2014-02-05 04:41:36 +04:00
|
|
|
"GET /?cmd=capabilities HTTP/1.1" 200 -
|
2016-12-25 01:22:18 +03:00
|
|
|
"GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=stream_out HTTP/1.1" 401 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=stream_out HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D5fed3813f7f5e1824344fdc9cf8f63bb662c292d x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=0&common=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=phases%2Cbookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
2014-12-13 01:06:36 +03:00
|
|
|
"GET /?cmd=capabilities HTTP/1.1" 200 -
|
2016-12-25 01:22:18 +03:00
|
|
|
"GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=getbundle HTTP/1.1" 401 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=phases%2Cbookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=phases%2Cbookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
2014-02-05 04:41:36 +04:00
|
|
|
"GET /?cmd=capabilities HTTP/1.1" 200 -
|
2016-12-25 01:22:18 +03:00
|
|
|
"GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
2014-02-05 04:41:36 +04:00
|
|
|
"GET /?cmd=capabilities HTTP/1.1" 200 -
|
2016-12-25 01:22:18 +03:00
|
|
|
"GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 403 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
2014-02-05 04:41:36 +04:00
|
|
|
"GET /?cmd=capabilities HTTP/1.1" 200 -
|
2016-12-25 01:22:18 +03:00
|
|
|
"GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D7f4e523d01f2cc3765ac8934da3d14db775ff872 x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
2016-04-21 07:30:18 +03:00
|
|
|
"POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=666f726365* (glob)
|
2016-12-25 01:22:18 +03:00
|
|
|
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
|
2014-02-05 04:41:36 +04:00
|
|
|
|
2011-08-05 02:39:54 +04:00
|
|
|
$ cd ..
|
|
|
|
|
2011-08-26 18:23:35 +04:00
|
|
|
clone of serve with repo in root and unserved subrepo (issue2970)
|
|
|
|
|
|
|
|
$ hg --cwd test init sub
|
2012-06-06 04:00:13 +04:00
|
|
|
$ echo empty > test/sub/empty
|
|
|
|
$ hg --cwd test/sub add empty
|
|
|
|
$ hg --cwd test/sub commit -qm 'add empty'
|
|
|
|
$ hg --cwd test/sub tag -r 0 something
|
2011-08-26 18:23:35 +04:00
|
|
|
$ echo sub = sub > test/.hgsub
|
|
|
|
$ hg --cwd test add .hgsub
|
|
|
|
$ hg --cwd test commit -qm 'add subrepo'
|
|
|
|
$ hg clone http://localhost:$HGPORT noslash-clone
|
|
|
|
requesting all changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 3 changesets with 7 changes to 7 files
|
|
|
|
updating to branch default
|
|
|
|
abort: HTTP Error 404: Not Found
|
|
|
|
[255]
|
|
|
|
$ hg clone http://localhost:$HGPORT/ slash-clone
|
|
|
|
requesting all changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 3 changesets with 7 changes to 7 files
|
|
|
|
updating to branch default
|
|
|
|
abort: HTTP Error 404: Not Found
|
|
|
|
[255]
|
|
|
|
|
2011-02-21 02:57:19 +03:00
|
|
|
check error log
|
|
|
|
|
|
|
|
$ cat error.log
|
2017-02-10 20:20:58 +03:00
|
|
|
|
|
|
|
check abort error reporting while pulling/cloning
|
|
|
|
|
|
|
|
$ $RUNTESTDIR/killdaemons.py
|
|
|
|
$ hg -R test serve -p $HGPORT -d --pid-file=hg3.pid -E error.log --config extensions.crash=${TESTDIR}/crashgetbundler.py
|
|
|
|
$ cat hg3.pid >> $DAEMON_PIDS
|
|
|
|
$ hg clone http://localhost:$HGPORT/ abort-clone
|
|
|
|
requesting all changes
|
|
|
|
remote: abort: this is an exercise
|
|
|
|
abort: pull failed on remote
|
|
|
|
[255]
|
|
|
|
$ cat error.log
|
2017-03-10 09:40:52 +03:00
|
|
|
|
|
|
|
corrupt cookies file should yield a warning
|
|
|
|
|
|
|
|
$ cat > $TESTTMP/cookies.txt << EOF
|
|
|
|
> bad format
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ hg --config auth.cookiefile=$TESTTMP/cookies.txt id http://localhost:$HGPORT/
|
2017-04-16 07:37:31 +03:00
|
|
|
(error loading cookie file $TESTTMP/cookies.txt: '*/cookies.txt' does not look like a Netscape format cookies file; continuing without cookies) (glob)
|
2017-03-10 09:40:52 +03:00
|
|
|
56f9bc90cce6
|
|
|
|
|
|
|
|
$ killdaemons.py
|
|
|
|
|
|
|
|
Create dummy authentication handler that looks for cookies. It doesn't do anything
|
|
|
|
useful. It just raises an HTTP 500 with details about the Cookie request header.
|
|
|
|
We raise HTTP 500 because its message is printed in the abort message.
|
|
|
|
|
|
|
|
$ cat > cookieauth.py << EOF
|
|
|
|
> from mercurial import util
|
|
|
|
> from mercurial.hgweb import common
|
|
|
|
> def perform_authentication(hgweb, req, op):
|
|
|
|
> cookie = req.env.get('HTTP_COOKIE')
|
|
|
|
> if not cookie:
|
|
|
|
> raise common.ErrorResponse(common.HTTP_SERVER_ERROR, 'no-cookie')
|
|
|
|
> raise common.ErrorResponse(common.HTTP_SERVER_ERROR, 'Cookie: %s' % cookie)
|
|
|
|
> def extsetup():
|
|
|
|
> common.permhooks.insert(0, perform_authentication)
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ hg serve --config extensions.cookieauth=cookieauth.py -R test -p $HGPORT -d --pid-file=pid
|
|
|
|
$ cat pid > $DAEMON_PIDS
|
|
|
|
|
|
|
|
Request without cookie sent should fail due to lack of cookie
|
|
|
|
|
|
|
|
$ hg id http://localhost:$HGPORT
|
|
|
|
abort: HTTP Error 500: no-cookie
|
|
|
|
[255]
|
|
|
|
|
|
|
|
Populate a cookies file
|
|
|
|
|
|
|
|
$ cat > cookies.txt << EOF
|
|
|
|
> # HTTP Cookie File
|
|
|
|
> # Expiration is 2030-01-01 at midnight
|
|
|
|
> .example.com TRUE / FALSE 1893456000 hgkey examplevalue
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
Should not send a cookie for another domain
|
|
|
|
|
|
|
|
$ hg --config auth.cookiefile=cookies.txt id http://localhost:$HGPORT/
|
|
|
|
abort: HTTP Error 500: no-cookie
|
|
|
|
[255]
|
|
|
|
|
|
|
|
Add a cookie entry for our test server and verify it is sent
|
|
|
|
|
|
|
|
$ cat >> cookies.txt << EOF
|
|
|
|
> localhost.local FALSE / FALSE 1893456000 hgkey localhostvalue
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ hg --config auth.cookiefile=cookies.txt id http://localhost:$HGPORT/
|
|
|
|
abort: HTTP Error 500: Cookie: hgkey=localhostvalue
|
|
|
|
[255]
|