##// END OF EJS Templates
https: support tls sni (server name indication) for https urls (issue3090)...
https: support tls sni (server name indication) for https urls (issue3090) SNI is a common way of sharing servers across multiple domains using separate SSL certificates. As of Python 2.7.9 SSLContext has been backported from Python 3. This patch changes sslutil's ssl_wrap_socket to use SSLContext and take a server hostname as and argument. It also changes the url module to make use of this argument. The new code for 2.7.9 achieves it's task by attempting to get the SSLContext object from the ssl module. If this fails the try/except goes back to what was there before with the exception that the ssl_wrap_socket functions take a server_hostname argument that doesn't get used. Assuming the SSLContext exists, the arguments to wrap_socket at the module level are emulated on the SSLContext. The SSLContext is initialized with the specified ssl_version. If certfile is not None load_cert_chain is called with certfile and keyfile. keyfile being None is not a problem, load_cert_chain will simply expect the private key to be in the certificate file. verify_mode is set to cert_reqs. If ca_certs is not None load_verify_locations is called with ca_certs as the cafile. Finally the wrap_socket method of the SSLContext is called with the socket and server hostname. Finally, this fails test-check-commit-hg.t because the "new" function ssl_wrap_socket has underscores in its names and underscores in its arguments. All the underscore identifiers are taken from the other functions and as such can't be changed to match naming conventions.

File last commit:

