##// END OF EJS Templates
hgweb: support constructing URLs from an alternate base URL...
hgweb: support constructing URLs from an alternate base URL The web.baseurl config option allows server operators to define a custom URL for hosted content. The way it works today is that hgwebdir parses this config option into URL components then updates the appropriate WSGI environment variables so the request "lies" about its details. For example, SERVER_NAME is updated to reflect the alternate base URL's hostname. The WSGI environment should not be modified because WSGI applications may want to know the original request details (for debugging, etc). This commit teaches our request parser about the existence of an alternate base URL. If defined, the advertised URL and other self-reflected paths will take the alternate base URL into account. The hgweb WSGI application didn't use web.baseurl. But hgwebdir did. We update hgwebdir to alter the environment parsing accordingly. The old code around environment manipulation has been removed. With this change, parserequestfromenv() has grown to a bit unwieldy. Now that practically everyone is using it, it is obvious that there is some unused features that can be trimmed. So look for this in follow-up commits. Differential Revision: https://phab.mercurial-scm.org/D2822

File last commit:

r34662:eb586ed5 default
r36916:219b2335 default
Show More
test-patch.t
92 lines | 2.4 KiB | text/troff | Tads3Lexer
Nicolas Dumazet
tests: unify test-patch
r11784 $ cat > patchtool.py <<EOF
Augie Fackler
tests: update test-patch to pass our import checker
r33974 > from __future__ import absolute_import, print_function
Nicolas Dumazet
tests: unify test-patch
r11784 > import sys
Augie Fackler
tests: update test-patch to pass our import checker
r33974 > print('Using custom patch')
Nicolas Dumazet
tests: unify test-patch
r11784 > if '--binary' in sys.argv:
Augie Fackler
tests: update test-patch to pass our import checker
r33974 > print('--binary found !')
Nicolas Dumazet
tests: unify test-patch
r11784 > EOF
$ echo "[ui]" >> $HGRCPATH
Augie Fackler
cleanup: use $PYTHON to run python in many more tests...
r32940 $ echo "patch=$PYTHON ../patchtool.py" >> $HGRCPATH
Nicolas Dumazet
tests: unify test-patch
r11784
$ hg init a
$ cd a
$ echo a > a
$ hg commit -Ama -d '1 0'
adding a
$ echo b >> a
$ hg commit -Amb -d '2 0'
$ cd ..
Christian Ebert
test-patch.t: typos
r11815 This test checks that:
- custom patch commands with arguments actually work
Nicolas Dumazet
tests: unify test-patch
r11784 - patch code does not try to add weird arguments like
--binary when custom patch commands are used. For instance
--binary is added by default under win32.
check custom patch options are honored
$ hg --cwd a export -o ../a.diff tip
$ hg clone -r 0 a b
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
Denis Laxalde
transaction-summary: show the range of new revisions upon pull/unbundle (BC)...
r34662 new changesets 8580ff50825a
Nicolas Dumazet
tests: unify test-patch
r11784 updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg --cwd b import -v ../a.diff
applying ../a.diff
Using custom patch
Greg Ward
import: simplify status reporting logic (and make it more I18N-friendly)...
r15194 applied to working directory
Mads Kiilerich
import: don't strip '#' lines from patch descriptions (issue 2417)...
r12645
Issue2417: hg import with # comments in description
Prepare source repo and patch:
$ rm $HGRCPATH
$ hg init c
$ cd c
Wagner Bruna
patch: fix parsing patch files containing CRs not followed by LFs...
r14832 $ printf "a\rc" > a
Mads Kiilerich
import: don't strip '#' lines from patch descriptions (issue 2417)...
r12645 $ hg ci -A -m 0 a -d '0 0'
Wagner Bruna
patch: fix parsing patch files containing CRs not followed by LFs...
r14832 $ printf "a\rb\rc" > a
Mads Kiilerich
import: don't strip '#' lines from patch descriptions (issue 2417)...
r12645 $ cat << eof > log
Mads Kiilerich
import: only the first hg patch marker should be processed (issue2417)...
r12728 > first line which can't start with '# '
> # second line is a comment but that shouldn't be a problem.
> A patch marker like this was more problematic even after d7452292f9d3:
> # HG changeset patch
> # User lines looks like this - but it _is_ just a comment
Mads Kiilerich
import: don't strip '#' lines from patch descriptions (issue 2417)...
r12645 > eof
$ hg ci -l log -d '0 0'
$ hg export -o p 1
$ cd ..
Clone and apply patch:
$ hg clone -r 0 c d
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
Denis Laxalde
transaction-summary: show the range of new revisions upon pull/unbundle (BC)...
r34662 new changesets 7fadb901d403
Mads Kiilerich
import: don't strip '#' lines from patch descriptions (issue 2417)...
r12645 updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd d
$ hg import ../c/p
applying ../c/p
$ hg log -v -r 1
Wagner Bruna
patch: fix parsing patch files containing CRs not followed by LFs...
r14832 changeset: 1:cd0bde79c428
Mads Kiilerich
import: don't strip '#' lines from patch descriptions (issue 2417)...
r12645 tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
files: a
description:
Mads Kiilerich
import: only the first hg patch marker should be processed (issue2417)...
r12728 first line which can't start with '# '
# second line is a comment but that shouldn't be a problem.
A patch marker like this was more problematic even after d7452292f9d3:
# HG changeset patch
# User lines looks like this - but it _is_ just a comment
Mads Kiilerich
import: don't strip '#' lines from patch descriptions (issue 2417)...
r12645
$ cd ..