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

r39525:f1186c29 default
r39595:07b58266 default
Show More
test-issue1175.t
97 lines | 2.1 KiB | text/troff | Tads3Lexer
Matt Mackall
urls: bulk-change BTS urls to new location
r26420 https://bz.mercurial-scm.org/1175
Adrian Buehlmann
tests: unify test-issue*
r12195
$ hg init
$ touch a
$ hg ci -Am0
adding a
$ hg mv a a1
$ hg ci -m1
$ hg co 0
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg mv a a2
$ hg up
Dan Villiom Podlaski Christiansen
merge: make 'diverging renames' diagnostic a more helpful note....
r12757 note: possible conflict - a was renamed multiple times to:
Adrian Buehlmann
tests: unify test-issue*
r12195 a2
a1
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg ci -m2
$ touch a
$ hg ci -Am3
adding a
$ hg mv a b
$ hg ci -Am4 a
$ hg ci --debug --traceback -Am5 b
Mads Kiilerich
localrepo: show headline notes in commitctx before showing filenames...
r23749 committing files:
Adrian Buehlmann
tests: unify test-issue*
r12195 b
Ryan McElroy
commit: remove reverse search for copy source when not in parent (issue4476)...
r23929 warning: can't find ancestor for 'b' copied from 'a'!
Mads Kiilerich
localrepo: show headline notes in commitctx before showing filenames...
r23749 committing manifest
committing changelog
Pierre-Yves David
caches: move the 'updating the branch cache' message in 'updatecaches'...
r32267 updating the branch cache
Ryan McElroy
commit: remove reverse search for copy source when not in parent (issue4476)...
r23929 committed changeset 5:83a687e8a97c80992ba385bbfd766be181bfb1d1
Adrian Buehlmann
tests: unify test-issue*
r12195
$ hg verify
checking changesets
checking manifests
crosschecking files in changesets and manifests
checking files
Meirambek Omyrzak
verify: make output less confusing (issue5924)...
r39525 checked 6 changesets with 4 changes to 4 files
Adrian Buehlmann
tests: unify test-issue*
r12195
$ hg export --git tip
# HG changeset patch
# User test
# Date 0 0
Mads Kiilerich
export: show 'Date' header in a format that also is readable for humans...
r18648 # Thu Jan 01 00:00:00 1970 +0000
Ryan McElroy
commit: remove reverse search for copy source when not in parent (issue4476)...
r23929 # Node ID 83a687e8a97c80992ba385bbfd766be181bfb1d1
Matt Mackall
setparents: drop copies from dropped p2 (issue3843)
r18739 # Parent 1d1625283f71954f21d14c3d44d0ad3c019c597f
Adrian Buehlmann
tests: unify test-issue*
r12195 5
diff --git a/b b/b
new file mode 100644
av6
tests: update bugzilla link in test-issue1175.t
r29680 https://bz.mercurial-scm.org/show_bug.cgi?id=4476
Ryan McElroy
commit: remove reverse search for copy source when not in parent (issue4476)...
r23929
$ hg init foo
$ cd foo
$ touch a && hg ci -Aqm a
$ hg mv a b
$ echo b1 >> b
$ hg ci -Aqm b1
$ hg up 0
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg mv a b
$ echo b2 >> b
$ hg ci -Aqm b2
$ hg graft 1
grafting 1:5974126fad84 "b1"
merging b
Siddharth Agarwal
simplemerge: move conflict warning message to filemerge...
r26614 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
Ryan McElroy
commit: remove reverse search for copy source when not in parent (issue4476)...
r23929 abort: unresolved conflicts, can't continue
timeless
graft: use single quotes around command hint...
r28963 (use 'hg resolve' and 'hg graft --continue')
Ryan McElroy
commit: remove reverse search for copy source when not in parent (issue4476)...
r23929 [255]
$ echo a > b
$ echo b3 >> b
$ hg resolve --mark b
(no more unresolved files)
timeless
graft: hook afterresolvedstates
r27625 continue: hg graft --continue
Ryan McElroy
commit: remove reverse search for copy source when not in parent (issue4476)...
r23929 $ hg graft --continue
grafting 1:5974126fad84 "b1"
warning: can't find ancestor for 'b' copied from 'a'!
$ hg log -f b -T 'changeset: {rev}:{node|short}\nsummary: {desc}\n\n'
changeset: 3:376d30ccffc0
summary: b1
changeset: 2:416baaa2e5e4
summary: b2
changeset: 0:3903775176ed
summary: a