Hgignore everything except, regardless of directory

ⅰ亾dé卋堺 提交于 2019-12-10 11:28:05

问题


I've seen the posts for hgignore everything except, but I can't seem to transform the regex to work with subdirectories as well.

syntax: regexp
(?<!\.cfm)$

Works for the root directory but not subdirs/subsubdirs. I don't want to manually specify those.

This is what I see without the ignore:

>hg stat
? document.cfm
? document.txt
? subdir1\document.cfm
? subdir1\document.txt
? subdir1\subsubdir1\document.cfm
? subdir1\subsubdir1\document.txt
? subdir2\document.cfm
? subdir2\document.txt

This is what I see with the ignore:

>hg stat
M .hgignore
? document.cfm

This is what I want to see:

>hg stat
? document.cfm
? subdir1\document.cfm
? subdir1\subsubdir1\document.cfm
? subdir2\document.cfm

回答1:


Adding a file overrides ignores, so for the .hgignore if you've already added it you don't need to worry about including it. That makes this much easier.

syntax: regexp
(?<!\.cfm)$

assuming that what you were trying to do is ignore everything except .cfm files. Example:

% hg stat --all
A .hgignore
I adir/file.cfm

In general, don't overcomplicate the regex lines -- if you're (un)ignoring two different categories of things use two lines.




回答2:


The desired action is impossible. Python only does fixed-width negative lookups. Closing this question. Thanks to anyone who looked into it.



来源:https://stackoverflow.com/questions/5379533/hgignore-everything-except-regardless-of-directory

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!