##// END OF EJS Templates
wireprotov2: implement commands as a generator of objects...
wireprotov2: implement commands as a generator of objects Previously, wire protocol version 2 inherited version 1's model of having separate types to represent the results of different wire protocol commands. As I implemented more powerful commands in future commits, I found I was using a common pattern of returning a special type to hold a generator. This meant the command function required a closure to do most of the work. That made logic flow more difficult to follow. I also noticed that many commands were effectively a sequence of objects to be CBOR encoded. I think it makes sense to define version 2 commands as generators. This way, commands can simply emit the data structures they wish to send to the client. This eliminates the need for a closure in command functions and removes encoding from the bodies of commands. As part of this commit, the handling of response objects has been moved into the serverreactor class. This puts the reactor in the driver's seat with regards to CBOR encoding and error handling. Having error handling in the function that emits frames is particularly important because exceptions in that function can lead to things getting in a bad state: I'm fairly certain that uncaught exceptions in the frame generator were causing deadlocks. I also introduced a dedicated error type for explicit error reporting in command handlers. This will be used in subsequent commits. There's still a bit of work to be done here, especially around formalizing the error handling "protocol." I've added yet another TODO to track this so we don't forget. Test output changed because we're using generators and no longer know we are at the end of the data until we hit the end of the generator. This means we can't emit the end-of-stream flag until we've exhausted the generator. Hence the introduction of 0-sized end-of-stream frames. Differential Revision: https://phab.mercurial-scm.org/D4472

File last commit:

r28634:3ceac01b default
r39595:07b58266 default
Show More
test-histedit-non-commute-abort.t
165 lines | 4.5 KiB | text/troff | Tads3Lexer
/ tests / test-histedit-non-commute-abort.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
> echo a >> e
> hg ci -m 'does not commute with e'
> cd ..
> }
$ initrepo
$ cd r
log before edit
$ hg log --graph
@ changeset: 6:bfa474341cc9
| tag: tip
| user: test
| date: Thu Jan 01 00:00:00 1970 +0000
| summary: does not commute with e
|
o changeset: 5:652413bf663e
| 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
> pick bfa474341cc9 does not commute with e
> pick e860deea161a e
> pick 652413bf663e f
> EOF
Pierre-Yves David
histedit: replaces patching logic by merges...
r17647 merging e
Siddharth Agarwal
simplemerge: move conflict warning message to filemerge...
r26614 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
timeless
histedit: list action when intervention is required
r27629 Fix up the change (pick e860deea161a)
(hg histedit --continue to resume)
Mads Kiilerich
tests: convert histedit tests to .t...
r17085
Siddharth Agarwal
mergestate: handle additional record types specially...
r27027 insert unsupported advisory merge record
$ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -x
$ hg debugmergestate
* version 2 records
local: 8f7551c7e4a2f2efe0bc8c741baf7f227d65d758
other: e860deea161a2f77de56603b340ebbb4536308ae
Simon Farnsworth
merge: save merge part labels for later reuse...
r28634 labels:
local: local
other: histedit
Siddharth Agarwal
mergestate: handle additional record types specially...
r27027 unrecognized entry: x advisory record
Durham Goode
merge: add file ancestor linknode to mergestate...
r28011 file extras: e (ancestorlinknode = 0000000000000000000000000000000000000000)
Siddharth Agarwal
mergestate: handle additional record types specially...
r27027 file: e (record type "F", state "u", hash 58e6b3a414a1e090dfc6029add0f3555ccba127f)
local path: e (flags "")
Siddharth Agarwal
debugmergestate: print out null nodes as 'null'...
r27134 ancestor path: e (node null)
Siddharth Agarwal
mergestate: handle additional record types specially...
r27027 other path: e (node 6b67ccefd5ce6de77e7ead4f5292843a0255329f)
$ hg resolve -l
U e
Mads Kiilerich
tests: convert histedit tests to .t...
r17085
Siddharth Agarwal
mergestate: handle additional record types specially...
r27027 insert unsupported mandatory merge record
$ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -X
$ hg debugmergestate
* version 2 records
local: 8f7551c7e4a2f2efe0bc8c741baf7f227d65d758
other: e860deea161a2f77de56603b340ebbb4536308ae
Simon Farnsworth
merge: save merge part labels for later reuse...
r28634 labels:
local: local
other: histedit
Durham Goode
merge: add file ancestor linknode to mergestate...
r28011 file extras: e (ancestorlinknode = 0000000000000000000000000000000000000000)
Siddharth Agarwal
mergestate: handle additional record types specially...
r27027 file: e (record type "F", state "u", hash 58e6b3a414a1e090dfc6029add0f3555ccba127f)
local path: e (flags "")
Siddharth Agarwal
debugmergestate: print out null nodes as 'null'...
r27134 ancestor path: e (node null)
Siddharth Agarwal
mergestate: handle additional record types specially...
r27027 other path: e (node 6b67ccefd5ce6de77e7ead4f5292843a0255329f)
unrecognized entry: X mandatory record
$ hg resolve -l
abort: unsupported merge state records: X
(see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
[255]
$ hg resolve -ma
abort: unsupported merge state records: X
(see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
[255]
abort the edit (should clear out merge state)
Mads Kiilerich
tests: convert histedit tests to .t...
r17085 $ hg histedit --abort 2>&1 | fixbundle
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
Siddharth Agarwal
mergestate: handle additional record types specially...
r27027 $ hg debugmergestate
no merge state found
Mads Kiilerich
tests: convert histedit tests to .t...
r17085
log after abort
Pierre-Yves David
histedit: replaces patching logic by merges...
r17647 $ hg resolve -l
Mads Kiilerich
tests: convert histedit tests to .t...
r17085 $ hg log --graph
@ changeset: 6:bfa474341cc9
| tag: tip
| user: test
| date: Thu Jan 01 00:00:00 1970 +0000
| summary: does not commute with e
|
o changeset: 5:652413bf663e
| 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
$ cd ..