3

Is is possible to split one file i.e.: javascript file contianing many object definitions to many files and keeping the each part history?

Source:

  • page.js

    1: page.component1 = ....
    .
    .
    n: page.component2 = ...
    .
    .
    .
    m: page.component3 = ..
    

Result:

  • page\component1.js

    page.component1 = ..
    
  • page\component2.js

    page.component2 = ..
    
  • page\component3.js

    page.component3 = ..
    

Each files can be queried to have history of changes with annotations whose code it is.

Another question is whether it is possible in other vcs like git.

Markus Jarderot
  • 86,735
  • 21
  • 136
  • 138
daniel
  • 644
  • 6
  • 5

2 Answers2

3

While it is not possible really you could try the following:

  1. Branch fileZ to fileA
  2. Branch fileZ to fileB
  3. Open each file and delete the bit you don't want
  4. Delete fileZ

Now you should maintain history on all of the visible lines of code through the branch relationship. I think this will only work in TFVC as git does things differently.

If you know git then please add the equivalent here.

0

I don't think this is possible in any of the major version control systems (TFS, Git, Mercurial, SVN).

Dylan Smith
  • 22,069
  • 2
  • 47
  • 62
  • Apparently, Git [can do it](http://stackoverflow.com/questions/1728922/how-does-git-track-source-code-moved-between-files). – Blorgbeard Nov 17 '14 at 21:09
  • Reading that link it sounds like they are saying Git stores enough information so smart people can write tools that do that. TFS stores the same information, so the same tools could be written against TFS. It's not a Git vs TFS thing, it's a question of do the tools exist, and what SC systems do they support. – Dylan Smith Nov 17 '14 at 21:16
  • There's a link to a "git on windows" tutorial in the linked question. It shows the standard git (on windows) tools doing it - so it seems git comes with a clever tool; indeed someone could (should!) write an equivalent for tfs. – Blorgbeard Nov 17 '14 at 21:23