r21930:a5168eb9 stable
r23834:bf07c19b default
Show More
test-histedit-edit.t
345 lines | 8.7 KiB | text/troff | Tads3Lexer
/ tests / test-histedit-edit.t
Mads Kiilerich
tests: convert histedit tests to .t...
r17085 $ . "$TESTDIR/histedit-helpers.sh"
$ cat >> $HGRCPATH <<EOF
> [extensions]
> histedit=
> EOF
$ initrepo ()
> {
> hg init r
> cd r
> for x in a b c d e f ; do
> echo $x > $x
> hg add $x
> hg ci -m $x
> done
> }
$ initrepo
log before edit
$ hg log --graph
@ changeset: 5:652413bf663e
| tag: tip
| user: test
| date: Thu Jan 01 00:00:00 1970 +0000
| summary: f
|
o changeset: 4:e860deea161a
| user: test
| date: Thu Jan 01 00:00:00 1970 +0000
| summary: e
|
o changeset: 3:055a42cdd887
| user: test
| date: Thu Jan 01 00:00:00 1970 +0000
| summary: d
|
o changeset: 2:177f92b77385
| user: test
| date: Thu Jan 01 00:00:00 1970 +0000
| summary: c
|
o changeset: 1:d2ae7f538514
| user: test
| date: Thu Jan 01 00:00:00 1970 +0000
| summary: b
|
o changeset: 0:cb9a9f314b8b
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: a
edit the history
Pierre-Yves David
histedit-test: generalise --commands "-" usage...
r19019 $ hg histedit 177f92b77385 --commands - 2>&1 << EOF| fixbundle
> pick 177f92b77385 c
> pick 055a42cdd887 d
> edit e860deea161a e
> pick 652413bf663e f
> EOF
Mads Kiilerich
tests: convert histedit tests to .t...
r17085 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
Augie Fackler
histedit: switch from util.Abort to util.InterventionRequired where appropriate (bc)
r18934 Make changes as needed, you may commit or record as needed now.
Mads Kiilerich
tests: convert histedit tests to .t...
r17085 When you are finished, run hg histedit --continue to resume.
Pierre-Yves David
histedit: simplify computation of `newchildren` during --continue...
r17749 Go at a random point and try to continue
$ hg id -n
3+
$ hg up 0
Matt Mackall
histedit: add checkunfinished support (issue3955)...
r19479 abort: histedit in progress
(use 'hg histedit --continue' or 'hg histedit --abort')
Pierre-Yves David
histedit: simplify computation of `newchildren` during --continue...
r17749 [255]
Matt Mackall
checkunfinished: accommodate histedit quirk...
r19496 commit, then edit the revision
$ hg ci -m 'wat'
Mads Kiilerich
tests: convert histedit tests to .t...
r17085 created new head
$ echo a > e
Mads Kiilerich
tests: make histedit pass on Windows MSYS...
r17087 $ HGEDITOR='echo foobaz > ' hg histedit --continue 2>&1 | fixbundle
Mads Kiilerich
tests: convert histedit tests to .t...
r17085 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg log --graph
Pierre-Yves David
histedit: record histedit source (issue3681)...
r18437 @ changeset: 6:b5f70786f9b0
Mads Kiilerich
tests: convert histedit tests to .t...
r17085 | tag: tip
| user: test
| date: Thu Jan 01 00:00:00 1970 +0000
| summary: f
|
Pierre-Yves David
histedit: record histedit source (issue3681)...
r18437 o changeset: 5:a5e1ba2f7afb
Mads Kiilerich
tests: convert histedit tests to .t...
r17085 | user: test
| date: Thu Jan 01 00:00:00 1970 +0000
| summary: foobaz
|
o changeset: 4:1a60820cd1f6
| user: test
| date: Thu Jan 01 00:00:00 1970 +0000
| summary: wat
|
o changeset: 3:055a42cdd887
| user: test
| date: Thu Jan 01 00:00:00 1970 +0000
| summary: d
|
o changeset: 2:177f92b77385
| user: test
| date: Thu Jan 01 00:00:00 1970 +0000
| summary: c
|
o changeset: 1:d2ae7f538514
| user: test
| date: Thu Jan 01 00:00:00 1970 +0000
| summary: b
|
o changeset: 0:cb9a9f314b8b
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: a
$ hg cat e
a
Pierre-Yves David
histedit: record histedit source (issue3681)...
r18437 check histedit_source
$ hg log --debug --rev 5
changeset: 5:a5e1ba2f7afb899ef1581cea528fd885d2fca70d
phase: draft
parent: 4:1a60820cd1f6004a362aa622ebc47d59bc48eb34
parent: -1:0000000000000000000000000000000000000000
manifest: 5:5ad3be8791f39117565557781f5464363b918a45
user: test
date: Thu Jan 01 00:00:00 1970 +0000
files: e
extra: branch=default
extra: histedit_source=e860deea161a2f77de56603b340ebbb4536308ae
description:
foobaz
Pierre-Yves David
histedit-test: generalise --commands "-" usage...
r19019 $ hg histedit tip --commands - 2>&1 <<EOF| fixbundle
Pierre-Yves David
histedit: record histedit source (issue3681)...
r18437 > edit b5f70786f9b0 f
Mads Kiilerich
tests: convert histedit tests to .t...
r17085 > EOF
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
Augie Fackler
histedit: switch from util.Abort to util.InterventionRequired where appropriate (bc)
r18934 Make changes as needed, you may commit or record as needed now.
Mads Kiilerich
tests: convert histedit tests to .t...
r17085 When you are finished, run hg histedit --continue to resume.
$ hg status
A f
Bryan O'Sullivan
summary: add tests for some extensions we plan to modify
r19213
$ hg summary
parent: 5:a5e1ba2f7afb
foobaz
branch: default
commit: 1 added (new branch head)
update: 1 new changesets (update)
Bryan O'Sullivan
summary: add a histedit hook
r19215 hist: 1 remaining (histedit --continue)
Bryan O'Sullivan
summary: add tests for some extensions we plan to modify
r19213
FUJIWARA Katsunori
histedit: use "getcommiteditor()" instead of explicit editor choice for "--continue"...
r21409 (test also that editor is invoked if histedit is continued for
"edit" action)
$ HGEDITOR='cat' hg histedit --continue
f
HG: Enter commit message. Lines beginning with 'HG:' are removed.
HG: Leave message empty to abort commit.
HG: --
HG: user: test
HG: branch 'default'
HG: added f
Mads Kiilerich
tests: convert histedit tests to .t...
r17085 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
Pierre-Yves David
histedit: record histedit source (issue3681)...
r18437 saved backup bundle to $TESTTMP/r/.hg/strip-backup/b5f70786f9b0-backup.hg (glob)
Mads Kiilerich
tests: convert histedit tests to .t...
r17085 $ hg status
log after edit
$ hg log --limit 1
Pierre-Yves David
histedit: record histedit source (issue3681)...
r18437 changeset: 6:a107ee126658
Mads Kiilerich
tests: convert histedit tests to .t...
r17085 tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: f
say we'll change the message, but don't.
$ cat > ../edit.sh <<EOF
Mads Kiilerich
tests: make histedit tests more resilient to filesystem variation...
r17086 > cat "\$1" | sed s/pick/mess/ > tmp
> mv tmp "\$1"
Mads Kiilerich
tests: convert histedit tests to .t...
r17085 > EOF
Mads Kiilerich
tests: make histedit tests more resilient to filesystem variation...
r17086 $ HGEDITOR="sh ../edit.sh" hg histedit tip 2>&1 | fixbundle
Mads Kiilerich
tests: convert histedit tests to .t...
r17085 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg status
$ hg log --limit 1
Pierre-Yves David
histedit: record histedit source (issue3681)...
r18437 changeset: 6:1fd3b2fe7754
Mads Kiilerich
tests: convert histedit tests to .t...
r17085 tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: f
modify the message
FUJIWARA Katsunori
histedit: save manually edited commit message into ".hg/last-message.txt"...
r21028
check saving last-message.txt, at first
$ cat > $TESTTMP/commitfailure.py <<EOF
> from mercurial import util
> def reposetup(ui, repo):
> class commitfailure(repo.__class__):
> def commit(self, *args, **kwargs):
> raise util.Abort('emulating unexpected abort')
> repo.__class__ = commitfailure
> EOF
FUJIWARA Katsunori
histedit: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21233 $ cat >> .hg/hgrc <<EOF
FUJIWARA Katsunori
histedit: save manually edited commit message into ".hg/last-message.txt"...
r21028 > [extensions]
FUJIWARA Katsunori
histedit: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21233 > # this failure occurs before editor invocation
FUJIWARA Katsunori
histedit: save manually edited commit message into ".hg/last-message.txt"...
r21028 > commitfailure = $TESTTMP/commitfailure.py
> EOF
$ cat > $TESTTMP/editor.sh <<EOF
> echo "==== before editing"
> cat \$1
> echo "===="
> echo "check saving last-message.txt" >> \$1
> EOF
FUJIWARA Katsunori
histedit: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21233
(test that editor is not invoked before transaction starting)
$ rm -f .hg/last-message.txt
$ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit tip --commands - 2>&1 << EOF | fixbundle
> mess 1fd3b2fe7754 f
> EOF
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
abort: emulating unexpected abort
Danek Duvall
tests: cat error messages are different on Solaris
r21930 $ test -f .hg/last-message.txt
FUJIWARA Katsunori
histedit: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21233 [1]
$ cat >> .hg/hgrc <<EOF
> [extensions]
> commitfailure = !
> EOF
$ hg histedit --abort -q
(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
FUJIWARA Katsunori
histedit: use the editor gotten by "getcommiteditor()" for "message"...
r21407 $ hg status --rev '1fd3b2fe7754^1' --rev 1fd3b2fe7754
A f
FUJIWARA Katsunori
histedit: save manually edited commit message into ".hg/last-message.txt"...
r21028 $ rm -f .hg/last-message.txt
FUJIWARA Katsunori
histedit: use the editor gotten by "getcommiteditor()" for "message"...
r21407 $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit tip --commands - 2>&1 << EOF
FUJIWARA Katsunori
histedit: save manually edited commit message into ".hg/last-message.txt"...
r21028 > mess 1fd3b2fe7754 f
> EOF
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
FUJIWARA Katsunori
histedit: use the editor gotten by "getcommiteditor()" for "message"...
r21407 adding f
FUJIWARA Katsunori
histedit: save manually edited commit message into ".hg/last-message.txt"...
r21028 ==== before editing
f
FUJIWARA Katsunori
histedit: use the editor gotten by "getcommiteditor()" for "message"...
r21407
HG: Enter commit message. Lines beginning with 'HG:' are removed.
HG: Leave message empty to abort commit.
HG: --
HG: user: test
HG: branch 'default'
HG: added f
FUJIWARA Katsunori
histedit: save manually edited commit message into ".hg/last-message.txt"...
r21028 ====
FUJIWARA Katsunori
histedit: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21233 transaction abort!
rollback completed
note: commit message saved in .hg/last-message.txt
abort: pretxncommit.unexpectedabort hook exited with status 1
FUJIWARA Katsunori
histedit: use the editor gotten by "getcommiteditor()" for "message"...
r21407 [255]
FUJIWARA Katsunori
histedit: save manually edited commit message into ".hg/last-message.txt"...
r21028 $ cat .hg/last-message.txt
f
FUJIWARA Katsunori
histedit: use the editor gotten by "getcommiteditor()" for "message"...
r21407
FUJIWARA Katsunori
histedit: save manually edited commit message into ".hg/last-message.txt"...
r21028 check saving last-message.txt
FUJIWARA Katsunori
histedit: use "getcommiteditor()" instead of explicit editor choice for "--continue"...
r21409 (test also that editor is invoked if histedit is continued for "message"
action)
$ HGEDITOR=cat hg histedit --continue
f
HG: Enter commit message. Lines beginning with 'HG:' are removed.
HG: Leave message empty to abort commit.
HG: --
HG: user: test
HG: branch 'default'
HG: added f
transaction abort!
rollback completed
note: commit message saved in .hg/last-message.txt
abort: pretxncommit.unexpectedabort hook exited with status 1
[255]
FUJIWARA Katsunori
histedit: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21233 $ cat >> .hg/hgrc <<EOF
> [hooks]
> pretxncommit.unexpectedabort =
FUJIWARA Katsunori
histedit: save manually edited commit message into ".hg/last-message.txt"...
r21028 > EOF
$ hg histedit --abort -q
then, check "modify the message" itself
Pierre-Yves David
histedit-test: generalise --commands "-" usage...
r19019 $ hg histedit tip --commands - 2>&1 << EOF | fixbundle
Pierre-Yves David
histedit: record histedit source (issue3681)...
r18437 > mess 1fd3b2fe7754 f
Mads Kiilerich
tests: convert histedit tests to .t...
r17085 > EOF
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg status
$ hg log --limit 1
Pierre-Yves David
histedit-test: generalise --commands "-" usage...
r19019 changeset: 6:62feedb1200e
Mads Kiilerich
tests: convert histedit tests to .t...
r17085 tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
Pierre-Yves David
histedit-test: generalise --commands "-" usage...
r19019 summary: f
Mads Kiilerich
tests: convert histedit tests to .t...
r17085
rollback should not work after a histedit
$ hg rollback
no rollback information available
[1]
$ cd ..
Bryan O'Sullivan
histedit: support editing of the first commit (issue3767)
r18913 $ hg clone -qr0 r r0
$ cd r0
$ hg phase -fdr0
Pierre-Yves David
histedit-test: generalise --commands "-" usage...
r19019 $ hg histedit --commands - 0 2>&1 << EOF
> edit cb9a9f314b8b a > $EDITED
> EOF
Bryan O'Sullivan
histedit: support editing of the first commit (issue3767)
r18913 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
adding a
Matt Mackall
histedit: update tests for new intervention framework
r18942 Make changes as needed, you may commit or record as needed now.
Bryan O'Sullivan
histedit: support editing of the first commit (issue3767)
r18913 When you are finished, run hg histedit --continue to resume.
Matt Mackall
histedit: update tests for new intervention framework
r18942 [1]
Bryan O'Sullivan
histedit: support editing of the first commit (issue3767)
r18913 $ HGEDITOR=true hg histedit --continue
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
saved backup bundle to $TESTTMP/r0/.hg/strip-backup/cb9a9f314b8b-backup.hg (glob)