##// END OF EJS Templates
tests: Enable rhg fallback to Python by default in tests...
Simon Sapin -
r47457:a6553ba1 default
parent child Browse files
Show More
@@ -967,7 +967,6 b' class Test(unittest.TestCase):'
967 slowtimeout=None,
967 slowtimeout=None,
968 usechg=False,
968 usechg=False,
969 chgdebug=False,
969 chgdebug=False,
970 rhg_fallback_exe=None,
971 useipv6=False,
970 useipv6=False,
972 ):
971 ):
973 """Create a test from parameters.
972 """Create a test from parameters.
@@ -1025,7 +1024,6 b' class Test(unittest.TestCase):'
1025 self._hgcommand = hgcommand or b'hg'
1024 self._hgcommand = hgcommand or b'hg'
1026 self._usechg = usechg
1025 self._usechg = usechg
1027 self._chgdebug = chgdebug
1026 self._chgdebug = chgdebug
1028 self._rhg_fallback_exe = rhg_fallback_exe
1029 self._useipv6 = useipv6
1027 self._useipv6 = useipv6
1030
1028
1031 self._aborted = False
1029 self._aborted = False
@@ -1508,12 +1506,6 b' class Test(unittest.TestCase):'
1508 hgrc.write(b'ipv6 = %r\n' % self._useipv6)
1506 hgrc.write(b'ipv6 = %r\n' % self._useipv6)
1509 hgrc.write(b'server-header = testing stub value\n')
1507 hgrc.write(b'server-header = testing stub value\n')
1510
1508
1511 if self._rhg_fallback_exe:
1512 hgrc.write(b'[rhg]\n')
1513 hgrc.write(
1514 b'fallback-executable = %s\n' % self._rhg_fallback_exe
1515 )
1516
1517 for opt in self._extraconfigopts:
1509 for opt in self._extraconfigopts:
1518 section, key = _sys2bytes(opt).split(b'.', 1)
1510 section, key = _sys2bytes(opt).split(b'.', 1)
1519 assert b'=' in key, (
1511 assert b'=' in key, (
@@ -2999,7 +2991,6 b' class TestRunner(object):'
2999 self._coveragefile = None
2991 self._coveragefile = None
3000 self._createdfiles = []
2992 self._createdfiles = []
3001 self._hgcommand = None
2993 self._hgcommand = None
3002 self._rhg_fallback_exe = None
3003 self._hgpath = None
2994 self._hgpath = None
3004 self._portoffset = 0
2995 self._portoffset = 0
3005 self._ports = {}
2996 self._ports = {}
@@ -3140,10 +3131,17 b' class TestRunner(object):'
3140 chgbindir = os.path.dirname(os.path.realpath(self.options.with_chg))
3131 chgbindir = os.path.dirname(os.path.realpath(self.options.with_chg))
3141 self._hgcommand = os.path.basename(self.options.with_chg)
3132 self._hgcommand = os.path.basename(self.options.with_chg)
3142
3133
3143 # set fallback executable path, then replace "hg" command by "rhg"
3134 # configure fallback and replace "hg" command by "rhg"
3144 rhgbindir = self._bindir
3135 rhgbindir = self._bindir
3145 if self.options.rhg or self.options.with_rhg:
3136 if self.options.rhg or self.options.with_rhg:
3146 self._rhg_fallback_exe = os.path.join(self._bindir, self._hgcommand)
3137 # Affects configuration. Alternatives would be setting configuration through
3138 # `$HGRCPATH` but some tests override that, or changing `_hgcommand` to include
3139 # `--config` but that disrupts tests that print command lines and check expected
3140 # output.
3141 osenvironb[b'RHG_ON_UNSUPPORTED'] = b'fallback'
3142 osenvironb[b'RHG_FALLBACK_EXECUTABLE'] = os.path.join(
3143 self._bindir, self._hgcommand
3144 )
3147 if self.options.rhg:
3145 if self.options.rhg:
3148 self._hgcommand = b'rhg'
3146 self._hgcommand = b'rhg'
3149 elif self.options.with_rhg:
3147 elif self.options.with_rhg:
@@ -3477,7 +3475,6 b' class TestRunner(object):'
3477 hgcommand=self._hgcommand,
3475 hgcommand=self._hgcommand,
3478 usechg=bool(self.options.with_chg or self.options.chg),
3476 usechg=bool(self.options.with_chg or self.options.chg),
3479 chgdebug=self.options.chg_debug,
3477 chgdebug=self.options.chg_debug,
3480 rhg_fallback_exe=self._rhg_fallback_exe,
3481 useipv6=useipv6,
3478 useipv6=useipv6,
3482 **kwds
3479 **kwds
3483 )
3480 )
@@ -11,8 +11,10 b' Define an rhg function that will only ru'
11 > fi
11 > fi
12 > }
12 > }
13
13
14 $ NO_FALLBACK="env RHG_ON_UNSUPPORTED=abort"
15
14 Unimplemented command
16 Unimplemented command
15 $ rhg unimplemented-command
17 $ $NO_FALLBACK rhg unimplemented-command
16 unsupported feature: error: Found argument 'unimplemented-command' which wasn't expected, or isn't valid in this context
18 unsupported feature: error: Found argument 'unimplemented-command' which wasn't expected, or isn't valid in this context
17
19
18 USAGE:
20 USAGE:
@@ -25,35 +27,35 b' Unimplemented command'
25 [252]
27 [252]
26
28
27 Finding root
29 Finding root
28 $ rhg root
30 $ $NO_FALLBACK rhg root
29 abort: no repository found in '$TESTTMP' (.hg not found)!
31 abort: no repository found in '$TESTTMP' (.hg not found)!
30 [255]
32 [255]
31
33
32 $ hg init repository
34 $ hg init repository
33 $ cd repository
35 $ cd repository
34 $ rhg root
36 $ $NO_FALLBACK rhg root
35 $TESTTMP/repository
37 $TESTTMP/repository
36
38
37 Reading and setting configuration
39 Reading and setting configuration
38 $ echo "[ui]" >> $HGRCPATH
40 $ echo "[ui]" >> $HGRCPATH
39 $ echo "username = user1" >> $HGRCPATH
41 $ echo "username = user1" >> $HGRCPATH
40 $ rhg config ui.username
42 $ $NO_FALLBACK rhg config ui.username
41 user1
43 user1
42 $ echo "[ui]" >> .hg/hgrc
44 $ echo "[ui]" >> .hg/hgrc
43 $ echo "username = user2" >> .hg/hgrc
45 $ echo "username = user2" >> .hg/hgrc
44 $ rhg config ui.username
46 $ $NO_FALLBACK rhg config ui.username
45 user2
47 user2
46 $ rhg --config ui.username=user3 config ui.username
48 $ $NO_FALLBACK rhg --config ui.username=user3 config ui.username
47 user3
49 user3
48
50
49 Unwritable file descriptor
51 Unwritable file descriptor
50 $ rhg root > /dev/full
52 $ $NO_FALLBACK rhg root > /dev/full
51 abort: No space left on device (os error 28)
53 abort: No space left on device (os error 28)
52 [255]
54 [255]
53
55
54 Deleted repository
56 Deleted repository
55 $ rm -rf `pwd`
57 $ rm -rf `pwd`
56 $ rhg root
58 $ $NO_FALLBACK rhg root
57 abort: $ENOENT$: current directory
59 abort: $ENOENT$: current directory
58 [255]
60 [255]
59
61
@@ -68,7 +70,7 b' Listing tracked files'
68 > hg commit -m "commit $i" -q
70 > hg commit -m "commit $i" -q
69
71
70 Listing tracked files from root
72 Listing tracked files from root
71 $ rhg files
73 $ $NO_FALLBACK rhg files
72 file1
74 file1
73 file2
75 file2
74 file3
76 file3
@@ -76,13 +78,13 b' Listing tracked files from root'
76 Listing tracked files from subdirectory
78 Listing tracked files from subdirectory
77 $ mkdir -p path/to/directory
79 $ mkdir -p path/to/directory
78 $ cd path/to/directory
80 $ cd path/to/directory
79 $ rhg files
81 $ $NO_FALLBACK rhg files
80 ../../../file1
82 ../../../file1
81 ../../../file2
83 ../../../file2
82 ../../../file3
84 ../../../file3
83
85
84 Listing tracked files through broken pipe
86 Listing tracked files through broken pipe
85 $ rhg files | head -n 1
87 $ $NO_FALLBACK rhg files | head -n 1
86 ../../../file1
88 ../../../file1
87
89
88 Debuging data in inline index
90 Debuging data in inline index
@@ -95,20 +97,20 b' Debuging data in inline index'
95 > hg add file-$i
97 > hg add file-$i
96 > hg commit -m "Commit $i" -q
98 > hg commit -m "Commit $i" -q
97 > done
99 > done
98 $ rhg debugdata -c 2
100 $ $NO_FALLBACK rhg debugdata -c 2
99 8d0267cb034247ebfa5ee58ce59e22e57a492297
101 8d0267cb034247ebfa5ee58ce59e22e57a492297
100 test
102 test
101 0 0
103 0 0
102 file-3
104 file-3
103
105
104 Commit 3 (no-eol)
106 Commit 3 (no-eol)
105 $ rhg debugdata -m 2
107 $ $NO_FALLBACK rhg debugdata -m 2
106 file-1\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc)
108 file-1\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc)
107 file-2\x005d9299349fc01ddd25d0070d149b124d8f10411e (esc)
109 file-2\x005d9299349fc01ddd25d0070d149b124d8f10411e (esc)
108 file-3\x002661d26c649684b482d10f91960cc3db683c38b4 (esc)
110 file-3\x002661d26c649684b482d10f91960cc3db683c38b4 (esc)
109
111
110 Debuging with full node id
112 Debuging with full node id
111 $ rhg debugdata -c `hg log -r 0 -T '{node}'`
113 $ $NO_FALLBACK rhg debugdata -c `hg log -r 0 -T '{node}'`
112 d1d1c679d3053e8926061b6f45ca52009f011e3f
114 d1d1c679d3053e8926061b6f45ca52009f011e3f
113 test
115 test
114 0 0
116 0 0
@@ -124,16 +126,16 b' Specifying revisions by changeset ID'
124 cf8b83f14ead62b374b6e91a0e9303b85dfd9ed7
126 cf8b83f14ead62b374b6e91a0e9303b85dfd9ed7
125 91c6f6e73e39318534dc415ea4e8a09c99cd74d6
127 91c6f6e73e39318534dc415ea4e8a09c99cd74d6
126 6ae9681c6d30389694d8701faf24b583cf3ccafe
128 6ae9681c6d30389694d8701faf24b583cf3ccafe
127 $ rhg files -r cf8b83
129 $ $NO_FALLBACK rhg files -r cf8b83
128 file-1
130 file-1
129 file-2
131 file-2
130 file-3
132 file-3
131 $ rhg cat -r cf8b83 file-2
133 $ $NO_FALLBACK rhg cat -r cf8b83 file-2
132 2
134 2
133 $ rhg cat -r c file-2
135 $ $NO_FALLBACK rhg cat -r c file-2
134 abort: ambiguous revision identifier c
136 abort: ambiguous revision identifier c
135 [255]
137 [255]
136 $ rhg cat -r d file-2
138 $ $NO_FALLBACK rhg cat -r d file-2
137 2
139 2
138
140
139 Cat files
141 Cat files
@@ -144,37 +146,36 b' Cat files'
144 $ echo "original content" > original
146 $ echo "original content" > original
145 $ hg add original
147 $ hg add original
146 $ hg commit -m "add original" original
148 $ hg commit -m "add original" original
147 $ rhg cat -r 0 original
149 $ $NO_FALLBACK rhg cat -r 0 original
148 original content
150 original content
149 Cat copied file should not display copy metadata
151 Cat copied file should not display copy metadata
150 $ hg copy original copy_of_original
152 $ hg copy original copy_of_original
151 $ hg commit -m "add copy of original"
153 $ hg commit -m "add copy of original"
152 $ rhg cat -r 1 copy_of_original
154 $ $NO_FALLBACK rhg cat -r 1 copy_of_original
153 original content
155 original content
154
156
155 Fallback to Python
157 Fallback to Python
156 $ rhg cat original
158 $ $NO_FALLBACK rhg cat original
157 unsupported feature: `rhg cat` without `--rev` / `-r`
159 unsupported feature: `rhg cat` without `--rev` / `-r`
158 [252]
160 [252]
159 $ FALLBACK="--config rhg.on-unsupported=fallback"
161 $ rhg cat original
160 $ rhg cat original $FALLBACK
161 original content
162 original content
162
163
163 $ rhg cat original $FALLBACK --config rhg.fallback-executable=false
164 $ rhg cat original --config rhg.fallback-executable=false
164 [1]
165 [1]
165
166
166 $ rhg cat original $FALLBACK --config rhg.fallback-executable=hg-non-existent
167 $ rhg cat original --config rhg.fallback-executable=hg-non-existent
167 tried to fall back to a 'hg-non-existent' sub-process but got error $ENOENT$
168 tried to fall back to a 'hg-non-existent' sub-process but got error $ENOENT$
168 unsupported feature: `rhg cat` without `--rev` / `-r`
169 unsupported feature: `rhg cat` without `--rev` / `-r`
169 [252]
170 [252]
170
171
171 $ rhg cat original $FALLBACK --config rhg.fallback-executable="$RHG"
172 $ rhg cat original --config rhg.fallback-executable="$RHG"
172 Blocking recursive fallback. The 'rhg.fallback-executable = */rust/target/release/rhg' config points to `rhg` itself. (glob)
173 Blocking recursive fallback. The 'rhg.fallback-executable = */rust/target/release/rhg' config points to `rhg` itself. (glob)
173 unsupported feature: `rhg cat` without `--rev` / `-r`
174 unsupported feature: `rhg cat` without `--rev` / `-r`
174 [252]
175 [252]
175
176
176 Requirements
177 Requirements
177 $ rhg debugrequirements
178 $ $NO_FALLBACK rhg debugrequirements
178 dotencode
179 dotencode
179 fncache
180 fncache
180 generaldelta
181 generaldelta
@@ -183,20 +184,20 b' Requirements'
183 store
184 store
184
185
185 $ echo indoor-pool >> .hg/requires
186 $ echo indoor-pool >> .hg/requires
186 $ rhg files
187 $ $NO_FALLBACK rhg files
187 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
188 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
188 [252]
189 [252]
189
190
190 $ rhg cat -r 1 copy_of_original
191 $ $NO_FALLBACK rhg cat -r 1 copy_of_original
191 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
192 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
192 [252]
193 [252]
193
194
194 $ rhg debugrequirements
195 $ $NO_FALLBACK rhg debugrequirements
195 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
196 unsupported feature: repository requires feature unknown to this Mercurial: indoor-pool
196 [252]
197 [252]
197
198
198 $ echo -e '\xFF' >> .hg/requires
199 $ echo -e '\xFF' >> .hg/requires
199 $ rhg debugrequirements
200 $ $NO_FALLBACK rhg debugrequirements
200 abort: corrupted repository: parse error in 'requires' file
201 abort: corrupted repository: parse error in 'requires' file
201 [255]
202 [255]
202
203
@@ -205,7 +206,7 b' Persistent nodemap'
205 $ rm -rf repository
206 $ rm -rf repository
206 $ hg init repository
207 $ hg init repository
207 $ cd repository
208 $ cd repository
208 $ rhg debugrequirements | grep nodemap
209 $ $NO_FALLBACK rhg debugrequirements | grep nodemap
209 [1]
210 [1]
210 $ hg debugbuilddag .+5000 --overwritten-file --config "storage.revlog.nodemap.mode=warn"
211 $ hg debugbuilddag .+5000 --overwritten-file --config "storage.revlog.nodemap.mode=warn"
211 $ hg id -r tip
212 $ hg id -r tip
@@ -213,14 +214,14 b' Persistent nodemap'
213 $ ls .hg/store/00changelog*
214 $ ls .hg/store/00changelog*
214 .hg/store/00changelog.d
215 .hg/store/00changelog.d
215 .hg/store/00changelog.i
216 .hg/store/00changelog.i
216 $ rhg files -r c3ae8dec9fad
217 $ $NO_FALLBACK rhg files -r c3ae8dec9fad
217 of
218 of
218
219
219 $ cd $TESTTMP
220 $ cd $TESTTMP
220 $ rm -rf repository
221 $ rm -rf repository
221 $ hg --config format.use-persistent-nodemap=True init repository
222 $ hg --config format.use-persistent-nodemap=True init repository
222 $ cd repository
223 $ cd repository
223 $ rhg debugrequirements | grep nodemap
224 $ $NO_FALLBACK rhg debugrequirements | grep nodemap
224 persistent-nodemap
225 persistent-nodemap
225 $ hg debugbuilddag .+5000 --overwritten-file --config "storage.revlog.nodemap.mode=warn"
226 $ hg debugbuilddag .+5000 --overwritten-file --config "storage.revlog.nodemap.mode=warn"
226 $ hg id -r tip
227 $ hg id -r tip
@@ -232,9 +233,9 b' Persistent nodemap'
232 .hg/store/00changelog.n
233 .hg/store/00changelog.n
233
234
234 Specifying revisions by changeset ID
235 Specifying revisions by changeset ID
235 $ rhg files -r c3ae8dec9fad
236 $ $NO_FALLBACK rhg files -r c3ae8dec9fad
236 of
237 of
237 $ rhg cat -r c3ae8dec9fad of
238 $ $NO_FALLBACK rhg cat -r c3ae8dec9fad of
238 r5000
239 r5000
239
240
240 Crate a shared repository
241 Crate a shared repository
@@ -254,9 +255,9 b' Crate a shared repository'
254
255
255 And check that basic rhg commands work with sharing
256 And check that basic rhg commands work with sharing
256
257
257 $ rhg files -R repo2
258 $ $NO_FALLBACK rhg files -R repo2
258 repo2/a
259 repo2/a
259 $ rhg -R repo2 cat -r 0 repo2/a
260 $ $NO_FALLBACK rhg -R repo2 cat -r 0 repo2/a
260 a
261 a
261
262
262 Same with relative sharing
263 Same with relative sharing
@@ -265,9 +266,9 b' Same with relative sharing'
265 updating working directory
266 updating working directory
266 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
267 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
267
268
268 $ rhg files -R repo3
269 $ $NO_FALLBACK rhg files -R repo3
269 repo3/a
270 repo3/a
270 $ rhg -R repo3 cat -r 0 repo3/a
271 $ $NO_FALLBACK rhg -R repo3 cat -r 0 repo3/a
271 a
272 a
272
273
273 Same with share-safe
274 Same with share-safe
@@ -290,9 +291,9 b' Same with share-safe'
290 And check that basic rhg commands work with sharing
291 And check that basic rhg commands work with sharing
291
292
292 $ cd repo5
293 $ cd repo5
293 $ rhg files
294 $ $NO_FALLBACK rhg files
294 a
295 a
295 $ rhg cat -r 0 a
296 $ $NO_FALLBACK rhg cat -r 0 a
296 a
297 a
297
298
298 The blackbox extension is supported
299 The blackbox extension is supported
@@ -301,7 +302,7 b' The blackbox extension is supported'
301 $ echo "blackbox =" >> $HGRCPATH
302 $ echo "blackbox =" >> $HGRCPATH
302 $ echo "[blackbox]" >> $HGRCPATH
303 $ echo "[blackbox]" >> $HGRCPATH
303 $ echo "maxsize = 1" >> $HGRCPATH
304 $ echo "maxsize = 1" >> $HGRCPATH
304 $ rhg files > /dev/null
305 $ $NO_FALLBACK rhg files > /dev/null
305 $ cat .hg/blackbox.log
306 $ cat .hg/blackbox.log
306 ????/??/?? ??:??:??.??? * @d3873e73d99ef67873dac33fbcc66268d5d2b6f4 (*)> (rust) files exited 0 after 0.??? seconds (glob)
307 ????/??/?? ??:??:??.??? * @d3873e73d99ef67873dac33fbcc66268d5d2b6f4 (*)> (rust) files exited 0 after 0.??? seconds (glob)
307 $ cat .hg/blackbox.log.1
308 $ cat .hg/blackbox.log.1
General Comments 0
You need to be logged in to leave comments. Login now