##// END OF EJS Templates
httppeer: always add x-hg* headers to Vary header...
httppeer: always add x-hg* headers to Vary header Before, we manually updated the Vary header value for each header contributing to it. All X-Hg* headers are reserved for the Mercurial protocol and could have caching implications. So it makes sense to always add these headers to Vary. A test revealed that X-HgArgs-Post wasn't being added to Vary. This is only sent on POST requests. POST requests generally aren't cacheable. However, it is possible if the server sends the appropriate headers. Mercurial shouldn't be sending those headers. But let's not take any chances. Differential Revision: https://phab.mercurial-scm.org/D3240

File last commit:

r36709:1b179d15 default
r37573:930c433e default
Show More
test-export.t
288 lines | 6.8 KiB | text/troff | Tads3Lexer
Adrian Buehlmann
tests: unify test-export
r12034 $ hg init repo
$ cd repo
$ touch foo
$ hg add foo
$ for i in 0 1 2 3 4 5 6 7 8 9 10 11; do
> echo "foo-$i" >> foo
> hg ci -m "foo-$i"
> done
Andrzej Bieniek
export: add %m to file format string (first line of the commit message)...
r14986 $ for out in "%nof%N" "%%%H" "%b-%R" "%h" "%r" "%m"; do
Adrian Buehlmann
tests: unify test-export
r12034 > echo
> echo "# foo-$out.patch"
> hg export -v -o "foo-$out.patch" 2:tip
> done
# foo-%nof%N.patch
exporting patches:
foo-01of10.patch
foo-02of10.patch
foo-03of10.patch
foo-04of10.patch
foo-05of10.patch
foo-06of10.patch
foo-07of10.patch
foo-08of10.patch
foo-09of10.patch
foo-10of10.patch
# foo-%%%H.patch
exporting patches:
foo-%617188a1c80f869a7b66c85134da88a6fb145f67.patch
foo-%dd41a5ff707a5225204105611ba49cc5c229d55f.patch
foo-%f95a5410f8664b6e1490a4af654e4b7d41a7b321.patch
foo-%4346bcfde53b4d9042489078bcfa9c3e28201db2.patch
foo-%afda8c3a009cc99449a05ad8aa4655648c4ecd34.patch
foo-%35284ce2b6b99c9d2ac66268fe99e68e1974e1aa.patch
foo-%9688c41894e6931305fa7165a37f6568050b4e9b.patch
foo-%747d3c68f8ec44bb35816bfcd59aeb50b9654c2f.patch
foo-%5f17a83f5fbd9414006a5e563eab4c8a00729efd.patch
foo-%f3acbafac161ec68f1598af38f794f28847ca5d3.patch
# foo-%b-%R.patch
exporting patches:
foo-repo-2.patch
foo-repo-3.patch
foo-repo-4.patch
foo-repo-5.patch
foo-repo-6.patch
foo-repo-7.patch
foo-repo-8.patch
foo-repo-9.patch
foo-repo-10.patch
foo-repo-11.patch
# foo-%h.patch
exporting patches:
foo-617188a1c80f.patch
foo-dd41a5ff707a.patch
foo-f95a5410f866.patch
foo-4346bcfde53b.patch
foo-afda8c3a009c.patch
foo-35284ce2b6b9.patch
foo-9688c41894e6.patch
foo-747d3c68f8ec.patch
foo-5f17a83f5fbd.patch
foo-f3acbafac161.patch
# foo-%r.patch
exporting patches:
foo-02.patch
foo-03.patch
foo-04.patch
foo-05.patch
foo-06.patch
foo-07.patch
foo-08.patch
foo-09.patch
foo-10.patch
foo-11.patch
Andrzej Bieniek
export: add %m to file format string (first line of the commit message)...
r14986
# foo-%m.patch
exporting patches:
foo-foo_2.patch
foo-foo_3.patch
foo-foo_4.patch
foo-foo_5.patch
foo-foo_6.patch
foo-foo_7.patch
foo-foo_8.patch
foo-foo_9.patch
foo-foo_10.patch
foo-foo_11.patch
Adrian Buehlmann
tests: unify test-export
r12034
Augie Fackler
export: clobber files with -o (bc) (issue3652)...
r18613 Doing it again clobbers the files rather than appending:
$ hg export -v -o "foo-%m.patch" 2:3
exporting patches:
foo-foo_2.patch
foo-foo_3.patch
$ grep HG foo-foo_2.patch | wc -l
\s*1 (re)
$ grep HG foo-foo_3.patch | wc -l
\s*1 (re)
Adrian Buehlmann
tests: unify test-export
r12034 Exporting 4 changesets to a file:
$ hg export -o export_internal 1 2 3 4
Matt Mackall
tests: drop a bunch of sed calls from unified tests
r12366 $ grep HG export_internal | wc -l
Matt Mackall
tests: various fixes for new unified test pattern format
r12377 \s*4 (re)
Adrian Buehlmann
tests: unify test-export
r12034
Augie Fackler
export: clobber files with -o (bc) (issue3652)...
r18613 Doing it again clobbers the file rather than appending:
$ hg export -o export_internal 1 2 3 4
$ grep HG export_internal | wc -l
\s*4 (re)
Exporting 4 changesets to stdout:
Adrian Buehlmann
tests: unify test-export
r12034
Matt Mackall
tests: drop a bunch of sed calls from unified tests
r12366 $ hg export 1 2 3 4 | grep HG | wc -l
Matt Mackall
tests: various fixes for new unified test pattern format
r12377 \s*4 (re)
Adrian Buehlmann
tests: unify test-export
r12034
Exporting revision -2 to a file:
$ hg export -- -2
# HG changeset patch
# User test
# Date 0 0
Mads Kiilerich
export: show 'Date' header in a format that also is readable for humans...
r18648 # Thu Jan 01 00:00:00 1970 +0000
Adrian Buehlmann
tests: unify test-export
r12034 # Node ID 5f17a83f5fbd9414006a5e563eab4c8a00729efd
# Parent 747d3c68f8ec44bb35816bfcd59aeb50b9654c2f
foo-10
diff -r 747d3c68f8ec -r 5f17a83f5fbd foo
--- a/foo Thu Jan 01 00:00:00 1970 +0000
+++ b/foo Thu Jan 01 00:00:00 1970 +0000
@@ -8,3 +8,4 @@
foo-7
foo-8
foo-9
+foo-10
Yuya Nishihara
export: map wctx.node() to 'ff...' node id (issue5438)
r32660 Exporting wdir revision:
$ echo "foo-wdir" >> foo
$ hg export 'wdir()'
# HG changeset patch
# User test
# Date 0 0
# Thu Jan 01 00:00:00 1970 +0000
# Node ID ffffffffffffffffffffffffffffffffffffffff
# Parent f3acbafac161ec68f1598af38f794f28847ca5d3
diff -r f3acbafac161 foo
--- a/foo Thu Jan 01 00:00:00 1970 +0000
+++ b/foo Thu Jan 01 00:00:00 1970 +0000
@@ -10,3 +10,4 @@
foo-9
foo-10
foo-11
+foo-wdir
$ hg revert -q foo
Yuya Nishihara
export: do not print '<fdopen>' as an output filename...
r27416 No filename should be printed if stdout is specified explicitly:
$ hg export -v 1 -o -
Yuya Nishihara
cmdutil: do not duplicate stdout by makefileobj()...
r27419 exporting patch:
Yuya Nishihara
export: do not print '<fdopen>' as an output filename...
r27416 # HG changeset patch
# User test
# Date 0 0
# Thu Jan 01 00:00:00 1970 +0000
# Node ID d1c9656e973cfb5aebd5499bbd2cb350e3b12266
# Parent 871558de6af2e8c244222f8eea69b782c94ce3df
foo-1
diff -r 871558de6af2 -r d1c9656e973c foo
--- a/foo Thu Jan 01 00:00:00 1970 +0000
+++ b/foo Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +1,2 @@
foo-0
+foo-1
Andrzej Bieniek
export: add %m to file format string (first line of the commit message)...
r14986 Checking if only alphanumeric characters are used in the file name (%m option):
$ echo "line" >> foo
Augie Fackler
test-export: be more aggressive about quoting ^...
r29516 $ hg commit -m " !\"#$%&(,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]"'^'"_\`abcdefghijklmnopqrstuvwxyz{|}~"
Andrzej Bieniek
export: add %m to file format string (first line of the commit message)...
r14986 $ hg export -v -o %m.patch tip
exporting patch:
Yuya Nishihara
cmdutil: strip "%m" pattern (first line of commit message) from both ends...
r36525 ___________0123456789_______ABCDEFGHIJKLMNOPQRSTUVWXYZ______abcdefghijklmnopqrstuvwxyz____.patch
Andrzej Bieniek
export: add %m to file format string (first line of the commit message)...
r14986
Yuya Nishihara
cmdutil: expand filename format string by templater (BC)...
r36528 Template fragments in file name:
$ hg export -v -o '{node|shortest}.patch' tip
exporting patch:
197e.patch
Backslash should be preserved because it is a directory separator on Windows:
$ mkdir out
$ hg export -v -o 'out\{node|shortest}.patch' tip
exporting patch:
out\197e.patch
Still backslash is taken as an escape character in inner template strings:
$ hg export -v -o '{"out\{foo}.patch"}' tip
exporting patch:
out{foo}.patch
Yuya Nishihara
cmdutil: narrow scope of KeyError in makefilename()...
r36257 Invalid pattern in file name:
$ hg export -o '%x.patch' tip
abort: invalid format spec '%x' in output filename
[255]
Yuya Nishihara
cmdutil: expand filename format string by templater (BC)...
r36528 $ hg export -o '%' tip
abort: incomplete format spec in output filename
[255]
$ hg export -o '%{"foo"}' tip
abort: incomplete format spec in output filename
[255]
$ hg export -o '%m{' tip
hg: parse error at 3: unterminated template expansion
Ryan McElroy
templater: add hint to template parse errors to help locate issues...
r36687 (%m{
Yuya Nishihara
templater: fix position of terminator character in error message...
r36709 ^ here)
Yuya Nishihara
cmdutil: expand filename format string by templater (BC)...
r36528 [255]
$ hg export -o '%\' tip
abort: invalid format spec '%\' in output filename
[255]
$ hg export -o '\%' tip
abort: incomplete format spec in output filename
[255]
Yuya Nishihara
cmdutil: narrow scope of KeyError in makefilename()...
r36257
Thomas Arendsen Hein
export: catch exporting empty revsets (issue3353)...
r16357 Catch exporting unknown revisions (especially empty revsets, see issue3353)
$ hg export
Mads Kiilerich
export: export working directory parent by default...
r18956 # HG changeset patch
# User test
# Date 0 0
# Thu Jan 01 00:00:00 1970 +0000
# Node ID 197ecd81a57f760b54f34a58817ad5b04991fa47
# Parent f3acbafac161ec68f1598af38f794f28847ca5d3
!"#$%&(,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
diff -r f3acbafac161 -r 197ecd81a57f foo
--- a/foo Thu Jan 01 00:00:00 1970 +0000
+++ b/foo Thu Jan 01 00:00:00 1970 +0000
@@ -10,3 +10,4 @@
foo-9
foo-10
foo-11
+line
Thomas Arendsen Hein
export: catch exporting empty revsets (issue3353)...
r16357 $ hg export ""
hg: parse error: empty query
[255]
$ hg export 999
abort: unknown revision '999'!
[255]
$ hg export "not all()"
abort: export requires at least one changeset
[255]
Mads Kiilerich
tests: add missing trailing 'cd ..'...
r16913
Ankur Dahiya
color: enabled color support for export command (issue1507)...
r17460 Check for color output
Yuya Nishihara
tests: write hgrc of more than two lines by using shell heredoc...
r23172 $ cat <<EOF >> $HGRCPATH
> [color]
> mode = ansi
> [extensions]
> color =
> EOF
Ankur Dahiya
color: enabled color support for export command (issue1507)...
r17460
$ hg export --color always --nodates tip
# HG changeset patch
# User test
# Date 0 0
Mads Kiilerich
export: show 'Date' header in a format that also is readable for humans...
r18648 # Thu Jan 01 00:00:00 1970 +0000
Ankur Dahiya
color: enabled color support for export command (issue1507)...
r17460 # Node ID * (glob)
# Parent * (glob)
!"#$%&(,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
\x1b[0;1mdiff -r f3acbafac161 -r 197ecd81a57f foo\x1b[0m (esc)
\x1b[0;31;1m--- a/foo\x1b[0m (esc)
\x1b[0;32;1m+++ b/foo\x1b[0m (esc)
\x1b[0;35m@@ -10,3 +10,4 @@\x1b[0m (esc)
foo-9
foo-10
foo-11
\x1b[0;32m+line\x1b[0m (esc)
Mads Kiilerich
tests: add missing trailing 'cd ..'...
r16913 $ cd ..