How can I create a special file filter for the mercurial revert command?

I need to return all the files in the working directory that match the name "test" anywhere inside the file.

Is it possible to return all these 3 files using the hg revert -I syntax:

  • /includes/atest.txt
  • /test.txt
  • /test/test/test.txt
+4
source share
2 answers

It should work (I can't check it right now) with the following syntax, according to issue 1697 :

Window:

 hg revert "glob:*test.*" # or hg revert -I "*test.*" --all 

Unix:

 hg revert 'glob:*test.*' hg revert -I '*test.*' 

(Note the simple quotes for Unix)

+4
source

To expand on the answer below

You can include all files in subdirectories in your return using the following syntax:

Window:

 hg revert "glob:**\*test.*" 

And I assume that Unix will be:

 hg revert 'glob:**/*test.*' 
+2
source

All Articles