[Updated] D8353: debugcommands: create new debugantivirusrunning command
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Mon May 18 17:23:45 UTC 2020
Herald added a subscriber: mercurial-patches.
durin42 updated this revision to Diff 21426.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D8353?vs=20929&id=21426
BRANCH
default
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D8353/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D8353
AFFECTED FILES
mercurial/debugcommands.py
tests/test-completion.t
tests/test-help.t
CHANGE DETAILS
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -971,6 +971,8 @@
debugancestor
find the ancestor revision of two revisions in a given index
+ debugantivirusrunning
+ attempt to trigger an antivirus scanner to see if one is active
debugapplystreamclonebundle
apply a stream clone bundle file
debugbackupbundle
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -74,6 +74,7 @@
Show debug commands if there are no other candidates
$ hg debugcomplete debug
debugancestor
+ debugantivirusrunning
debugapplystreamclonebundle
debugbackupbundle
debugbuilddag
@@ -260,6 +261,7 @@
continue: dry-run
copy: forget, after, at-rev, force, include, exclude, dry-run
debugancestor:
+ debugantivirusrunning:
debugapplystreamclonebundle:
debugbackupbundle: recover, patch, git, limit, no-merges, stat, graph, style, template
debugbuilddag: mergeable-file, overwritten-file, new-file
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -127,6 +127,23 @@
ui.write(b'%d:%s\n' % (r.rev(a), hex(a)))
+ at command(b'debugantivirusrunning', [])
+def debugantivirusrunning(ui, repo):
+ """attempt to trigger an antivirus scanner to see if one is active"""
+ with repo.cachevfs.open('eicar-test-file.com', b'wb') as f:
+ f.write(
+ util.b85decode(
+ # This is a base85-armored version of the EICAR test file. See
+ # https://en.wikipedia.org/wiki/EICAR_test_file for details.
+ b'ST#=}P$fV?P+K%yP+C|uG$>GBDK|qyDK~v2MM*<JQY}+dK~6+LQba95P'
+ b'E<)&Nm5l)EmTEQR4qnHOhq9iNGnJx'
+ )
+ )
+ # Give an AV engine time to scan the file.
+ time.sleep(2)
+ util.unlink(repo.cachevfs.join('eicar-test-file.com'))
+
+
@command(b'debugapplystreamclonebundle', [], b'FILE')
def debugapplystreamclonebundle(ui, repo, fname):
"""apply a stream clone bundle file"""
To: durin42, #hg-reviewers, marmoute
Cc: mercurial-patches, marmoute, mharbison72, indygreg, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20200518/efdb18fb/attachment-0001.html>
More information about the Mercurial-patches
mailing list