How to find specific changes in the version control system?

I don’t know if I touch a delicate subject here, at least it doesn’t seem easy ...

There are many VCSs , many more posts / blogs / ... describing how effective they are. And there are also many suggestions for removing material from code when it is not needed (clean code). There are always sentences like "he still does not disappear," "you can always return to him," ...

I cannot fully follow this. Let me say that several developers are working on one specific project. New requirements appear on the scene, leading to the creation, modification and deletion of code. And hopefully refactoring.

In fact, it sometimes happens that a specific function is required, then discarded, and then re-added later. In other words, code has already been written. This code was written during the “required” phase and removed during the “no more” phase. What happens in the re-add phase? Some may suggest rewriting the code, but I am not considering this option here. In fact, the "old" code may include fixing problems that arose at that time.

The project is not small, there are a lot of classes, a lot of logic, maybe some personnel changes, you get an idea. IMHO it’s unfair to always expect at least one developer to remember that the code was written and where it happened (including branch names).

Is there any support from VCS to answer questions such as

  • Where was the remote specific method, and I only have a vague assumption of its name?
  • I'm sure there is an if-statement here, but what happened to it?
  • ...

I do not want to limit this question to one VCS. This should be a more general question. If anyone cares, we are currently using Mercurial.

+4
source share
1 answer

This is the best scenario to handle:

  • many function branches
  • one branch of consolidation in which you merge (or return if you no longer want to merge a function), all functions that must do this for the next version in order to perform integration tests.

(as described in What is a Strategic Versioning Strategy? )

This is easier to do with DVCS (Mercurial, Git), since you can easily merge / reinstall / cherry pick a set of commits from one branch to another, as well as undo commits that you don't want to see .


Now about the "search for things":

Since changes in DVCS tend to be smaller than in CVCS, you get “small things” isolated in your own commit, which you can get later and see if they were merged or not.

Which is also easier with DVCS:

0
source

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


All Articles