Renaming to Git and Mercurial: Accuracy and Automation

I have only a few days of experience with Git and Mercurial, and I have little programming experience.

In the last few days, I read a lot of posts comparing them. Based on the read and my tests, I draw the following conclusions:

Git renaming is 100% automatic, but not 100% accurate. It uses an algorithm to guess renames. End users cannot change their decision, even if it is completely wrong.

I believe that the Git method may be fine in 99% of cases, but 1% will cause headaches. This makes me embarrassed to reorganize my code (while changing the name and contents of the class), since I risk losing my file history if there is too much refactoring.

Mercurial can be 100% automatic and 100% accurate, if I always rename / move my things in Visual Studio and install VisualHG, VisualHG should accurately and automatically track the movement and renaming (VisualHG currently has an error - File is not renamed when I moving it between projects ). End users can change this decision if it makes mistakes.

If I don’t have Visual Studio, I can still use TortoiseHg "Copy / rename detection", I can set the similarity percentage, ask Mercurial to automatically detect renames. If he is mistaken, I have the opportunity to correct him.

Are my findings right or wrong?

Link:

Git and Mercurial - Compare and Contrast

+6
source share
2 answers

Here you can see the difference explained, but basically you are right. Mercurial has rename and mv that do the “real” renaming, and Git mv just does rm and add . It also seems that Mercurial can mimic Git behavior and guess your renames, a pretty nice feature. From Git's experience, the rename detection algorithm makes the wrong decisions - especially if you copy the file and modify two copies a little - in most cases this will be wrong.

+6
source

I don’t think that Mercurial’s ability to track file renaming is nearly as perfect as it seems, it might be. I don't have much experience with Git, but I have a good bit with Mercurial, and renaming files seems to work fine in some contexts ( hg view understands them) if you didn't do anything “interesting” (which seems to be happening somewhat often).

And Git, at least in reputation, is supposed to make you a low level history change if you need to.

+4
source

Source: https://habr.com/ru/post/887779/


All Articles