Mercurial > hg
annotate tests/test-editor-filename.t @ 37295:45b39c69fae0
wireproto: separate commands tables for version 1 and 2 commands
We can't easily reuse existing command handlers for version 2
commands because the response types will be different. e.g. many
commands return nodes encoded as hex. Our new wire protocol is
binary safe, so we'll wish to encode nodes as binary.
We /could/ teach each command handler to look at the protocol
handler and change behavior based on the version in use. However,
this would make logic a bit unwieldy over time and would make
it harder to design a unified protocol handler interface. I think
it's better to create a clean break between version 1 and version 2
of commands on the server.
What I imagine happening is we will have separate @wireprotocommand
functions for each protocol generation. Those functions will parse the
request, dispatch to a common function to process it, then generate
the response in its own, transport-specific manner.
This commit establishes a separate table for tracking version 1
commands from version 2 commands. The HTTP server pieces have been
updated to use this new table.
Most commands are marked as both version 1 and version 2, so there is
little practical impact to this change.
A side-effect of this change is we now rely on transport registration
in wireprototypes.TRANSPORTS and certain properties of the protocol
interface. So a test had to be updated to conform.
Differential Revision: https://phab.mercurial-scm.org/D2982
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 28 Mar 2018 10:40:41 -0700 |
parents | 4bf1889456f3 |
children | f802a75da585 |
rev | line source |
---|---|
34029
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
1 Test temp file used with an editor has the expected suffix. |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
2 |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
3 $ hg init |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
4 |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
5 Create an editor that writes its arguments to stdout and set it to $HGEDITOR. |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
6 |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
7 $ cat > editor.sh << EOF |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
8 > echo "\$@" |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
9 > exit 1 |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
10 > EOF |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
11 $ hg add editor.sh |
34058
4bf1889456f3
test-editor-filename: fix portability of fake editor command
Yuya Nishihara <yuya@tcha.org>
parents:
34054
diff
changeset
|
12 $ HGEDITOR="sh $TESTTMP/editor.sh" |
34029
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
13 $ export HGEDITOR |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
14 |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
15 Verify that the path for a commit editor has the expected suffix. |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
16 |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
17 $ hg commit |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
18 *.commit.hg.txt (glob) |
34058
4bf1889456f3
test-editor-filename: fix portability of fake editor command
Yuya Nishihara <yuya@tcha.org>
parents:
34054
diff
changeset
|
19 abort: edit failed: sh exited with status 1 |
34029
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
20 [255] |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
21 |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
22 Verify that the path for a histedit editor has the expected suffix. |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
23 |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
24 $ cat >> $HGRCPATH <<EOF |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
25 > [extensions] |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
26 > rebase= |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
27 > histedit= |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
28 > EOF |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
29 $ hg commit --message 'At least one commit for histedit.' |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
30 $ hg histedit |
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
31 *.histedit.hg.txt (glob) |
34058
4bf1889456f3
test-editor-filename: fix portability of fake editor command
Yuya Nishihara <yuya@tcha.org>
parents:
34054
diff
changeset
|
32 abort: edit failed: sh exited with status 1 |
34029
6e6452bc441d
editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff
changeset
|
33 [255] |
34054
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
34 |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
35 Verify that when performing an action that has the side-effect of creating an |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
36 editor for a diff, the file ends in .diff. |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
37 |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
38 $ echo 1 > one |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
39 $ echo 2 > two |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
40 $ hg add |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
41 adding one |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
42 adding two |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
43 $ hg commit --interactive --config ui.interactive=true --config ui.interface=text << EOF |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
44 > y |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
45 > e |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
46 > q |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
47 > EOF |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
48 diff --git a/one b/one |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
49 new file mode 100644 |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
50 examine changes to 'one'? [Ynesfdaq?] y |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
51 |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
52 @@ -0,0 +1,1 @@ |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
53 +1 |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
54 record change 1/2 to 'one'? [Ynesfdaq?] e |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
55 |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
56 *.diff (glob) |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
57 editor exited with exit code 1 |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
58 record change 1/2 to 'one'? [Ynesfdaq?] q |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
59 |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
60 abort: user quit |
3c82b14d2838
editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents:
34029
diff
changeset
|
61 [255] |