mirror of
https://github.com/facebook/sapling.git
synced 2024-10-12 17:58:27 +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
38 lines
946 B
Raku
38 lines
946 B
Raku
#require serve
|
|
|
|
$ hg init test
|
|
$ cd test
|
|
|
|
$ cat > .hg/hgrc <<EOF
|
|
> [extensions]
|
|
> # this is only necessary to check that the mapping from
|
|
> # interhg to websub works
|
|
> interhg =
|
|
>
|
|
> [websub]
|
|
> issues = s|Issue(\d+)|<a href="http://bts.example.org/issue\1">Issue\1</a>|
|
|
>
|
|
> [interhg]
|
|
> # check that we maintain some interhg backwards compatibility...
|
|
> # yes, 'x' is a weird delimiter...
|
|
> markbugs = sxbugx<i class="\x">bug</i>x
|
|
> EOF
|
|
|
|
$ touch foo
|
|
$ hg add foo
|
|
$ hg commit -d '1 0' -m 'Issue123: fixed the bug!'
|
|
|
|
$ hg serve -n test -p 0 --port-file $TESTTMP/.port -d --pid-file=hg.pid -A access.log -E errors.log
|
|
$ HGPORT=`cat $TESTTMP/.port`
|
|
$ cat hg.pid >> $DAEMON_PIDS
|
|
|
|
log
|
|
|
|
$ get-with-headers.py localhost:$HGPORT "rev/tip" | grep bts
|
|
<div class="description"><a href="http://bts.example.org/issue123">Issue123</a>: fixed the <i class="x">bug</i>!</div>
|
|
errors
|
|
|
|
$ cat errors.log
|
|
|
|
$ cd ..
|