##// 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:

r36663:7bc33d67 default
r36916:219b2335 default
Show More
test-resolve.t
372 lines | 9.8 KiB | text/troff | Tads3Lexer
Nicolas Dumazet
tests: unify test-resolve
r12117 test that a commit clears the merge state.
$ hg init repo
$ cd repo
Martin von Zweigbergk
test-resolve: add test resolving one of two files...
r23021 $ echo foo > file1
$ echo foo > file2
$ hg commit -Am 'add files'
adding file1
adding file2
Nicolas Dumazet
tests: unify test-resolve
r12117
Martin von Zweigbergk
test-resolve: add test resolving one of two files...
r23021 $ echo bar >> file1
$ echo bar >> file2
$ hg commit -Am 'append bar to files'
Nicolas Dumazet
tests: unify test-resolve
r12117
Martin von Zweigbergk
test-resolve: add more tests for in conflict-free states...
r23022 create a second head with conflicting edits
Nicolas Dumazet
tests: unify test-resolve
r12117
$ hg up -C 0
Martin von Zweigbergk
test-resolve: add test resolving one of two files...
r23021 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo baz >> file1
$ echo baz >> file2
$ hg commit -Am 'append baz to files'
Nicolas Dumazet
tests: unify test-resolve
r12117 created new head
Martin von Zweigbergk
test-resolve: add more tests for in conflict-free states...
r23022 create a third head with no conflicting edits
$ hg up -qC 0
$ echo foo > file3
$ hg commit -Am 'add non-conflicting file'
adding file3
created new head
Nicolas Dumazet
tests: unify test-resolve
r12117 failing merge
Martin von Zweigbergk
test-resolve: add more tests for in conflict-free states...
r23022 $ hg up -qC 2
$ hg merge --tool=internal:fail 1
Martin von Zweigbergk
test-resolve: add test resolving one of two files...
r23021 0 files updated, 0 files merged, 0 files removed, 2 files unresolved
Pulkit Goyal
merge: add `--abort` flag which can abort the merge...
r35722 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
Matt Mackall
tests: add exit codes to unified tests
r12316 [1]
Nicolas Dumazet
tests: unify test-resolve
r12117
Martin von Zweigbergk
test-resolve: add test resolving one of two files...
r23021 resolve -l should contain unresolved entries
Gregory Szorc
resolve: split test...
r21263
$ hg resolve -l
Martin von Zweigbergk
test-resolve: add test resolving one of two files...
r23021 U file1
U file2
Gregory Szorc
resolve: split test...
r21263
Yuya Nishihara
resolve: port to generic templater...
r24127 $ hg resolve -l --no-status
file1
file2
Yuya Nishihara
resolve: silence warning of unknown pats for -l/--list (BC)...
r24125 resolving an unknown path should emit a warning, but not for -l
Martin von Zweigbergk
test-resolve: clarify test descriptions and consistently use "should"
r23020
Gregory Szorc
resolve: print warning when no work performed (issue4208)...
r21265 $ hg resolve -m does-not-exist
Matt Mackall
resolve: fix grammar of no matching files message
r21721 arguments do not match paths that need resolving
Yuya Nishihara
resolve: silence warning of unknown pats for -l/--list (BC)...
r24125 $ hg resolve -l does-not-exist
Gregory Szorc
resolve: print warning when no work performed (issue4208)...
r21265
timeless
resolve: when pats do not match, hint about path:...
r28402 tell users how they could have used resolve
$ mkdir nested
$ cd nested
$ hg resolve -m file1
arguments do not match paths that need resolving
(try: hg resolve -m path:file1)
$ hg resolve -m file1 filez
arguments do not match paths that need resolving
(try: hg resolve -m path:file1 path:filez)
$ hg resolve -m path:file1 path:filez
$ hg resolve -l
R file1
U file2
$ hg resolve -m filez file2
arguments do not match paths that need resolving
(try: hg resolve -m path:filez path:file2)
$ hg resolve -m path:filez path:file2
(no more unresolved files)
$ hg resolve -l
R file1
R file2
cleanup
$ hg resolve -u
$ cd ..
$ rmdir nested
Siddharth Agarwal
commands.resolve: don't allow users to mark or unmark driver-resolved files...
r26784 don't allow marking or unmarking driver-resolved files
$ cat > $TESTTMP/markdriver.py << EOF
> '''mark and unmark files as driver-resolved'''
Augie Fackler
tests: fix various test-check-module-imports.t violations...
r36663 > from mercurial import (
> merge,
> pycompat,
> registrar,
> scmutil,
> )
Siddharth Agarwal
commands.resolve: don't allow users to mark or unmark driver-resolved files...
r26784 > cmdtable = {}
Yuya Nishihara
registrar: move cmdutil.command to registrar module (API)...
r32337 > command = registrar.command(cmdtable)
Pulkit Goyal
py3: make sure commands name are bytes in tests
r33097 > @command(b'markdriver',
Pulkit Goyal
py3: port the markdirver extension in tests/test-resolve.t...
r36499 > [(b'u', b'unmark', None, b'')],
> b'FILE...')
Siddharth Agarwal
commands.resolve: don't allow users to mark or unmark driver-resolved files...
r26784 > def markdriver(ui, repo, *pats, **opts):
> wlock = repo.wlock()
Pulkit Goyal
py3: port the markdirver extension in tests/test-resolve.t...
r36499 > opts = pycompat.byteskwargs(opts)
Siddharth Agarwal
commands.resolve: don't allow users to mark or unmark driver-resolved files...
r26784 > try:
Siddharth Agarwal
test-resolve.t: switch to mergestate.read()...
r26997 > ms = merge.mergestate.read(repo)
Siddharth Agarwal
commands.resolve: don't allow users to mark or unmark driver-resolved files...
r26784 > m = scmutil.match(repo[None], pats, opts)
> for f in ms:
> if not m(f):
> continue
Pulkit Goyal
py3: port the markdirver extension in tests/test-resolve.t...
r36499 > if not opts[b'unmark']:
> ms.mark(f, b'd')
Siddharth Agarwal
commands.resolve: don't allow users to mark or unmark driver-resolved files...
r26784 > else:
Pulkit Goyal
py3: port the markdirver extension in tests/test-resolve.t...
r36499 > ms.mark(f, b'u')
Siddharth Agarwal
commands.resolve: don't allow users to mark or unmark driver-resolved files...
r26784 > ms.commit()
> finally:
> wlock.release()
> EOF
$ hg --config extensions.markdriver=$TESTTMP/markdriver.py markdriver file1
$ hg resolve --list
D file1
U file2
$ hg resolve --mark file1
not marking file1 as it is driver-resolved
this should not print out file1
$ hg resolve --mark --all
(no more unresolved files -- run "hg resolve --all" to conclude)
$ hg resolve --mark 'glob:file*'
(no more unresolved files -- run "hg resolve --all" to conclude)
$ hg resolve --list
D file1
R file2
$ hg resolve --unmark file1
not unmarking file1 as it is driver-resolved
(no more unresolved files -- run "hg resolve --all" to conclude)
$ hg resolve --unmark --all
$ hg resolve --list
D file1
U file2
$ hg --config extensions.markdriver=$TESTTMP/markdriver.py markdriver --unmark file1
$ hg resolve --list
U file1
U file2
Gregory Szorc
resolve: split test...
r21263 resolve the failure
Martin von Zweigbergk
test-resolve: add test resolving one of two files...
r23021 $ echo resolved > file1
$ hg resolve -m file1
resolve -l should show resolved file as resolved
$ hg resolve -l
R file1
U file2
Yuya Nishihara
resolve: port to generic templater...
r24127 $ hg resolve -l -Tjson
[
{
"path": "file1",
"status": "R"
},
{
"path": "file2",
"status": "U"
}
]
Martin von Zweigbergk
test-resolve: add test resolving one of two files...
r23021 resolve -m without paths should mark all resolved
$ hg resolve -m
Pierre-Yves David
resolve: add parenthesis around "no more unresolved files" message...
r21947 (no more unresolved files)
Nicolas Dumazet
tests: unify test-resolve
r12117 $ hg commit -m 'resolved'
Martin von Zweigbergk
test-resolve: clarify test descriptions and consistently use "should"
r23020 resolve -l should be empty after commit
Nicolas Dumazet
tests: unify test-resolve
r12117
$ hg resolve -l
Siddharth Agarwal
resolve: don't abort resolve -l even when no merge is in progress...
r21541
Yuya Nishihara
resolve: port to generic templater...
r24127 $ hg resolve -l -Tjson
[
]
Martin von Zweigbergk
test-resolve: add more tests for in conflict-free states...
r23022 resolve --all should abort when no merge in progress
$ hg resolve --all
abort: resolve command not applicable when not merging
[255]
Martin von Zweigbergk
test-resolve: clarify test descriptions and consistently use "should"
r23020 resolve -m should abort when no merge in progress
Siddharth Agarwal
resolve: don't abort resolve -l even when no merge is in progress...
r21541 $ hg resolve -m
Gregory Szorc
resolve: abort when not applicable (BC)...
r21264 abort: resolve command not applicable when not merging
[255]
Nicolas Dumazet
tests: unify test-resolve
r12117
Martin von Zweigbergk
merge: refuse update/merge if there are unresolved conflicts (BC)...
r27316 can not update or merge when there are unresolved conflicts
$ hg up -qC 0
$ echo quux >> file1
$ hg up 1
merging file1
warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
1 files updated, 0 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges
[1]
$ hg up 0
abort: outstanding merge conflicts
[255]
$ hg merge 2
abort: outstanding merge conflicts
[255]
$ hg merge --force 2
abort: outstanding merge conflicts
[255]
Martin von Zweigbergk
test-resolve: add more tests for in conflict-free states...
r23022 set up conflict-free merge
$ hg up -qC 3
$ hg merge 1
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
Martin von Zweigbergk
resolve: run happily after conflict-free merge
r23024 resolve --all should do nothing in merge without conflicts
Martin von Zweigbergk
test-resolve: add more tests for in conflict-free states...
r23022 $ hg resolve --all
Martin von Zweigbergk
resolve: run happily after conflict-free merge
r23024 (no more unresolved files)
Martin von Zweigbergk
test-resolve: add more tests for in conflict-free states...
r23022
Martin von Zweigbergk
resolve: run happily after conflict-free merge
r23024 resolve -m should do nothing in merge without conflicts
Martin von Zweigbergk
test-resolve: add more tests for in conflict-free states...
r23022
$ hg resolve -m
Martin von Zweigbergk
resolve: run happily after conflict-free merge
r23024 (no more unresolved files)
Martin von Zweigbergk
test-resolve: add more tests for in conflict-free states...
r23022
Martin von Zweigbergk
test-resolve: add tests for re-merge
r23023 get back to conflicting state
$ hg up -qC 2
$ hg merge --tool=internal:fail 1
0 files updated, 0 files merged, 0 files removed, 2 files unresolved
Pulkit Goyal
merge: add `--abort` flag which can abort the merge...
r35722 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
Martin von Zweigbergk
test-resolve: add tests for re-merge
r23023 [1]
resolve without arguments should suggest --all
$ hg resolve
abort: no files or directories specified
timeless@mozdev.org
resolve: consistently describe re-merge + unresolved
r26352 (use --all to re-merge all unresolved files)
Martin von Zweigbergk
test-resolve: add tests for re-merge
r23023 [255]
resolve --all should re-merge all unresolved files
Siddharth Agarwal
test-resolve.t: add some output to show order of operations...
r26619 $ hg resolve --all
merging file1
Siddharth Agarwal
resolve: perform all premerges before performing any file merges (BC)...
r26621 merging file2
Siddharth Agarwal
simplemerge: move conflict warning message to filemerge...
r26614 warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
warning: conflicts while merging file2! (edit, then use 'hg resolve --mark')
Martin von Zweigbergk
test-resolve: add tests for re-merge
r23023 [1]
Siddharth Agarwal
test-resolve.t: add some tests for .orig file contents...
r26620 $ cat file1.orig
foo
baz
$ cat file2.orig
foo
baz
Christian Delahousse
resolve: choose where .orig file locations are kept...
r26939
.orig files should exists where specified
$ hg resolve --all --verbose --config 'ui.origbackuppath=.hg/origbackups'
merging file1
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 creating directory: $TESTTMP/repo/.hg/origbackups
Christian Delahousse
resolve: choose where .orig file locations are kept...
r26939 merging file2
warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
warning: conflicts while merging file2! (edit, then use 'hg resolve --mark')
[1]
$ ls .hg/origbackups
Mark Thomas
scmutil: don't append .orig to backups in origbackuppath (BC)...
r34145 file1
file2
Augie Fackler
test-resolve.t: use redirection to /dev/null instead of grep -q
r23025 $ grep '<<<' file1 > /dev/null
$ grep '<<<' file2 > /dev/null
Martin von Zweigbergk
test-resolve: add tests for re-merge
r23023
resolve <file> should re-merge file
$ echo resolved > file1
$ hg resolve -q file1
Siddharth Agarwal
simplemerge: move conflict warning message to filemerge...
r26614 warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
Martin von Zweigbergk
test-resolve: add tests for re-merge
r23023 [1]
Augie Fackler
test-resolve.t: use redirection to /dev/null instead of grep -q
r23025 $ grep '<<<' file1 > /dev/null
Martin von Zweigbergk
test-resolve: add tests for re-merge
r23023
Siddharth Agarwal
resolve: restore .orig only after merge is fully complete (issue4952)...
r26959 test .orig behavior with resolve
Matt Harbison
test-resolve: fix '--tool f' invocation for Windows...
r27067 $ hg resolve -q file1 --tool "sh -c 'f --dump \"$TESTTMP/repo/file1.orig\"'"
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 $TESTTMP/repo/file1.orig:
Siddharth Agarwal
resolve: restore .orig only after merge is fully complete (issue4952)...
r26959 >>>
foo
baz
<<<
Martin von Zweigbergk
test-resolve: add tests for re-merge
r23023 resolve <file> should do nothing if 'file' was marked resolved
$ echo resolved > file1
$ hg resolve -m file1
$ hg resolve -q file1
$ cat file1
resolved
Siddharth Agarwal
mergestate: handle additional record types specially...
r27027 insert unsupported advisory merge record
$ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -x
$ hg debugmergestate
* version 2 records
local: 57653b9f834a4493f7240b0681efcb9ae7cab745
other: dc77451844e37f03f5c559e3b8529b2b48d381d1
Simon Farnsworth
merge: add conflict labels to merge command...
r30062 labels:
local: working copy
other: merge rev
Siddharth Agarwal
mergestate: handle additional record types specially...
r27027 unrecognized entry: x advisory record
Durham Goode
merge: add file ancestor linknode to mergestate...
r28011 file extras: file1 (ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac)
Siddharth Agarwal
mergestate: handle additional record types specially...
r27027 file: file1 (record type "F", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
local path: file1 (flags "")
ancestor path: file1 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
other path: file1 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
Durham Goode
merge: add file ancestor linknode to mergestate...
r28011 file extras: file2 (ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac)
Siddharth Agarwal
mergestate: handle additional record types specially...
r27027 file: file2 (record type "F", state "u", hash cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523)
local path: file2 (flags "")
ancestor path: file2 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
other path: file2 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
$ hg resolve -l
R file1
U file2
insert unsupported mandatory merge record
$ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -X
$ hg debugmergestate
* version 2 records
local: 57653b9f834a4493f7240b0681efcb9ae7cab745
other: dc77451844e37f03f5c559e3b8529b2b48d381d1
Simon Farnsworth
merge: add conflict labels to merge command...
r30062 labels:
local: working copy
other: merge rev
Durham Goode
merge: add file ancestor linknode to mergestate...
r28011 file extras: file1 (ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac)
Siddharth Agarwal
mergestate: handle additional record types specially...
r27027 file: file1 (record type "F", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
local path: file1 (flags "")
ancestor path: file1 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
other path: file1 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
Durham Goode
merge: add file ancestor linknode to mergestate...
r28011 file extras: file2 (ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac)
Siddharth Agarwal
mergestate: handle additional record types specially...
r27027 file: file2 (record type "F", state "u", hash cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523)
local path: file2 (flags "")
ancestor path: file2 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
other path: file2 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
unrecognized entry: X mandatory record
$ hg resolve -l
abort: unsupported merge state records: X
(see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
[255]
$ hg resolve -ma
abort: unsupported merge state records: X
(see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
[255]
$ hg summary
timeless
summary: move mergemod before parents to give access to ms
r28641 warning: merge state has unsupported record types: X
Siddharth Agarwal
mergestate: handle additional record types specially...
r27027 parent: 2:57653b9f834a
append baz to files
parent: 1:dc77451844e3
append bar to files
branch: default
commit: 2 modified, 2 unknown (merge)
update: 2 new changesets (update)
phases: 5 draft
update --clean shouldn't abort on unsupported records
$ hg up -qC 1
$ hg debugmergestate
no merge state found
Nicolas Dumazet
tests: unify test-resolve
r12117 test crashed merge with empty mergestate
$ mkdir .hg/merge
$ touch .hg/merge/state
Martin von Zweigbergk
test-resolve: clarify test descriptions and consistently use "should"
r23020 resolve -l should be empty
Nicolas Dumazet
tests: unify test-resolve
r12117
$ hg resolve -l
Mads Kiilerich
tests: add missing trailing 'cd ..'...
r16913
$ cd ..