Here's my file/fold开发者_如何学运维er structure:
Code/.hg
Code/.hgignore
Code/CASH/readme.txt
Code/CASH/bin/FTI/abc.dll
I'm trying to create a regular expression in my .hgignore file that will ignore everything below the CASH folder except for everything in the /bin/FTI folder.
Here's my .hgignore file that doesn't work:
syntax: regexp
CASH/(?!bin/FTI/).*
This ends up ignoring everything in the CASH folder, including the /bin/abc.dll file that I'd like to not ignore.
Any ideas?
This isn't exactly the answer you're looking for, but the reason Mercurial doesn't have decent syntax for "everything except" in .hgignore files (zero width look ahead regular expressions weren't the plan) is because hg add
overrides .hgignore
.
You can have a .hgignore
file with just this in it:
^CASH/
and then do a one-time hg add CASH/bin/FTI/**
and you'll be tracking all future changes to all the files that already exist in that directory.
Sure, if a new binary shows up in CASH/bin/FTI you'll have to remember to add it, but changes to those already added won't require any extra action. Unless binaries with new names are a regular occurrence this is the more common setup.
glob may easier in this case. If using regexp, how about:
syntax: regexp
CASH/(?!bin)
CASH/bin/(?!FTI)
精彩评论