From patchwork Mon May 18 17:23:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D8353: debugcommands: create new debugantivirusrunning command From: phabricator X-Patchwork-Id: 46338 Message-Id: <344c59f878f2c3110ef2fd3951dba5d9@localhost.localdomain> To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Mon, 18 May 2020 17:23:45 +0000 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 To: durin42, #hg-reviewers, marmoute Cc: mercurial-patches, marmoute, mharbison72, indygreg, mercurial-devel 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))) +@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*