##// END OF EJS Templates
cat: test output path behvaior when target path does not exist...
Ryan McElroy -
r35009:8154119e default
parent child Browse files
Show More
@@ -1,121 +1,132 b''
1 1 $ hg init
2 2 $ echo 0 > a
3 3 $ echo 0 > b
4 4 $ hg ci -A -m m
5 5 adding a
6 6 adding b
7 7 $ hg rm a
8 8 $ hg cat a
9 9 0
10 10 $ hg cat --decode a # more tests in test-encode
11 11 0
12 12 $ echo 1 > b
13 13 $ hg ci -m m
14 14 $ echo 2 > b
15 15 $ hg cat -r 0 a
16 16 0
17 17 $ hg cat -r 0 b
18 18 0
19 19 $ hg cat -r 1 a
20 20 a: no such file in rev 7040230c159c
21 21 [1]
22 22 $ hg cat -r 1 b
23 23 1
24 24
25 25 Test multiple files
26 26
27 27 $ echo 3 > c
28 28 $ hg ci -Am addmore c
29 29 $ hg cat b c
30 30 1
31 31 3
32 32 $ hg cat .
33 33 1
34 34 3
35 35 $ hg cat . c
36 36 1
37 37 3
38 38
39 39 Test fileset
40 40
41 41 $ hg cat 'set:not(b) or a'
42 42 3
43 43 $ hg cat 'set:c or b'
44 44 1
45 45 3
46 46
47 47 $ mkdir tmp
48 48 $ hg cat --output tmp/HH_%H c
49 49 $ hg cat --output tmp/RR_%R c
50 50 $ hg cat --output tmp/h_%h c
51 51 $ hg cat --output tmp/r_%r c
52 52 $ hg cat --output tmp/%s_s c
53 53 $ hg cat --output tmp/%d%%_d c
54 54 $ hg cat --output tmp/%p_p c
55 55 $ hg log -r . --template "{rev}: {node|short}\n"
56 56 2: 45116003780e
57 57 $ find tmp -type f | sort
58 58 tmp/.%_d
59 59 tmp/HH_45116003780e3678b333fb2c99fa7d559c8457e9
60 60 tmp/RR_2
61 61 tmp/c_p
62 62 tmp/c_s
63 63 tmp/h_45116003780e
64 64 tmp/r_2
65 65
66 66 Test template output
67 67
68 68 $ hg --cwd tmp cat ../b ../c -T '== {path} ({abspath}) ==\n{data}'
69 69 == ../b (b) == (glob)
70 70 1
71 71 == ../c (c) == (glob)
72 72 3
73 73
74 74 $ hg cat b c -Tjson --output -
75 75 [
76 76 {
77 77 "abspath": "b",
78 78 "data": "1\n",
79 79 "path": "b"
80 80 },
81 81 {
82 82 "abspath": "c",
83 83 "data": "3\n",
84 84 "path": "c"
85 85 }
86 86 ]
87 87
88 88 $ hg cat b c -Tjson --output 'tmp/%p.json'
89 89 $ cat tmp/b.json
90 90 [
91 91 {
92 92 "abspath": "b",
93 93 "data": "1\n",
94 94 "path": "b"
95 95 }
96 96 ]
97 97 $ cat tmp/c.json
98 98 [
99 99 {
100 100 "abspath": "c",
101 101 "data": "3\n",
102 102 "path": "c"
103 103 }
104 104 ]
105 105
106 106 Test working directory
107 107
108 108 $ echo b-wdir > b
109 109 $ hg cat -r 'wdir()' b
110 110 b-wdir
111 111
112 112 Environment variables are not visible by default
113 113
114 114 $ PATTERN='t4' hg log -r '.' -T "{ifcontains('PATTERN', envvars, 'yes', 'no')}\n"
115 115 no
116 116
117 117 Environment variable visibility can be explicit
118 118
119 119 $ PATTERN='t4' hg log -r '.' -T "{envvars % '{key} -> {value}\n'}" \
120 120 > --config "experimental.exportableenviron=PATTERN"
121 121 PATTERN -> t4
122
123 Test behavior of output when directory structure does not already exist
124
125 $ mkdir foo
126 $ echo a > foo/a
127 $ hg add foo/a
128 $ hg commit -qm "add foo/a"
129 $ mkdir output
130 $ hg cat --output "output/%p" foo/a
131 abort: No such file or directory: output/foo/a
132 [255]
General Comments 0
You need to be logged in to leave comments. Login now