Mercurial > hg
annotate tests/test-push-cgi.t @ 26750:9f9ec4abe700
cmdutil: make in-memory changes visible to external editor (issue4378)
Before this patch, external editor process for the commit log can't
view some in-memory changes (especially, of dirstate), because they
aren't written out until the end of transaction (or wlock).
This causes unexpected output of Mercurial commands spawned from that
editor process.
To make in-memory changes visible to external editor process, this
patch does:
- write (or schedule to write) in-memory dirstate changes, and
- set HG_PENDING environment variable, if:
- a transaction is running, and
- there are in-memory changes to be visible
"hg diff" spawned from external editor process for "hg qrefresh"
shows:
- "changes newly imported into the topmost" before 49148d7868df(*)
- "all changes recorded in the topmost by refreshing" after this patch
(*) 49148d7868df changed steps invoking editor process
Even though backward compatibility may be broken, the latter behavior
looks reasonable, because "hg diff" spawned from the editor process
consistently shows "what changes new revision records" regardless of
invocation context.
In fact, issue4378 itself should be resolved by 800e090e9c64, which
made 'repo.transaction()' write in-memory dirstate changes out
explicitly before starting transaction. It also made "hg qrefresh"
imply 'dirstate.write()' before external editor invocation in call
chain below.
- mq.queue.refresh
- strip.strip
- repair.strip
- localrepository.transaction
- dirstate.write
- localrepository.commit
- invoke external editor
Though, this patch has '(issue4378)' in own summary line to indicate
that issues like issue4378 should be fixed by this.
BTW, this patch adds '-m' option to a 'hg ci --amend' execution in
'test-commit-amend.t', to avoid invoking external editor process.
In this case, "unsure" states may be changed to "clean" according to
timestamp or so on. These changes should be written into pending file,
if external editor invocation is required,
Then, writing dirstate changes out breaks stability of test, because
it shows "transaction abort!/rollback completed" occasionally.
Aborting after editor process invocation while commands below may
cause similar instability of tests, too (AFAIK, there is no more such
one, at this revision)
- commit --amend
- without --message/--logfile
- import
- without --message/--logfile,
- without --no-commit,
- without --bypass,
- one of below, and
- patch has no description text, or
- with --edit
- aborting at the 1st patch, which adds or removes file(s)
- if it only changes existing files, status is checked only for
changed files by 'scmutil.matchfiles()', and transition from
"unsure" to "normal" in dirstate doesn't occur (= dirstate
isn't changed, and written out)
- aborting at the 2nd or later patch implies other pending
changes (e.g. changelog), and always causes showing
"transaction abort!/rollback completed"
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sat, 17 Oct 2015 01:15:34 +0900 |
parents | 7a9cbb315d84 |
children | c739b1e4b203 |
rev | line source |
---|---|
22046
7a9cbb315d84
tests: replace exit 80 with #require
Matt Mackall <mpm@selenic.com>
parents:
18957
diff
changeset
|
1 #require no-msys # MSYS will translate web paths as if they were file paths |
15567
8b84d040d9f9
tests: introduce 'hghave msys' to skip tests that would fail because of msys
Mads Kiilerich <mads@kiilerich.com>
parents:
13946
diff
changeset
|
2 |
13397
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
3 This is a test of the push wire protocol over CGI-based hgweb. |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
4 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
5 initialize repository |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
6 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
7 $ hg init r |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
8 $ cd r |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
9 $ echo a > a |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
10 $ hg ci -A -m "0" |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
11 adding a |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
12 $ echo '[web]' > .hg/hgrc |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
13 $ echo 'allow_push = *' >> .hg/hgrc |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
14 $ echo 'push_ssl = false' >> .hg/hgrc |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
15 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
16 create hgweb invocation script |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
17 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
18 $ cat >hgweb.cgi <<HGWEB |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
19 > import cgitb |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
20 > cgitb.enable() |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
21 > from mercurial import demandimport; demandimport.enable() |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
22 > from mercurial.hgweb import hgweb |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
23 > from mercurial.hgweb import wsgicgi |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
24 > application = hgweb('.', 'test repository') |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
25 > wsgicgi.launch(application) |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
26 > HGWEB |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
27 $ chmod 755 hgweb.cgi |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
28 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
29 test preparation |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
30 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
31 $ . "$TESTDIR/cgienv" |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
32 $ REQUEST_METHOD="POST"; export REQUEST_METHOD |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
33 $ CONTENT_TYPE="application/octet-stream"; export CONTENT_TYPE |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
34 $ hg bundle --all bundle.hg |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
35 1 changesets found |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
36 $ CONTENT_LENGTH=279; export CONTENT_LENGTH; |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
37 |
18957
6b618aa08b6e
wireproto: clarify cryptic 'remote: unsynced changes' error message on push
Mads Kiilerich <madski@unity3d.com>
parents:
18346
diff
changeset
|
38 expect failure because heads doesn't match (formerly known as 'unsynced changes') |
13397
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
39 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
40 $ QUERY_STRING="cmd=unbundle&heads=0000000000000000000000000000000000000000"; export QUERY_STRING |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
41 $ python hgweb.cgi <bundle.hg >page1 2>&1 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
42 $ cat page1 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
43 Status: 200 Script output follows\r (esc) |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
44 Content-Type: application/mercurial-0.1\r (esc) |
18957
6b618aa08b6e
wireproto: clarify cryptic 'remote: unsynced changes' error message on push
Mads Kiilerich <madski@unity3d.com>
parents:
18346
diff
changeset
|
45 Content-Length: 64\r (esc) |
13397
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
46 \r (esc) |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
47 0 |
18957
6b618aa08b6e
wireproto: clarify cryptic 'remote: unsynced changes' error message on push
Mads Kiilerich <madski@unity3d.com>
parents:
18346
diff
changeset
|
48 repository changed while preparing changes - please try again |
13397
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
49 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
50 successful force push |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
51 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
52 $ QUERY_STRING="cmd=unbundle&heads=666f726365"; export QUERY_STRING |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
53 $ python hgweb.cgi <bundle.hg >page2 2>&1 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
54 $ cat page2 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
55 Status: 200 Script output follows\r (esc) |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
56 Content-Type: application/mercurial-0.1\r (esc) |
18346
6c2563b2c1c6
hgweb: use Content-Length for pushres
Mads Kiilerich <mads@kiilerich.com>
parents:
16913
diff
changeset
|
57 Content-Length: 102\r (esc) |
13397
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
58 \r (esc) |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
59 1 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
60 adding changesets |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
61 adding manifests |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
62 adding file changes |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
63 added 0 changesets with 0 changes to 1 files |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
64 |
13946
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
65 successful push, list of heads |
13397
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
66 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
67 $ QUERY_STRING="cmd=unbundle&heads=f7b1eb17ad24730a1651fccd46c43826d1bbc2ac"; export QUERY_STRING |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
68 $ python hgweb.cgi <bundle.hg >page3 2>&1 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
69 $ cat page3 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
70 Status: 200 Script output follows\r (esc) |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
71 Content-Type: application/mercurial-0.1\r (esc) |
18346
6c2563b2c1c6
hgweb: use Content-Length for pushres
Mads Kiilerich <mads@kiilerich.com>
parents:
16913
diff
changeset
|
72 Content-Length: 102\r (esc) |
13397
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
73 \r (esc) |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
74 1 |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
75 adding changesets |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
76 adding manifests |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
77 adding file changes |
6f9616a46f7c
tests: push wire protocol over CGI-based hgweb
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
78 added 0 changesets with 0 changes to 1 files |
13946
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
79 |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
80 successful push, SHA1 hash of heads (unbundlehash capability) |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
81 |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
82 $ QUERY_STRING="cmd=unbundle&heads=686173686564 5a785a5f9e0d433b88ed862b206b011b0c3a9d13"; export QUERY_STRING |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
83 $ python hgweb.cgi <bundle.hg >page4 2>&1 |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
84 $ cat page4 |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
85 Status: 200 Script output follows\r (esc) |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
86 Content-Type: application/mercurial-0.1\r (esc) |
18346
6c2563b2c1c6
hgweb: use Content-Length for pushres
Mads Kiilerich <mads@kiilerich.com>
parents:
16913
diff
changeset
|
87 Content-Length: 102\r (esc) |
13946
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
88 \r (esc) |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
89 1 |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
90 adding changesets |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
91 adding manifests |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
92 adding file changes |
3c2f9f611ef6
tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents:
13397
diff
changeset
|
93 added 0 changesets with 0 changes to 1 files |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
15567
diff
changeset
|
94 |
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
15567
diff
changeset
|
95 $ cd .. |