Frage

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?

War es hilfreich?

Lösung

  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)

Andere Tipps

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top