I need to revert all files in a working directory that match the name "test" anywhere inside the filename.
Is it possible to revert all this 3 files by using hg revert -I
syntax:
To revert a file to a specific changeset, use hg revert -r CHANGESET FILENAME . This will revert the file without committing it.
hg status shows the status of a repository. Files are stored in a project's working directory (which users see), and the local repository (where committed snapshots are permanently recorded). hg add tells Mercurial to track files. hg commit creates a snapshot of the changes to 1 or more files in the local repository.
It should work (I cannot test it right now) with the following syntax, according to issue 1697:
Windows:
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)
As noted by Blaise in the comments
On macOS/Unix, you need to use
**
if you want to match files in any directory, e.g.
hg revert -I '**/*test.*'
To expand on the given answer above
You can include all files in subdirectories in your revert by using the following syntax:
Windows:
hg revert "glob:**\*test.*"
And I assume Unix would be:
hg revert 'glob:**/*test.*'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With