1

First, sorry because of my poor English and explanation. This is the edited version of my question after receiving some comments and I realize what made you confused.

The project I'm working on has about 10 people and each person will implement some "work" in the project.

  • We share 20 model files (text files)
  • When people do "work", they have to go directly to model files and add/remove/edit some lines in 20 text files above.

Assume that:

  • A implemented work no. 1, 4, 6, and 10.
  • B implemented work no. 2, 3, 7, and 9.
  • ...

A implemented (4) before B implemented (7). In file X, some values/lines changed by (4) are overridden by (7).

Later when we run the energy saving evaluation and find out (4) actually doesn't save energy at all so we decide to take (4) out.

So the question is that if we have any Version Control that can take (4) (implemented by A) out WITHOUT touching any overridden values/lines made by (7) (implemented by B).
In other words, I want to remove all the changes made by A for the work number (4) ONLY. Work 1, 6, 10 done by A are still in the model files.

Right now we are using RCS... but I don't know if RCS can do it and how?
I'm considering GIT and SVN. I think SVN is more appropriate since all data in the project is put in 1 place (1 folder). Our server is Linux Red Hat.

If you experienced this, please share.

Sorry again and thanks for your time.

user397232
  • 1,750
  • 6
  • 21
  • 30
  • Let me make sure I understand correctly. You have a piece of code (4) that creates a file, and another one (7) that modifies that file, and want to revert 4? Or do you have a piece of code (4) that modifies earlier module (0), and then 7 also modifies 0 but because it came later modifies 4 as well? – Jon Jan 29 '11 at 08:20
  • We are sharing model files. So, for example, I have a model in file X. Now, (4) changes some values in X. One week after (4) completed, (7) changes the same values as (4) changed. – user397232 Jan 29 '11 at 08:44

3 Answers3

2

For configuration, it is better to version:

  • a template configuration files with only variables in it
  • each modules values separately
  • a script able to recognize which module is running and to replace the variable in the template files by the actual values

That way:

  • the actual configuration file (the one with the values used by the module) is never versioned (but always generated).
  • it deals with any module organization/dependencies (since, like Jon mentions in the comment), it isn't exactly clear if you have a common file modified by several modules, or the same set of file (module) in several versions.

If you have no way to generate those files modified concurrently, then branches are the right solution, which is why SVN or any DVCS (Git, Mercurial, ...)
That will impose the overhead of merges to report some of your modifications from one branch to another.


The kind of selective merge you want is a "negative merge" (one where you reverse some changes and not others: also called subtractive merge)

Git handles that without problem through a "rebase --interactive", where you replay commits (you can even amend/change one of the commits replayed).
You would also have the option of a git revert if you don't want to rewrite the history of past commits.

I don't know how RCS would handle that, unless you make a new revision by manually comparing the current version with previous versions done by A in order to remove the right lines.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks for your comments but configuration is just an example. More exactly, model files are what we are sharing now and we have no way to separate them. So all members in the team keeps editing them. – user397232 Jan 29 '11 at 08:38
  • @user397232: and you have no way to generate those model files, instead of versioning them? – VonC Jan 29 '11 at 08:40
  • @user397232: then branches are the way to go: I have completed my answer. – VonC Jan 29 '11 at 09:07
  • Thank VonC. After reading your answer, I realize how much vague my question is and I have edited it. Sorry about it. I'd appreciate if you can re-read my question and tell me your thoughts. – user397232 Jan 29 '11 at 09:37
  • @user397232: right, I have completed my answer with additional informations about reverting some selective changes. – VonC Jan 29 '11 at 09:52
  • Thanks so much for pointing GIT out, I'll try it. I don't know if you tried SVN? Some people recommend it to us since we are energy people so we don't want too much command line stuff... and also GIT is DVCS while our models are in 1 place/folder. – user397232 Jan 29 '11 at 10:07
  • @user397232: I manage SVN repos as well, I just think a DVCS (Git or Mercurial, the latter being more user-friendly) can handle merge better (see http://stackoverflow.com/questions/3900015/distributed-version-control-killer-applications/3900117#3900117) and handle any kind of workflow (including a central repo one). See also http://stackoverflow.com/questions/2704996/describe-your-workflow-of-using-version-control-vcs-or-dvcs – VonC Jan 29 '11 at 10:09
  • @user397232: Linux means Git is a perfect fit (Git has been done after all by Linus Torwald ;) ). See http://gitimmersion.com/index.html . But if you know a bit SVN, Hg is closer to that model (see http://hginit.com/). In both cases, some learning curve is involved. – VonC Jan 30 '11 at 07:37
0

in general the approach when using version control is this:

  • you have a trunk with the stable version of code
  • you have an issue -> you create a branch from your trunk
  • while you are fixing the issue, you update changes from the trunk to your branch to remain as close as possible to the stable version -> this way you will notice immediately that a change in stable is not working with your code ;)
  • once the issue is fixed/tested(!), you merge the branch to the trunk

note:

  • if more developers are changing the same line of code, there will be conflicts -> this happens and has to be handled manually
  • reverting commits is also possible
udo
  • 4,832
  • 4
  • 54
  • 82
0

To remove a version with SVN (I assume that would be something similar with git), you use the following command-line on your working copy:

svn merge -c -4 .

That would negatively apply the changes of version 4 to your working copy. After that you can check the changes and commit it back to the repository.

Mnementh
  • 50,487
  • 48
  • 148
  • 202