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

r27055:5a0ffa24 default
r29560:303e9300 default
Show More
test-mq-qrefresh-replace-log-message.t
326 lines | 7.6 KiB | text/troff | Tads3Lexer
/ tests / test-mq-qrefresh-replace-log-message.t
timeless@mozdev.org
spelling: Environment
r17478 Environment setup for MQ
Matt Mackall
tests: unify test-mq-qrefresh-replace-log-message
r12468
$ echo "[extensions]" >> $HGRCPATH
$ echo "mq=" >> $HGRCPATH
FUJIWARA Katsunori
cmdutil: make in-memory changes visible to external editor (issue4378)...
r26750 $ cat >> $HGRCPATH <<EOF
> [defaults]
> # explicit date to commit with fixed hashid
> qnew = -d "0 0"
> qrefresh = -d "0 0"
> qfold = -d "0 0"
> EOF
Matt Mackall
tests: unify test-mq-qrefresh-replace-log-message
r12468 $ hg init
$ hg qinit
Should fail if no patches applied
FUJIWARA Katsunori
mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)...
r21423 (this tests also that editor is not invoked if '--edit' is not
specified)
Matt Mackall
tests: unify test-mq-qrefresh-replace-log-message
r12468
$ hg qrefresh
no patches applied
[1]
$ hg qrefresh -e
no patches applied
[1]
$ hg qnew -m "First commit message" first-patch
$ echo aaaa > file
$ hg add file
FUJIWARA Katsunori
mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)...
r21423 $ HGEDITOR=cat hg qrefresh
Matt Mackall
tests: unify test-mq-qrefresh-replace-log-message
r12468
Should display 'First commit message'
$ hg log -l1 --template "{desc}\n"
First commit message
Testing changing message with -m
FUJIWARA Katsunori
cmdutil: make commit message shown in text editor customizable by template...
r21924 (this tests also that '--edit' can be used with '--message', and
that '[committemplate] changeset' definition and commit log specific
template keyword 'extramsg' work well)
$ cat >> .hg/hgrc <<EOF
> [committemplate]
FUJIWARA Katsunori
cmdutil: use '[committemplate]' section like as map file for style definition...
r22013 > listupfiles = {file_adds %
> "HG: added {file}\n" }{file_mods %
> "HG: changed {file}\n" }{file_dels %
> "HG: removed {file}\n" }{if(files, "",
> "HG: no files changed\n")}
>
FUJIWARA Katsunori
cmdutil: make commit message shown in text editor customizable by template...
r21924 > changeset = HG: this is customized commit template
> {desc}\n\n
> HG: Enter commit message. Lines beginning with 'HG:' are removed.
> HG: {extramsg}
> HG: --
> HG: user: {author}
FUJIWARA Katsunori
cmdutil: use '[committemplate]' section like as map file for style definition...
r22013 > HG: branch '{branch}'\n{listupfiles}
FUJIWARA Katsunori
cmdutil: make commit message shown in text editor customizable by template...
r21924 > EOF
Matt Mackall
tests: unify test-mq-qrefresh-replace-log-message
r12468
$ echo bbbb > file
FUJIWARA Katsunori
qrefresh: allow to specify '--message/'--logfile' and '--edit' at the same time...
r21713 $ HGEDITOR=cat hg qrefresh -m "Second commit message" -e
FUJIWARA Katsunori
cmdutil: make commit message shown in text editor customizable by template...
r21924 HG: this is customized commit template
FUJIWARA Katsunori
qrefresh: allow to specify '--message/'--logfile' and '--edit' at the same time...
r21713 Second commit message
HG: Enter commit message. Lines beginning with 'HG:' are removed.
HG: Leave message empty to use default message.
HG: --
HG: user: test
HG: branch 'default'
HG: added file
Matt Mackall
tests: unify test-mq-qrefresh-replace-log-message
r12468
FUJIWARA Katsunori
cmdutil: make commit message shown in text editor customizable by template...
r21924 $ cat >> .hg/hgrc <<EOF
> # disable customizing for subsequent tests
> [committemplate]
> changeset =
> EOF
Matt Mackall
tests: unify test-mq-qrefresh-replace-log-message
r12468 Should display 'Second commit message'
$ hg log -l1 --template "{desc}\n"
Second commit message
Testing changing message with -l
$ echo "Third commit message" > logfile
$ echo " This is the 3rd log message" >> logfile
$ echo bbbb > file
$ hg qrefresh -l logfile
Should display 'Third commit message\\\n This is the 3rd log message'
$ hg log -l1 --template "{desc}\n"
Third commit message
This is the 3rd log message
Testing changing message with -l-
$ hg qnew -m "First commit message" second-patch
$ echo aaaa > file2
$ hg add file2
$ echo bbbb > file2
$ (echo "Fifth commit message"; echo " This is the 5th log message") | hg qrefresh -l-
Should display 'Fifth commit message\\\n This is the 5th log message'
$ hg log -l1 --template "{desc}\n"
Fifth commit message
This is the 5th log message
FUJIWARA Katsunori
qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21236
Test saving last-message.txt:
$ cat > $TESTTMP/editor.sh << EOF
> echo "==== before editing"
> cat \$1
> echo "===="
> (echo; echo "test saving last-message.txt") >> \$1
> EOF
$ cat > $TESTTMP/commitfailure.py <<EOF
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 > from mercurial import error
FUJIWARA Katsunori
qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21236 > def reposetup(ui, repo):
> class commitfailure(repo.__class__):
> def commit(self, *args, **kwargs):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 > raise error.Abort('emulating unexpected abort')
FUJIWARA Katsunori
qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21236 > repo.__class__ = commitfailure
> EOF
$ cat >> .hg/hgrc <<EOF
> [extensions]
> # this failure occurs before editor invocation
> commitfailure = $TESTTMP/commitfailure.py
> EOF
$ hg qapplied
first-patch
second-patch
$ hg tip --template "{files}\n"
file2
(test that editor is not invoked before transaction starting)
$ rm -f .hg/last-message.txt
$ HGEDITOR="sh $TESTTMP/editor.sh" hg qrefresh -e
timeless@mozdev.org
mq: consistently use qrefresh
r26780 qrefresh interrupted while patch was popped! (revert --all, qpush to recover)
FUJIWARA Katsunori
qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21236 abort: emulating unexpected abort
[255]
Danek Duvall
tests: cat error messages are different on Solaris
r21930 $ test -f .hg/last-message.txt
FUJIWARA Katsunori
qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21236 [1]
(reset applied patches and directory status)
$ cat >> .hg/hgrc <<EOF
> [extensions]
> commitfailure = !
> EOF
$ hg qapplied
first-patch
$ hg status -A file2
? file2
$ rm file2
$ hg qpush -q second-patch
now at: second-patch
(test that editor is invoked and commit message is saved into
"last-message.txt")
$ cat >> .hg/hgrc <<EOF
> [hooks]
> # this failure occurs after editor invocation
> pretxncommit.unexpectedabort = false
> EOF
$ rm -f .hg/last-message.txt
FUJIWARA Katsunori
mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)...
r21423 $ hg status --rev "second-patch^1" -arm
A file2
FUJIWARA Katsunori
qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21236 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qrefresh -e
==== before editing
Fifth commit message
This is the 5th log message
FUJIWARA Katsunori
mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)...
r21423
HG: Enter commit message. Lines beginning with 'HG:' are removed.
HG: Leave message empty to use default message.
HG: --
HG: user: test
HG: branch 'default'
HG: added file2
FUJIWARA Katsunori
qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21236 ====
Laurent Charignon
localrepo: put bookmark move following commit in one transaction...
r26998 note: commit message saved in .hg/last-message.txt
FUJIWARA Katsunori
qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21236 transaction abort!
rollback completed
timeless@mozdev.org
mq: consistently use qrefresh
r26780 qrefresh interrupted while patch was popped! (revert --all, qpush to recover)
FUJIWARA Katsunori
qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21236 abort: pretxncommit.unexpectedabort hook exited with status 1
[255]
$ cat .hg/last-message.txt
Fifth commit message
This is the 5th log message
FUJIWARA Katsunori
mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)...
r21423
FUJIWARA Katsunori
qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21236 test saving last-message.txt
FUJIWARA Katsunori
cmdutil: make in-memory changes visible to external editor (issue4378)...
r26750
Test visibility of in-memory distate changes outside transaction to
external process
$ cat > $TESTTMP/checkvisibility.sh <<EOF
> echo "===="
> hg parents --template "{rev}:{node|short}\n"
> hg status -arm
> echo "===="
> EOF
== test visibility to external editor
$ hg update -C -q first-patch
$ rm -f file2
$ hg qpush -q second-patch --config hooks.pretxncommit.unexpectedabort=
now at: second-patch
$ echo bbbb >> file2
$ sh "$TESTTMP/checkvisibility.sh"
====
1:e30108269082
M file2
====
Matt Harbison
test-mq-qrefresh: drop single quoting of HGEDITOR value for Windows...
r27055 $ HGEDITOR="sh \"$TESTTMP/checkvisibility.sh\"" hg qrefresh -e
FUJIWARA Katsunori
cmdutil: make in-memory changes visible to external editor (issue4378)...
r26750 ====
0:25e397dabed2
A file2
====
Laurent Charignon
localrepo: put bookmark move following commit in one transaction...
r26998 note: commit message saved in .hg/last-message.txt
FUJIWARA Katsunori
cmdutil: make in-memory changes visible to external editor (issue4378)...
r26750 transaction abort!
rollback completed
timeless@mozdev.org
mq: consistently use qrefresh
r26780 qrefresh interrupted while patch was popped! (revert --all, qpush to recover)
FUJIWARA Katsunori
cmdutil: make in-memory changes visible to external editor (issue4378)...
r26750 abort: pretxncommit.unexpectedabort hook exited with status 1
[255]
(rebuilding at failure of qrefresh bases on rev #0, and it causes
dropping status of "file2")
$ sh "$TESTTMP/checkvisibility.sh"
====
0:25e397dabed2
====
FUJIWARA Katsunori
hook: centralize passing HG_PENDING to external hook process...
r26751
== test visibility to precommit external hook
$ hg update -C -q
$ rm -f file2
$ hg qpush -q second-patch --config hooks.pretxncommit.unexpectedabort=
now at: second-patch
$ echo bbbb >> file2
$ cat >> .hg/hgrc <<EOF
> [hooks]
> precommit.checkvisibility = sh "$TESTTMP/checkvisibility.sh"
> EOF
$ sh "$TESTTMP/checkvisibility.sh"
====
1:e30108269082
M file2
====
$ hg qrefresh
====
0:25e397dabed2
A file2
====
transaction abort!
rollback completed
timeless@mozdev.org
mq: consistently use qrefresh
r26780 qrefresh interrupted while patch was popped! (revert --all, qpush to recover)
FUJIWARA Katsunori
hook: centralize passing HG_PENDING to external hook process...
r26751 abort: pretxncommit.unexpectedabort hook exited with status 1
[255]
$ sh "$TESTTMP/checkvisibility.sh"
====
0:25e397dabed2
====
$ cat >> .hg/hgrc <<EOF
> [hooks]
> precommit.checkvisibility =
> EOF
== test visibility to pretxncommit external hook
$ hg update -C -q
$ rm -f file2
$ hg qpush -q second-patch --config hooks.pretxncommit.unexpectedabort=
now at: second-patch
$ echo bbbb >> file2
$ cat >> .hg/hgrc <<EOF
> [hooks]
> pretxncommit.checkvisibility = sh "$TESTTMP/checkvisibility.sh"
> # make checkvisibility run before unexpectedabort
> priority.pretxncommit.checkvisibility = 10
> EOF
$ sh "$TESTTMP/checkvisibility.sh"
====
1:e30108269082
M file2
====
$ hg qrefresh
====
0:25e397dabed2
A file2
====
transaction abort!
rollback completed
timeless@mozdev.org
mq: consistently use qrefresh
r26780 qrefresh interrupted while patch was popped! (revert --all, qpush to recover)
FUJIWARA Katsunori
hook: centralize passing HG_PENDING to external hook process...
r26751 abort: pretxncommit.unexpectedabort hook exited with status 1
[255]
$ sh "$TESTTMP/checkvisibility.sh"
====
0:25e397dabed2
====
$ cat >> .hg/hgrc <<EOF
> [hooks]
> pretxncommit.checkvisibility =
> EOF