Question

I have a large file system in which almost every folder has a file called content.txt

I want to track every file named content.txt and automatically ignore everything else. I want the repo to automatically track new files named content.txt so I don't want to ignore everything in the .hgignore and then manually add.

Anyone know how to do this?

Était-ce utile?

La solution

  1. It has to be regexp mode, not glob
  2. You must debug path-part of regexp, but "all except content.txt" draft is re:.*\.(?!content.txt) as hope

Alternative solution can be * ignore all * add content.txt files pattern to commit command (-I option), see hg help commit and hg help patterns

hg commit -I '**content.txt'

Edit

re:.*/(?!content.txt)

Autres conseils

Try this:

syntax: regexp
\.(?!txt$)[^.]+$ # "*." is followed by "txt" and we're at the end
(?<!\.)txt$ # "txt" follows a "."
(?<!/)content\. # "content." follows path separator
(?<!content)\. # "." follows "content"

I left in the comments I made while experimenting, to make sense of it all. (That's glob syntax in the first one.)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top