开发者

In mercurial, how to deal with identically named file and directory in two revisions?

开发者 https://www.devze.com 2023-01-31 14:12 出处:网络
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

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".

0

精彩评论

暂无评论...
验证码 换一张
取 消