##// END OF EJS Templates
sslutil: require TLS 1.1+ when supported...
sslutil: require TLS 1.1+ when supported Currently, Mercurial will use TLS 1.0 or newer when connecting to remote servers, selecting the highest TLS version supported by both peers. On older Pythons, only TLS 1.0 is available. On newer Pythons, TLS 1.1 and 1.2 should be available. Security professionals recommend avoiding TLS 1.0 if possible. PCI DSS 3.1 "strongly encourages" the use of TLS 1.2. Known attacks like BEAST and POODLE exist against TLS 1.0 (although mitigations are available and properly configured servers aren't vulnerable). I asked Eric Rescorla - Mozilla's resident crypto expert - whether Mercurial should drop support for TLS 1.0. His response was "if you can get away with it." Essentially, a number of servers on the Internet don't support TLS 1.1+. This is why web browsers continue to support TLS 1.0 despite desires from security experts. This patch changes Mercurial's default behavior on modern Python versions to require TLS 1.1+, thus avoiding known security issues with TLS 1.0 and making Mercurial more secure by default. Rather than drop TLS 1.0 support wholesale, we still allow TLS 1.0 to be used if configured. This is a compromise solution - ideally we'd disallow TLS 1.0. However, since we're not sure how many Mercurial servers don't support TLS 1.1+ and we're not sure how much user inconvenience this change will bring, I think it is prudent to ship an escape hatch that still allows usage of TLS 1.0. In the default case our users get better security. In the worst case, they are no worse off than before this patch. This patch has no effect when running on Python versions that don't support TLS 1.1+. As the added test shows, connecting to a server that doesn't support TLS 1.1+ will display a warning message with a link to our wiki, where we can guide people to configure their client to allow less secure connections.

File last commit:

r28388:b1d35e2e stable
r29560:303e9300 default
Show More
test-mq-qimport.t
342 lines | 7.0 KiB | text/troff | Tads3Lexer
/ tests / test-mq-qimport.t
Matt Mackall
tests: replace exit 80 with #require
r22046 #require killdaemons
Matt Mackall
tests: unify test-mq-qimport
r12464
$ cat > writelines.py <<EOF
> import sys
> path = sys.argv[1]
> args = sys.argv[2:]
> assert (len(args) % 2) == 0
>
> f = file(path, 'wb')
> for i in xrange(len(args)/2):
> count, s = args[2*i:2*i+2]
> count = int(count)
> s = s.decode('string_escape')
> f.write(s*count)
> f.close()
>
> EOF
Yuya Nishihara
tests: write hgrc of more than two lines by using shell heredoc...
r23172 > cat <<EOF >> $HGRCPATH
> [extensions]
> mq =
> [diff]
> git = 1
> EOF
Matt Mackall
tests: unify test-mq-qimport
r12464 $ hg init repo
$ cd repo
Thomas Arendsen Hein
mq: abort if no files or revisions are specified for qimport
r16987 qimport without file or revision
$ hg qimport
abort: no files or revisions specified
[255]
Matt Mackall
tests: unify test-mq-qimport
r12464 qimport non-existing-file
$ hg qimport non-existing-file
abort: unable to read file non-existing-file
[255]
Patrick Mezard
context: make changectx.mutable() benefit from .phase() logic...
r16359 qimport null revision
$ hg qimport -r null
abort: revision -1 is not mutable
(see "hg help phases" for details)
[255]
$ hg qseries
Matt Mackall
tests: unify test-mq-qimport
r12464 import email
$ hg qimport --push -n email - <<EOF
> From: Username in email <test@example.net>
> Subject: [PATCH] Message in email
> Date: Fri, 02 Jan 1970 00:00:00 +0000
>
> Text before patch.
>
> # HG changeset patch
> # User Username in patch <test@example.net>
> # Date 0 0
> # Node ID 1a706973a7d84cb549823634a821d9bdf21c6220
> # Parent 0000000000000000000000000000000000000000
> First line of commit message.
>
> More text in commit message.
> --- confuse the diff detection
>
> diff --git a/x b/x
> new file mode 100644
> --- /dev/null
> +++ b/x
> @@ -0,0 +1,1 @@
> +new file
> Text after patch.
>
> EOF
adding email to series file
applying email
now at: email
hg tip -v
$ hg tip -v
changeset: 0:1a706973a7d8
tag: email
tag: qbase
tag: qtip
tag: tip
user: Username in patch <test@example.net>
date: Thu Jan 01 00:00:00 1970 +0000
files: x
description:
First line of commit message.
More text in commit message.
$ hg qpop
popping email
patch queue now empty
$ hg qdelete email
import URL
$ echo foo >> foo
$ hg add foo
Mads Kiilerich
tests: remove the last traces of $HGTMP...
r12642 $ hg diff > url.diff
Matt Mackall
tests: unify test-mq-qimport
r12464 $ hg revert --no-backup foo
$ rm foo
Under unix: file:///foobar/blah
Under windows: file:///c:/foobar/blah
Mads Kiilerich
tests: remove the last traces of $HGTMP...
r12642 $ patchurl=`pwd | tr '\\\\' /`/url.diff
Matt Mackall
tests: unify test-mq-qimport
r12464 $ expr "$patchurl" : "\/" > /dev/null || patchurl="/$patchurl"
$ hg qimport file://"$patchurl"
adding url.diff to series file
Mads Kiilerich
tests: remove the last traces of $HGTMP...
r12642 $ rm url.diff
Matt Mackall
tests: unify test-mq-qimport
r12464 $ hg qun
url.diff
import patch that already exists
$ echo foo2 >> foo
$ hg add foo
$ hg diff > ../url.diff
$ hg revert --no-backup foo
$ rm foo
$ hg qimport ../url.diff
abort: patch "url.diff" already exists
[255]
$ hg qpush
applying url.diff
now at: url.diff
$ cat foo
foo
$ hg qpop
popping url.diff
patch queue now empty
qimport -f
$ hg qimport -f ../url.diff
adding url.diff to series file
$ hg qpush
applying url.diff
now at: url.diff
$ cat foo
foo2
$ hg qpop
popping url.diff
patch queue now empty
build diff with CRLF
$ python ../writelines.py b 5 'a\n' 5 'a\r\n'
$ hg ci -Am addb
adding b
$ python ../writelines.py b 2 'a\n' 10 'b\n' 2 'a\r\n'
$ hg diff > b.diff
$ hg up -C
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
qimport CRLF diff
$ hg qimport b.diff
adding b.diff to series file
$ hg qpush
applying b.diff
now at: b.diff
try to import --push
Patrick Mezard
mq: make qimport --push push all imported patches (issue3130)...
r16119 $ cat > appendfoo.diff <<EOF
> append foo
Mads Kiilerich
check-code: fix check for trailing whitespace on continued lines too...
r17347 >
Patrick Mezard
mq: make qimport --push push all imported patches (issue3130)...
r16119 > diff -r 07f494440405 -r 261500830e46 baz
> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
> +++ b/baz Thu Jan 01 00:00:00 1970 +0000
> @@ -0,0 +1,1 @@
> +foo
> EOF
$ cat > appendbar.diff <<EOF
> append bar
Mads Kiilerich
check-code: fix check for trailing whitespace on continued lines too...
r17347 >
Patrick Mezard
mq: make qimport --push push all imported patches (issue3130)...
r16119 > diff -r 07f494440405 -r 261500830e46 baz
> --- a/baz Thu Jan 01 00:00:00 1970 +0000
> +++ b/baz Thu Jan 01 00:00:00 1970 +0000
> @@ -1,1 +1,2 @@
> foo
> +bar
> EOF
$ hg qimport --push appendfoo.diff appendbar.diff
adding appendfoo.diff to series file
adding appendbar.diff to series file
applying appendfoo.diff
applying appendbar.diff
now at: appendbar.diff
Matt Mackall
tests: unify test-mq-qimport
r12464 $ hg qfin -a
patch b.diff finalized without changeset message
Mads Kiilerich
mq: generate patch names from first line of description...
r26736 $ touch .hg/patches/append_foo
Matt Mackall
qimport: record imported revs incrementally (issue3874)...
r21965 $ hg qimport -r 'p1(.)::'
$ hg qapplied
Mads Kiilerich
mq: check for reserved patch name with qimport -r (issue5033)...
r27919 append_foo__1
Mads Kiilerich
mq: generate patch names from first line of description...
r26736 append_bar
Matt Mackall
qimport: record imported revs incrementally (issue3874)...
r21965 $ hg qfin -a
Mads Kiilerich
mq: generate patch names from first line of description...
r26736 $ rm .hg/patches/append_foo
Patrick Mezard
mq: make qimport --push push all imported patches (issue3130)...
r16119 $ hg qimport -r 'p1(.)::' -P
Matt Mackall
tests: unify test-mq-qimport
r12464 $ hg qpop -a
Mads Kiilerich
mq: generate patch names from first line of description...
r26736 popping append_bar
popping append_foo
Matt Mackall
tests: unify test-mq-qimport
r12464 patch queue now empty
Mads Kiilerich
mq: generate patch names from first line of description...
r26736 $ hg qdel append_foo
$ hg qdel -k append_bar
Matt Mackall
tests: unify test-mq-qimport
r12464
qimport -e
Mads Kiilerich
mq: generate patch names from first line of description...
r26736 $ hg qimport -e append_bar
adding append_bar to series file
$ hg qdel -k append_bar
Matt Mackall
tests: unify test-mq-qimport
r12464
qimport -e --name newname oldexisitingpatch
Mads Kiilerich
mq: generate patch names from first line of description...
r26736 $ hg qimport -e --name this-name-is-better append_bar
renaming append_bar to this-name-is-better
Matt Mackall
tests: unify test-mq-qimport
r12464 adding this-name-is-better to series file
$ hg qser
this-name-is-better
url.diff
qimport -e --name without --force
$ cp .hg/patches/this-name-is-better .hg/patches/3.diff
$ hg qimport -e --name this-name-is-better 3.diff
abort: patch "this-name-is-better" already exists
[255]
$ hg qser
this-name-is-better
url.diff
qimport -e --name with --force
$ hg qimport --force -e --name this-name-is-better 3.diff
renaming 3.diff to this-name-is-better
adding this-name-is-better to series file
$ hg qser
this-name-is-better
url.diff
Idan Kamara
mq: check patch name is valid before reading imported file
r14395
qimport with bad name, should abort before reading file
timeless@mozdev.org
spelling: nonexistent
r17492 $ hg qimport non-existent-file --name .hg
Idan Kamara
mq: check patch name is valid before reading imported file
r14395 abort: patch name cannot begin with ".hg"
[255]
Idan Kamara
mq: strip all leading slashes from url when importing...
r14396
qimport http:// patch with leading slashes in url
set up hgweb
$ cd ..
$ hg init served
$ cd served
$ echo a > a
$ hg ci -Am patch
adding a
$ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
$ cat hg.pid >> $DAEMON_PIDS
$ cd ../repo
$ hg qimport http://localhost:$HGPORT/raw-rev/0///
adding 0 to series file
Pierre-Yves David
qimport: when mq.secret=True set qimported revision as secret
r16027
check qimport phase:
$ hg -q qpush
now at: 0
$ hg phase qparent
1: draft
$ hg qimport -r qparent
$ hg phase qbase
1: draft
$ hg qfinish qbase
$ echo '[mq]' >> $HGRCPATH
$ echo 'secret=true' >> $HGRCPATH
$ hg qimport -r qparent
$ hg phase qbase
1: secret
Mads Kiilerich
tests: add missing trailing 'cd ..'...
r16913
$ cd ..
Patrick Mezard
tests: enable even more Windows server tests
r17565
Matt Mackall
tests: drop DAEMON_PIDS from killdaemons calls
r25474 $ killdaemons.py
FUJIWARA Katsunori
mq: use fallback patch name if no alpha-numeric in summary line (issue5025)...
r27513
check patch name generation for non-alpha-numeric summary line
$ cd repo
$ hg qpop -a -q
patch queue now empty
$ hg qseries -v
0 U imported_patch_b_diff
1 U 0
2 U this-name-is-better
3 U url.diff
$ echo bb >> b
$ hg commit -m '==++--=='
$ hg qimport -r tip
$ hg qseries -v
0 A 1.diff
1 U imported_patch_b_diff
2 U 0
3 U this-name-is-better
4 U url.diff
Mads Kiilerich
mq: check for reserved patch name with qimport -r (issue5033)...
r27919
check reserved patch names
$ hg qpop -qa
patch queue now empty
$ echo >> b
$ hg commit -m 'status'
$ echo >> b
$ hg commit -m '.'
$ echo >> b
$ hg commit -m 'taken'
$ mkdir .hg/patches/taken
$ touch .hg/patches/taken__1
$ hg qimport -r -3::
$ hg qap
1.diff__1
2.diff
taken__2
Pierre-Yves David
mq: restrict generated patch name to 75 characters (issue5117)...
r28388 check very long patch name
$ hg qpop -qa
patch queue now empty
$ echo >> b
$ hg commit -m 'abcdefghi pqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi pqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi pqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi pqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi pqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi pqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
$ hg qimport -r .
$ hg qap
abcdefghi_pqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghi_pqrstuvwxyzabcdefg