hg添加整个目录,尽管列在.hgignore中

str*_*str 2 version-control mercurial dvcs hgignore

我在mercurial存储库中有两个分支,它们具有相同的.hgignore文件: dir/

一个分支(发展)应该忽略这个目录,而其他(释放)应该不会忽略它.我知道我可以使用hg add dir/somefile.hgignore文件中的条目.但现在我想以递归的方式添加整个直升机.

我搜索了那个并尝试过

hg add dir    # does not add anything
hg add dir*   # does not add anything
hg add dir/   # does not add anything
hg add dir/*  # only adds the files in dir but not in sub-directories
hg add dir/** # only adds the files in dir but not in sub-directories
Run Code Online (Sandbox Code Playgroud)

但这不是递归的工作.我可以使用add dir/* dir/*/* dir/*/*/*等等,但这很烦人.是否有另一个通配符我必须使用或者可能是另一种方法来实现这一目标?

PS:我想避免改变.hgignore.

str*_*str 6

与此同时,我能够想出 - 似乎是一个解决方案:

hg add --dry-run --verbose `hg status --ignored --no-status --exclude **.DS_Store dir/`
Run Code Online (Sandbox Code Playgroud)

这显示了它将添加的文件列表.如果您确实要添加它们,请使用以下命令:

hg add `hg status --ignored --no-status --exclude **.DS_Store dir/`
Run Code Online (Sandbox Code Playgroud)

希望这有助于某人.