##// END OF EJS Templates
hooks: add HG_NODE_LAST to txnclose and changegroup hook environments...
hooks: add HG_NODE_LAST to txnclose and changegroup hook environments Sometimes a txnclose or changegroup hook wants to iterate through all the changesets in transaction: in that situation usually the revset `$HG_NODE:` is used to select the revisions. Unfortunately this revset sometimes may contain too many changesets because we don't have the write lock while the hook runs newer changes may be added to repository in the meantime. That's why there is a need for extra variable carrying the information about the last change in the transaction.

File last commit:

r27739:d6d3cf5f default
r27739:d6d3cf5f default
Show More
test-http.t
323 lines | 12.3 KiB | text/troff | Tads3Lexer
Matt Mackall
tests: replace exit 80 with #require
r22046 #require serve
Matt Mackall
tests: unify test-http
r12446
$ 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
Mads Kiilerich
hgweb: handle invalid requests with both form data and querystring...
r13445 $ hg serve -p $HGPORT -d --pid-file=../hg1.pid -E ../error.log
Matt Mackall
tests: unify test-http
r12446 $ hg --config server.uncompressed=False serve -p $HGPORT1 -d --pid-file=../hg2.pid
Test server address cannot be reused
Adrian Buehlmann
test-http and test-https: partially adapt for Windows
r17023 #if windows
$ hg serve -p $HGPORT1 2>&1
abort: cannot start server at ':$HGPORT1': * (glob)
[255]
#else
Matt Mackall
tests: unify test-http
r12446 $ hg serve -p $HGPORT1 2>&1
Mads Kiilerich
tests: reintroduce ":$HGPORT" in test output...
r12643 abort: cannot start server at ':$HGPORT1': Address already in use
Matt Mackall
tests: unify test-http
r12446 [255]
Adrian Buehlmann
test-http and test-https: partially adapt for Windows
r17023 #endif
Matt Mackall
tests: unify test-http
r12446 $ 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
Thomas Arendsen Hein
tests: check for (*/sec) instead of (*B/sec) to match (X bytes/sec)...
r14023 transferred * bytes in * seconds (*/sec) (glob)
Durham Goode
clone: fix copying bookmarks in uncompressed clones (issue4430)...
r23116 searching for changes
no changes found
Matt Mackall
tests: unify test-http
r12446 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 ..
Augie Fackler
clone: don't fail with --update for non-local clones (issue3578)...
r17342 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
Peter Arrenbrecht
bundlerepo: fix and improve getremotechanges...
r14161 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 ..
Matt Mackall
tests: unify test-http
r12446 pull
$ cd copy-pull
$ echo '[hooks]' >> .hg/hgrc
Matt Mackall
tests: simplify printenv calls...
r25478 $ echo "changegroup = printenv.py changegroup" >> .hg/hgrc
Matt Mackall
tests: unify test-http
r12446 $ hg pull
Mads Kiilerich
tests: reintroduce ":$HGPORT" in test output...
r12643 pulling from http://localhost:$HGPORT1/
Matt Mackall
tests: unify test-http
r12446 searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
Mateusz Kwapich
hooks: add HG_NODE_LAST to txnclose and changegroup hook environments...
r27739 changegroup hook: HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=http://localhost:$HGPORT1/ (glob)
Matt Mackall
tests: unify test-http
r12446 (run 'hg update' to get a working copy)
$ cd ..
Mads Kiilerich
hgweb: handle invalid requests with both form data and querystring...
r13445
clone from invalid URL
$ hg clone http://localhost:$HGPORT/bad
abort: HTTP Error 404: Not Found
[255]
Mads Kiilerich
test-http: test http authentication...
r15026 test http authentication
Benoit Allard
protocol: Add the stream-preferred capability...
r16361 + use the same server to test server side streaming preference
Mads Kiilerich
test-http: test http authentication...
r15026
$ 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"')])
Augie Fackler
clone: don't fail with --update for non-local clones (issue3578)...
r17342 > if base64.b64decode(auth.split()[1]).split(':', 1) != ['user', 'pass']:
Mads Kiilerich
test-http: test http authentication...
r15026 > raise common.ErrorResponse(common.HTTP_FORBIDDEN, 'no')
> def extsetup():
> common.permhooks.insert(0, perform_authentication)
> EOT
Benoit Allard
protocol: Add the stream-preferred capability...
r16361 $ hg --config extensions.x=userpass.py serve -p $HGPORT2 -d --pid-file=pid \
Mads Kiilerich
tests: improved test coverage for HTTP authentication and 401 responses...
r20385 > --config server.preferuncompressed=True \
> --config web.push_ssl=False --config web.allow_push=* -A ../access.log
Mads Kiilerich
test-http: test http authentication...
r15026 $ cat pid >> $DAEMON_PIDS
Lucas Moscovicz
url: added authuri when login information is requested (issue3209)...
r20291 $ cat << EOF > get_pass.py
> import getpass
> def newgetpass(arg):
> return "pass"
> getpass.getpass = newgetpass
> EOF
Augie Fackler
clone: don't fail with --update for non-local clones (issue3578)...
r17342 $ hg id http://localhost:$HGPORT2/
Lucas Moscovicz
url: added authuri when login information is requested (issue3209)...
r20291 abort: http authorization required for http://localhost:$HGPORT2/
Mads Kiilerich
test-http: test http authentication...
r15026 [255]
Lucas Moscovicz
url: added authuri when login information is requested (issue3209)...
r20291 $ hg id http://localhost:$HGPORT2/
abort: http authorization required for http://localhost:$HGPORT2/
Mads Kiilerich
test-http: test http authentication...
r15026 [255]
Lucas Moscovicz
url: added authuri when login information is requested (issue3209)...
r20291 $ 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
Mads Kiilerich
test-http: test http authentication...
r15026 $ hg id http://user:pass@localhost:$HGPORT2/
5fed3813f7f5
Augie Fackler
clone: don't fail with --update for non-local clones (issue3578)...
r17342 $ echo '[auth]' >> .hg/hgrc
Mads Kiilerich
test-http: test http authentication...
r15026 $ echo 'l.schemes=http' >> .hg/hgrc
$ echo 'l.prefix=lo' >> .hg/hgrc
$ echo 'l.username=user' >> .hg/hgrc
$ echo 'l.password=pass' >> .hg/hgrc
Augie Fackler
clone: don't fail with --update for non-local clones (issue3578)...
r17342 $ hg id http://localhost:$HGPORT2/
Mads Kiilerich
test-http: test http authentication...
r15026 5fed3813f7f5
Augie Fackler
clone: don't fail with --update for non-local clones (issue3578)...
r17342 $ hg id http://localhost:$HGPORT2/
Mads Kiilerich
test-http: test http authentication...
r15026 5fed3813f7f5
Augie Fackler
clone: don't fail with --update for non-local clones (issue3578)...
r17342 $ hg id http://user@localhost:$HGPORT2/
Mads Kiilerich
test-http: test http authentication...
r15026 5fed3813f7f5
Benoit Allard
protocol: Add the stream-preferred capability...
r16361 $ 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)
Durham Goode
clone: fix copying bookmarks in uncompressed clones (issue4430)...
r23116 searching for changes
no changes found
Benoit Allard
protocol: Add the stream-preferred capability...
r16361 updating to branch default
5 files updated, 0 files merged, 0 files removed, 0 files unresolved
Siddharth Agarwal
localrepo.clone: add a way to override server preferuncompressed...
r23546 --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
Benoit Allard
protocol: Add the stream-preferred capability...
r16361
Augie Fackler
clone: don't fail with --update for non-local clones (issue3578)...
r17342 $ hg id http://user2@localhost:$HGPORT2/
Lucas Moscovicz
url: added authuri when login information is requested (issue3209)...
r20291 abort: http authorization required for http://localhost:$HGPORT2/
Mads Kiilerich
test-http: test http authentication...
r15026 [255]
$ hg id http://user:pass2@localhost:$HGPORT2/
abort: HTTP Error 403: no
[255]
Mads Kiilerich
tests: improved test coverage for HTTP authentication and 401 responses...
r20385
$ 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
$ cut -c38- ../access.log
"GET /?cmd=capabilities HTTP/1.1" 200 -
"GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip
"GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces
"GET /?cmd=capabilities HTTP/1.1" 200 -
"GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip
"GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces
"GET /?cmd=capabilities HTTP/1.1" 200 -
"GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip
"GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks
"GET /?cmd=capabilities HTTP/1.1" 200 -
"GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip
"GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks
"GET /?cmd=capabilities HTTP/1.1" 200 -
"GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip
"GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks
"GET /?cmd=capabilities HTTP/1.1" 200 -
"GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip
"GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks
"GET /?cmd=capabilities HTTP/1.1" 200 -
"GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip
"GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks
"GET /?cmd=capabilities HTTP/1.1" 200 -
"GET /?cmd=branchmap HTTP/1.1" 200 -
"GET /?cmd=stream_out HTTP/1.1" 401 -
"GET /?cmd=stream_out HTTP/1.1" 200 -
Durham Goode
clone: fix copying bookmarks in uncompressed clones (issue4430)...
r23116 "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D5fed3813f7f5e1824344fdc9cf8f63bb662c292d
Augie Fackler
changegroup: introduce cg3, which has support for exchanging treemanifests...
r27432 "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=0&common=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=phase%2Cbookmarks
Durham Goode
clone: fix copying bookmarks in uncompressed clones (issue4430)...
r23116 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases
Mads Kiilerich
tests: improved test coverage for HTTP authentication and 401 responses...
r20385 "GET /?cmd=capabilities HTTP/1.1" 200 -
Siddharth Agarwal
localrepo.clone: add a way to override server preferuncompressed...
r23546 "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D
Augie Fackler
changegroup: introduce cg3, which has support for exchanging treemanifests...
r27432 "GET /?cmd=getbundle HTTP/1.1" 401 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=phase%2Cbookmarks
"GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=phase%2Cbookmarks
Siddharth Agarwal
localrepo.clone: add a way to override server preferuncompressed...
r23546 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases
"GET /?cmd=capabilities HTTP/1.1" 200 -
Mads Kiilerich
tests: improved test coverage for HTTP authentication and 401 responses...
r20385 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip
"GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces
"GET /?cmd=capabilities HTTP/1.1" 200 -
"GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip
"GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces
"GET /?cmd=listkeys HTTP/1.1" 403 - x-hgarg-1:namespace=namespaces
"GET /?cmd=capabilities HTTP/1.1" 200 -
"GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D7f4e523d01f2cc3765ac8934da3d14db775ff872
Pierre-Yves David
push: perform phases discovery before the push...
r22019 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=phases
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases
Pierre-Yves David
push: move bookmark discovery with other discovery steps...
r22239 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks
Mads Kiilerich
tests: improved test coverage for HTTP authentication and 401 responses...
r20385 "GET /?cmd=branchmap HTTP/1.1" 200 -
"GET /?cmd=branchmap HTTP/1.1" 200 -
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks
Pierre-Yves David
test: use bundle2 in test-http...
r25378 "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=666f726365
Mads Kiilerich
tests: improved test coverage for HTTP authentication and 401 responses...
r20385 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases
Mads Kiilerich
test-http: test http authentication...
r15026 $ cd ..
Mads Kiilerich
subrepo: fix cloning of repos from urls without slash after host (issue2970)...
r15055 clone of serve with repo in root and unserved subrepo (issue2970)
$ hg --cwd test init sub
Brad Hall
tag: don't allow tagging the null revision (issue1915)...
r17260 $ 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
Mads Kiilerich
subrepo: fix cloning of repos from urls without slash after host (issue2970)...
r15055 $ 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]
Mads Kiilerich
hgweb: handle invalid requests with both form data and querystring...
r13445 check error log
$ cat error.log