简体   繁体   中英

mercurial: excluding .hg files with archive

I am running:

hg archive --exclude .hg ../rdiff-backup-fs-1.0.0b3

trying to export files for a package without adding .hg files. I get:

abort: path contains illegal component: .hg

What am I doing wrong? I am trying to exclude files .hgtags and .hg_archival.txt .

EDIT OK, I'm an idiot. You need to specify the whole pattern, not just the prefix.

You can also set default patterns to ignore when exporting and avoid too many typing.

Put this on your .hgrc

[defaults]
archive = -X .hgtags -X .hgignore -X .todo

This way you can do hg archive ~/project.tgz and those files will be always omitted.

hg archive已经排除了.hg目录(实际上,这很重要,不是吗?),无需指定它。

Option -X requires full name, rather than only a prefix. Therefore I had to use -X .hgtags .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM