Mercurial:您可以跟踪已重命名为另一个跟踪文件的文件的更改吗?
我知道您可以跟踪从存储库到其克隆的重命名文件的更改。但是,当我将文件重命名为已被跟踪的文件名时,我似乎遇到了问题。本质上,我想复制跟踪文件。
原始存储库中的文件:
application.txt
special.txt
然后克隆存储库,删除 application.txt
并将 special.txt
重命名为 application.txt
我希望下次在原始存储库中对 special.txt
进行更改时,这些更改将延续到 application.txt
中。然而,事实并非如此。我收到这条消息
local changed special.txt which remote deleted
use (c)hanged version or (d)eleted?
在 Git 中尝试同样的事情似乎有相同的结果。将文件重命名为全新名称没有问题,而尝试重命名已被“采用”的文件会导致冲突。有什么办法解决这个问题吗?
I know that you can track changes to renamed files from a repo to it's clone. However, I seem to have an issue when I rename a file to a file name that is already being tracked. In essence, I want to copy over a tracked file.
Files in original repo:
application.txt
special.txt
Then clone the repo, delete application.txt
and rename special.txt
to be application.txt
I would expect that the next time I made changes to special.txt
in the original repo, the changes would carry over to application.txt
. However, it doesn't. I get this message
local changed special.txt which remote deleted
use (c)hanged version or (d)eleted?
Trying this same thing out in Git seems to have the same results. Renaming a file to a brand new name has no issues while trying to rename a file that has already been 'taken' causes conflicts. Is there any way around this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不会真正称其为错误,因为您出于所有目的只是更改了 Mercurial 已经跟踪的文件的内容。 Mercurial 按文件名和扩展名跟踪文件,您可以认为这与替换文件的全部内容没有什么不同。
I wouldn't really call this a bug, as you have for all purposes just changed the contents of a file that mercurial is already tracking. Mercurial tracks files by file name and extension, and you could make the case that this is no different than just replacing the entire contents of the file.
我刚刚在 Mercurial 的现实项目中遇到了这个问题。 GIT 还发现了虚假冲突(删除并更新了special.txt)。
Bazaar 具有适当的重命名支持,并且它正确地合并了这种情况(对special.txt 的更改将被保留,application.txt 将按预期更新)。
但 Bazaar 的问题(至少对我来说)是它缺乏 IntelliJ 支持。有 2 个插件,最新的已经 3 年没有更新了,上次我尝试时它在最新的 IntelliJ 版本中无法使用。
由于重构时需要由 IDE 调用“bzr mv”和“bzr rename”,因此缺乏支持使得 Bazaar 对我来说无法使用。
如果您希望 IntelliJ 支持此功能,请在此处投票:http://youtrack.jetbrains.com/issue/ IDEABKL-5344
I just had this problem in a real world project with Mercurial. GIT is also seeing bogus conflicts (special.txt deleted and updated).
Bazaar has proper rename support and it merges this case correctly (changes to special.txt are carried over and application.txt get updated as expected).
The problem with Bazaar though (at least for me) is that it lacks IntelliJ support. There are 2 plugins, the most recent has not been updated for 3 years, and last time i tried it was unusable with recent IntelliJ versions.
Since "bzr mv" and "bzr rename" need to be invoked by the IDE at the time of refactoring, the lack of support makes Bazaar unusable for me.
If you want IntelliJ support for this, vote here: http://youtrack.jetbrains.com/issue/IDEABKL-5344