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

r35386:469b06b4 default
r39595:07b58266 default
Show More
test-rebase-detach.t
317 lines | 5.5 KiB | text/troff | Tads3Lexer
/ tests / test-rebase-detach.t
Adrian Buehlmann
tests: unify test-rebase*
r12608 $ cat >> $HGRCPATH <<EOF
> [extensions]
> rebase=
>
> [alias]
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 > tglog = log -G --template "{rev}: {node|short} '{desc}'\n"
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 >
> [extensions]
> drawdag=$TESTDIR/drawdag.py
Adrian Buehlmann
tests: unify test-rebase*
r12608 > EOF
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 Rebasing D onto B detaching from C (one commit):
Adrian Buehlmann
tests: unify test-rebase*
r12608
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 $ hg init a1
Adrian Buehlmann
tests: unify test-rebase*
r12608 $ cd a1
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 $ hg debugdrawdag <<EOF
> D
> |
> C B
> |/
> A
> EOF
$ hg phase --force --secret D
$ hg rebase -s D -d B
rebasing 3:e7b3f00ed42e "D" (D tip)
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/e7b3f00ed42e-6f368371-rebase.hg
Adrian Buehlmann
tests: unify test-rebase*
r12608
Alain Leufroy <alain.leufroyATgmailMYDOTcom>
rebase: fix phases movement...
r15917 $ hg log -G --template "{rev}:{phase} '{desc}' {branches}\n"
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 o 3:secret 'D'
Adrian Buehlmann
tests: unify test-rebase*
r12608 |
Alain Leufroy <alain.leufroyATgmailMYDOTcom>
rebase: fix phases movement...
r15917 | o 2:draft 'C'
Adrian Buehlmann
tests: unify test-rebase*
r12608 | |
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 o | 1:draft 'B'
Adrian Buehlmann
tests: unify test-rebase*
r12608 |/
Alain Leufroy <alain.leufroyATgmailMYDOTcom>
rebase: fix phases movement...
r15917 o 0:draft 'A'
Adrian Buehlmann
tests: unify test-rebase*
r12608
Pierre-Yves David
tests: prepare rebase test for wc parent preservation...
r19924 $ hg manifest --rev tip
Adrian Buehlmann
tests: unify test-rebase*
r12608 A
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 B
Adrian Buehlmann
tests: unify test-rebase*
r12608 D
$ cd ..
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 Rebasing D onto B detaching from C (two commits):
$ hg init a2
$ cd a2
Adrian Buehlmann
tests: unify test-rebase*
r12608
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 $ hg debugdrawdag <<EOF
> E
> |
> D
> |
> C B
> |/
> A
> EOF
$ hg rebase -s D -d B
rebasing 3:e7b3f00ed42e "D" (D)
rebasing 4:69a34c08022a "E" (E tip)
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/e7b3f00ed42e-a2ec7cea-rebase.hg
Adrian Buehlmann
tests: unify test-rebase*
r12608
$ hg tglog
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o 4: ee79e0744528 'E'
Adrian Buehlmann
tests: unify test-rebase*
r12608 |
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o 3: 10530e1d72d9 'D'
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 |
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 | o 2: dc0947a82db8 'C'
Adrian Buehlmann
tests: unify test-rebase*
r12608 | |
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o | 1: 112478962961 'B'
Adrian Buehlmann
tests: unify test-rebase*
r12608 |/
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o 0: 426bada5c675 'A'
Adrian Buehlmann
tests: unify test-rebase*
r12608
Pierre-Yves David
tests: prepare rebase test for wc parent preservation...
r19924 $ hg manifest --rev tip
Adrian Buehlmann
tests: unify test-rebase*
r12608 A
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 B
D
E
$ cd ..
Rebasing C onto B using detach (same as not using it):
$ hg init a3
$ cd a3
$ hg debugdrawdag <<EOF
> D
> |
> C B
> |/
> A
> EOF
$ hg rebase -s C -d B
rebasing 2:dc0947a82db8 "C" (C)
rebasing 3:e7b3f00ed42e "D" (D tip)
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/dc0947a82db8-b8481714-rebase.hg
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560
$ hg tglog
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o 3: 7375f3dbfb0f 'D'
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 |
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o 2: bbfdd6cb49aa 'C'
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 |
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o 1: 112478962961 'B'
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 |
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o 0: 426bada5c675 'A'
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560
$ hg manifest --rev tip
A
B
Adrian Buehlmann
tests: unify test-rebase*
r12608 C
D
$ cd ..
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 Rebasing D onto B detaching from C and collapsing:
$ hg init a4
$ cd a4
$ hg debugdrawdag <<EOF
> E
> |
> D
> |
> C B
> |/
> A
> EOF
$ hg phase --force --secret E
$ hg rebase --collapse -s D -d B
rebasing 3:e7b3f00ed42e "D" (D)
rebasing 4:69a34c08022a "E" (E tip)
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 saved backup bundle to $TESTTMP/a4/.hg/strip-backup/e7b3f00ed42e-a2ec7cea-rebase.hg
Adrian Buehlmann
tests: unify test-rebase*
r12608
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 $ hg log -G --template "{rev}:{phase} '{desc}' {branches}\n"
o 3:secret 'Collapsed revision
| * D
| * E'
| o 2:draft 'C'
| |
o | 1:draft 'B'
|/
o 0:draft 'A'
$ hg manifest --rev tip
A
B
D
E
$ cd ..
Rebasing across null as ancestor
$ hg init a5
$ cd a5
$ hg debugdrawdag <<EOF
> E
> |
> D
> |
> C
> |
> A B
> EOF
$ hg rebase -s C -d B
rebasing 2:dc0947a82db8 "C" (C)
rebasing 3:e7b3f00ed42e "D" (D)
rebasing 4:69a34c08022a "E" (E tip)
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/dc0947a82db8-3eefec98-rebase.hg
Adrian Buehlmann
tests: unify test-rebase*
r12608
$ hg tglog
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o 4: e3d0c70d606d 'E'
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 |
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o 3: e9153d36a1af 'D'
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 |
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o 2: a7ac28b870a8 'C'
Adrian Buehlmann
tests: unify test-rebase*
r12608 |
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o 1: fc2b737bb2e5 'B'
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o 0: 426bada5c675 'A'
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560
$ hg rebase -d 1 -s 3
rebasing 3:e9153d36a1af "D"
rebasing 4:e3d0c70d606d "E" (tip)
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/e9153d36a1af-db7388ed-rebase.hg
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 $ hg tglog
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o 4: 2c24e540eccd 'E'
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 |
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o 3: 73f786ed52ff 'D'
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 |
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 | o 2: a7ac28b870a8 'C'
Nicolas Dumazet
tests: change test-rebase-detach to use bundle/rebase.hg
r14121 |/
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o 1: fc2b737bb2e5 'B'
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o 0: 426bada5c675 'A'
Adrian Buehlmann
tests: unify test-rebase*
r12608
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 $ cd ..
Verify that target is not selected as external rev (issue3085)
$ hg init a6
$ cd a6
Adrian Buehlmann
tests: unify test-rebase*
r12608
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 $ hg debugdrawdag <<EOF
> H
> | G
> |/|
> F E
> |/
> A
> EOF
$ hg up -q G
$ echo "I" >> E
$ hg ci -m "I"
$ hg tag --local I
$ hg merge H
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m "Merge"
$ echo "J" >> F
$ hg ci -m "J"
Adrian Buehlmann
tests: unify test-rebase*
r12608 $ hg tglog
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 @ 7: c6aaf0d259c0 'J'
Nicolas Dumazet
tests: change test-rebase-detach to use bundle/rebase.hg
r14121 |
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o 6: 0cfbc7e8faaf 'Merge'
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 |\
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 | o 5: b92d164ad3cb 'I'
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 | |
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o | 4: 4ea5b230dea3 'H'
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 | |
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 | o 3: c6001eacfde5 'G'
Nicolas Dumazet
tests: change test-rebase-detach to use bundle/rebase.hg
r14121 |/|
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o | 2: 8908a377a434 'F'
Nicolas Dumazet
tests: change test-rebase-detach to use bundle/rebase.hg
r14121 | |
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 | o 1: 7fb047a69f22 'E'
Nicolas Dumazet
tests: change test-rebase-detach to use bundle/rebase.hg
r14121 |/
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o 0: 426bada5c675 'A'
Adrian Buehlmann
tests: unify test-rebase*
r12608
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 $ hg rebase -s I -d H --collapse --config ui.merge=internal:other
rebasing 5:b92d164ad3cb "I" (I)
rebasing 6:0cfbc7e8faaf "Merge"
rebasing 7:c6aaf0d259c0 "J" (tip)
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 saved backup bundle to $TESTTMP/a6/.hg/strip-backup/b92d164ad3cb-88fd7ab7-rebase.hg
Adrian Buehlmann
tests: unify test-rebase*
r12608
$ hg tglog
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 @ 5: 65079693dac4 'Collapsed revision
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 | * I
| * Merge
| * J'
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o 4: 4ea5b230dea3 'H'
Henrik Stuart
rebase: support --detach when null is common ancestor
r13021 |
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 | o 3: c6001eacfde5 'G'
Nicolas Dumazet
tests: change test-rebase-detach to use bundle/rebase.hg
r14121 |/|
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o | 2: 8908a377a434 'F'
Nicolas Dumazet
tests: change test-rebase-detach to use bundle/rebase.hg
r14121 | |
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 | o 1: 7fb047a69f22 'E'
Nicolas Dumazet
tests: change test-rebase-detach to use bundle/rebase.hg
r14121 |/
Phil Cohen
tests: add commit hashes to log commands in rebase tests...
r35386 o 0: 426bada5c675 'A'
Henrik Stuart
rebase: support --detach when null is common ancestor
r13021
Pierre-Yves David
rebase: allow rebase to ancestor (issue3010)...
r15132
Pierre-Yves David
tests: prepare rebase test for wc parent preservation...
r19924 $ hg log --rev tip
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 changeset: 5:65079693dac4
Stefano Tortarolo
rebase: ensure target is not taken as external (issue3085)...
r15469 tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: Collapsed revision
$ cd ..
Alain Leufroy <alain.leufroyATgmailMYDOTcom>
rebase: fix phases movement...
r15917 Ensure --continue restores a correct state (issue3046) and phase:
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 $ hg init a7
Stefano Tortarolo
rebase: ensure target is not taken as external (issue3085)...
r15469 $ cd a7
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560
$ hg debugdrawdag <<EOF
> C B
> |/
> A
> EOF
$ hg up -q C
$ echo 'B2' > B
$ hg ci -A -m 'B2'
adding B
$ hg phase --force --secret .
$ hg rebase -s . -d B --config ui.merge=internal:fail
rebasing 3:17b4880d2402 "B2" (tip)
merging B
warning: conflicts while merging B! (edit, then use 'hg resolve --mark')
Augie Fackler
rebase: switch from util.Abort to util.InterventionRequired where appropriate (bc)
r18933 unresolved conflicts (see hg resolve, then hg rebase --continue)
Augie Fackler
dispatch: exit with status 1 for an InterventionRequired exception (bc)
r18935 [1]
Stefano Tortarolo
rebase: treat nullmerge as a special case in rebasestate (issue3046)...
r15464 $ hg resolve --all -t internal:local
Pierre-Yves David
resolve: add parenthesis around "no more unresolved files" message...
r21947 (no more unresolved files)
timeless
rebase: hook afterresolvedstates
r27626 continue: hg rebase --continue
Stefano Tortarolo
rebase: treat nullmerge as a special case in rebasestate (issue3046)...
r15464 $ hg rebase -c
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 rebasing 3:17b4880d2402 "B2" (tip)
note: rebase of 3:17b4880d2402 created no changes to commit
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/17b4880d2402-1ae1f6cc-rebase.hg
Alain Leufroy <alain.leufroyATgmailMYDOTcom>
rebase: fix phases movement...
r15917 $ hg log -G --template "{rev}:{phase} '{desc}' {branches}\n"
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 o 2:draft 'C'
Stefano Tortarolo
rebase: treat nullmerge as a special case in rebasestate (issue3046)...
r15464 |
Martin von Zweigbergk
tests: rewrite test-rebase-detach.t using drawdag...
r33560 | @ 1:draft 'B'
Stefano Tortarolo
rebase: treat nullmerge as a special case in rebasestate (issue3046)...
r15464 |/
Alain Leufroy <alain.leufroyATgmailMYDOTcom>
rebase: fix phases movement...
r15917 o 0:draft 'A'
Stefano Tortarolo
rebase: treat nullmerge as a special case in rebasestate (issue3046)...
r15464
Mads Kiilerich
tests: add missing trailing 'cd ..'...
r16913
$ cd ..