Mercurial filemap exclude include... does it not do what docs say?

1.6k views Asked by At

Converting from subversion, I take the opportunity to clean up the repo, and split it in three mostly independent projects. But... I have a filemap that says

exclude bot
include bot/aobiosbot.py

Which should include everything, except the "bot" subdirectory, but still include the "aobiosbot.py" file in that directory. The trouble is, the converted repo is empty (I test with an "hg clone"). If I add an "include ." as line 1, I get everything but the "bot" dir... including "bot/aobiosbot.py". But I told it to include that file.

(Really, the docs for filemap are bad. Exclude/include options have to be specified exactly. I find I tend to agree with Joel on specs... at least here. Who'd'a thunk...)

2

There are 2 answers

1
Jürgen A. Erhard On BEST ANSWER

I've solved it by taking some code from the dev repo (file hgext/convert/filemap.py). Works lots better. :D

1
Ry4an Brase On

Hrm, I'll admit to not being able to figure out why what you have isn't working, but I can confirm it's not.

However, with my test src repo like this:

src
|-- bot
|   |-- aobiosbot.py
|   `-- excludeme
`-- dir1
    `-- includeme

and a filemap like this:

include dir1
include bot/aobiosbot.py

I end up with this:

dest
|-- bot
|   `-- aobiosbot.py
`-- dir1
    `-- includeme

You could bulld that filemap quickly by doing this in the repo root:

for thefile in * .* ; do
     echo include $thefile >> ../filemap
done

I'm sure there's a better way using exclude, but without reading the code for convert I can't find it.