Debian Codegraph @

tests/test-editor-filename.t

raw
1 Test temp file used with an editor has the expected suffix.
2
3 $ hg init repo
4 $ cd repo
5
6 Create an editor that writes its arguments to stdout and set it to $HGEDITOR.
7
8 $ cat > editor.sh << EOF
9 > echo "\$@"
10 > exit 1
11 > EOF
12 $ hg add editor.sh
13 $ HGEDITOR="sh $TESTTMP/repo/editor.sh"
14 $ export HGEDITOR
15
16 Verify that the path for a commit editor has the expected suffix.
17
18 $ hg commit
19 *.commit.hg.txt (glob)
20 abort: edit failed: sh exited with status 1
21 [250]
22
23 Verify that the path for a histedit editor has the expected suffix.
24
25 $ cat >> $HGRCPATH <<EOF
26 > [extensions]
27 > rebase=
28 > histedit=
29 > EOF
30 $ hg commit --message 'At least one commit for histedit.'
31 $ hg histedit
32 *.histedit.hg.txt (glob)
33 abort: edit failed: sh exited with status 1
34 [250]
35
36 Verify that when performing an action that has the side-effect of creating an
37 editor for a diff, the file ends in .diff.
38
39 $ echo 1 > one
40 $ echo 2 > two
41 $ hg add
42 adding one
43 adding two
44 $ hg commit --interactive --config ui.interactive=true --config ui.interface=text << EOF
45 > y
46 > e
47 > q
48 > EOF
49 diff --git a/one b/one
50 new file mode 100644
51 examine changes to 'one'?
52 (enter ? for help) [Ynesfdaq?] y
53
54 @@ -0,0 +1,1 @@
55 +1
56 record change 1/2 to 'one'?
57 (enter ? for help) [Ynesfdaq?] e
58
59 *.diff (glob)
60 editor exited with exit code 1
61 record change 1/2 to 'one'?
62 (enter ? for help) [Ynesfdaq?] q
63
64 abort: user quit
65 [250]