mirror of
https://github.com/facebook/sapling.git
synced 2024-10-12 09:48:05 +03:00
4a7b28d08b
Summary: Previously `hg server` uses `HGPORT` that might be in use. This patch uses `-p 0 --port-file ...` so `hg server` always gets assigned a free port. The change was first made by the following Ruby script: ``` re = /^ \$ hg serve(.*) -p \$(HGPORT[12]?) (.*[^\\])$\n \$/ Dir['*.t'].each do |path| old = File.read(path) new = old.lines.map do |l| next l if l[/\(glob\)/] or not l['$HGPORT'] or l[/^ [$>]/] "#{l.chomp} (glob)\n" end.join.gsub re, <<-'EOS'.chomp $ hg serve\1 -p 0 --port-file $TESTTMP/.port \3 $ \2=`cat $TESTTMP/.port` $ EOS File.write(path, new) if old != new end ``` Then there are some manual changes: run-tests.py: It now treats `$HGPORT` in output as glob pattern `*`, since it does not know the assigned value in tests. test-bookmarks-pushpull.t, test-https.t: Some `hg pull`s were changed to use explicit paths instead of relying on `.hgrc` since the test restarts the server and `.hg/hgrc` having an outdated URL. test-schemes.t: The test writes `$HGPORT` to `.hgrc` before assigning it. Changed the order so the correct `$HGPORT` is written. test-patchbomb-tls.t: Changed `(?) (glob)` to `(glob) (?)`. Reviewed By: DurhamG Differential Revision: D6925398 fbshipit-source-id: d5c10476f43ce23f9e99618807580cf8ba92595c
41 lines
1.3 KiB
Perl
41 lines
1.3 KiB
Perl
#require killdaemons
|
|
|
|
= Test the known() protocol function =
|
|
|
|
Create a test repository:
|
|
|
|
$ hg init repo
|
|
$ cd repo
|
|
$ touch a ; hg add a ; hg ci -ma
|
|
$ touch b ; hg add b ; hg ci -mb
|
|
$ touch c ; hg add c ; hg ci -mc
|
|
$ hg log --template '{node}\n'
|
|
991a3460af53952d10ec8a295d3d2cc2e5fa9690
|
|
0e067c57feba1a5694ca4844f05588bb1bf82342
|
|
3903775176ed42b1458a6281db4a0ccf4d9f287a
|
|
$ cd ..
|
|
|
|
Test locally:
|
|
|
|
$ hg debugknown repo 991a3460af53952d10ec8a295d3d2cc2e5fa9690 0e067c57feba1a5694ca4844f05588bb1bf82342 3903775176ed42b1458a6281db4a0ccf4d9f287a
|
|
111
|
|
$ hg debugknown repo 000a3460af53952d10ec8a295d3d2cc2e5fa9690 0e067c57feba1a5694ca4844f05588bb1bf82342 0003775176ed42b1458a6281db4a0ccf4d9f287a
|
|
010
|
|
$ hg debugknown repo
|
|
|
|
|
|
Test via HTTP:
|
|
|
|
$ hg serve -R repo -p 0 --port-file $TESTTMP/.port -d --pid-file=hg.pid -E error.log -A access.log
|
|
$ HGPORT=`cat $TESTTMP/.port`
|
|
$ cat hg.pid >> $DAEMON_PIDS
|
|
$ hg debugknown http://localhost:$HGPORT/ 991a3460af53952d10ec8a295d3d2cc2e5fa9690 0e067c57feba1a5694ca4844f05588bb1bf82342 3903775176ed42b1458a6281db4a0ccf4d9f287a
|
|
111
|
|
$ hg debugknown http://localhost:$HGPORT/ 000a3460af53952d10ec8a295d3d2cc2e5fa9690 0e067c57feba1a5694ca4844f05588bb1bf82342 0003775176ed42b1458a6281db4a0ccf4d9f287a
|
|
010
|
|
$ hg debugknown http://localhost:$HGPORT/
|
|
|
|
$ cat error.log
|
|
$ killdaemons.py
|
|
|