comparison mercurial/debugcommands.py @ 51939:8d9767bf4adb

debugantivirusrunning: use bytes when opening a vfs file I noticed this when searching for "base85" to see if anything else in the previous commit needed to be annotated. This was added in 87047efbc6a6, after the mass byteification in 687b865b95ad.
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 04 Oct 2024 23:23:24 -0400
parents f4733654f144
children a8e1ff9ac257
comparison
equal deleted inserted replaced
51938:fa7059f031a9 51939:8d9767bf4adb
141 141
142 142
143 @command(b'debugantivirusrunning', []) 143 @command(b'debugantivirusrunning', [])
144 def debugantivirusrunning(ui, repo): 144 def debugantivirusrunning(ui, repo):
145 """attempt to trigger an antivirus scanner to see if one is active""" 145 """attempt to trigger an antivirus scanner to see if one is active"""
146 with repo.cachevfs.open('eicar-test-file.com', b'wb') as f: 146 with repo.cachevfs.open(b'eicar-test-file.com', b'wb') as f:
147 f.write( 147 f.write(
148 util.b85decode( 148 util.b85decode(
149 # This is a base85-armored version of the EICAR test file. See 149 # This is a base85-armored version of the EICAR test file. See
150 # https://en.wikipedia.org/wiki/EICAR_test_file for details. 150 # https://en.wikipedia.org/wiki/EICAR_test_file for details.
151 b'ST#=}P$fV?P+K%yP+C|uG$>GBDK|qyDK~v2MM*<JQY}+dK~6+LQba95P' 151 b'ST#=}P$fV?P+K%yP+C|uG$>GBDK|qyDK~v2MM*<JQY}+dK~6+LQba95P'
152 b'E<)&Nm5l)EmTEQR4qnHOhq9iNGnJx' 152 b'E<)&Nm5l)EmTEQR4qnHOhq9iNGnJx'
153 ) 153 )
154 ) 154 )
155 # Give an AV engine time to scan the file. 155 # Give an AV engine time to scan the file.
156 time.sleep(2) 156 time.sleep(2)
157 util.unlink(repo.cachevfs.join('eicar-test-file.com')) 157 util.unlink(repo.cachevfs.join(b'eicar-test-file.com'))
158 158
159 159
160 @command(b'debugapplystreamclonebundle', [], b'FILE') 160 @command(b'debugapplystreamclonebundle', [], b'FILE')
161 def debugapplystreamclonebundle(ui, repo, fname): 161 def debugapplystreamclonebundle(ui, repo, fname):
162 """apply a stream clone bundle file""" 162 """apply a stream clone bundle file"""