{"id":7729,"date":"2021-11-25T01:02:30","date_gmt":"2021-11-25T01:02:30","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=7729"},"modified":"2021-11-25T01:03:11","modified_gmt":"2021-11-25T01:03:11","slug":"how-to-avoid-error-findstr-ignored","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/how-to-advoid-error-findstr-ignored\/20674.html","title":{"rendered":"How To Avoid Error FINDSTR: \/\/ Ignored"},"content":{"rendered":"<p>I have written a pre-commit.bat file to find string &#8220;I have tested&#8221; in commit message, the FINDSTR works fine, whoever, if the function does not find a string, it will give error message. most part error message is correct, but I don&#8217;t understand why this is in error message &#8220;FINDSTR: \/\/ ignored&#8221;, how can I advoid it?<br \/>\nQuestion 2 is, when commit an added file, I need to check if the property svn:needs-lock is set or not. However, I don&#8217;t know what is the correct syntex to check the file extention right now I am using: for \/f &#8220;usebackq&#8221; %%i in (`findstr \/E \/I \/R &#8220;\\.*.$&#8221; %TEMP%\\tempfile%2`) does not give warning or error message. Also, If the file does not have the property svn:needs-lcok, how do I set the lock property to the commited file. Some help on these will be greatly appreciated.<br \/>\nThank you<br \/>\nLynda<br \/>\nHere is the script:<\/p>\n<p>@echo off<br \/>\n:: Stops commits that have empty log messages.<br \/>\nREM &gt;nul redirect output to the NULL device, no screnn print out<br \/>\nREM \/i ignore case \/c search string<br \/>\n@echo off<\/p>\n<p>setlocal<\/p>\n<p>rem Subversion sends through the path to the repository and transaction id<br \/>\nset REPOS=%1<br \/>\nset TRANSACTION=%2<br \/>\nset svnlook_why =&#8221;C:\\Program Files\\BitNamiTrac\\subversion\\bin\\svnlook.exe&#8221;<br \/>\nset TEMP =&#8221;C:\\Program Files\\BitNamiTrac\\subversion\\tmp&#8221;<\/p>\n<p>svnlook log %REPOS% -t %TRANSACTION% | findstr \/i\/c:&#8221;I have tested&#8221; &gt;nul<br \/>\nif %errorlevel% gtr 0 (goto err)<\/p>\n<p>if exist %TEMP%\\temfile%2 del %TEMP%\\tempfile%2<br \/>\nfor \/f &#8220;tokens=1,2 usebackq&#8221; %%i in (`svnlook changed -t %2 %1`) do @if %%i==A @echo %%j &gt;&gt; %TEMP%\\tempfile%2<\/p>\n<p>Rem for \/f &#8220;usebackq&#8221; %%i in (`findstr \/E \/I \/R &#8220;\\.vb.$ \\.cs.$ \\.aspx.$ \\.*.$ \\.bmp.$ \\.gif.$ \\.ico.$ \\.jpeg.$ \\.jpg.$ \\.png.$ \\.tif.$ \\.tiff.$ \\.doc.$ \\.jar.$ \\.odt.$ \\.pdf.$ \\.ppt.$ \\.swf.$ \\.vsd.$ \\.xls.$ \\.zip.$&#8221; %TEMP%\\tempfile%2`) do (<br \/>\nfor \/f &#8220;usebackq&#8221; %%i in (`findstr \/E \/I \/R &#8220;\\.*.$&#8221; %TEMP%\\tempfile%2`) do (<\/p>\n<p>svnlook propget -t %2 %1 svn:needs-lock %%i 1&gt; nul 2&gt; nul<br \/>\nif ERRORLEVEL 1 (<br \/>\necho commit denied, binary files must have property svn:needs-lock &gt;&amp;2<br \/>\ntype %TEMP%\\tempfile%2 &gt;&amp;2<br \/>\ndel %TEMP%\\tempfile%2<br \/>\nEXIT \/B 1<br \/>\n)<br \/>\n)<br \/>\ndel %TEMP%\\tempfile%2<br \/>\n:NOFILESADDED<br \/>\nEXIT \/B 0<\/p>\n<p>exit 0<\/p>\n<p>:err<br \/>\necho Sorry,<br \/>\necho Your commit has been blocked because you have not included 1&gt;&amp;2<br \/>\necho &#8220;I have tested&#8221; 1&gt;&amp;2<br \/>\necho in your comment. 1&gt;&amp;2<br \/>\necho Only tested files are allowed to commit to the repository 1&gt;&amp;2<br \/>\necho Thank you!. 1&gt;&amp;2<\/p>\n<p>exit 1<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":12},"question-category":[55],"question_tags":[],"class_list":["post-7729","question","type-question","status-publish","hentry","question-category-programming"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question\/7729","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=7729"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=7729"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=7729"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=7729"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}