In mercurial, how to deal with identically named file and directory in two revisions?
The problem can be trivially illustrated:
hg init temp
cd temp
touch a
hg ci -A -m file
hg rm a
mkdir a
hg ci -m dir
hg up -r0
The last command fails with abort: Is a directory: a
(or a more cryptic Access is denied
on Windows).
Is there any workaround?
I ran into this exact problem when converting legacy code base. I really need to fully automate the conversion since I have dozens of versions of a huge code base to deal with, and synonym开发者_如何学JAVAous file/dir can happen at any time.
Add:
hg purge
before the last update, to get rid of the empty directory. Note that even if you had added the directory, it would still not be tracked; Mercurial does not track empty directories (it only tracks non-empty ones implicitly).
purge
removes "Unknown files" and "Empty directories".
精彩评论