문제

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?

도움이 되었습니까?

해결책

  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)

다른 팁

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.)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top