1

I have two different files each with its own history, I want to unite them as one, but keep both histories.

For example (My actual issue): I have x.vcproj and x.vcxproj, after converting from older visual studio to a newer one (I don't even remember any more which ones these were). Basically after the conversion we stopped using the old format all together.

What should have been done back then, is to write a script that goes over all converted projects (before adding anything to clearcase):

  • Checkout the x.vcproj and its containing folder.
  • Rename the x.vcxproj to some temporary file, let say x.vcxproj.temp
  • Use cleartool to rename x.vcproj to x.vcxproj
  • Overwrite x.vcxproj with the x.vcxproj.temp
  • Check in the x.vcxproj file.

This would have done the trick back then, but it has not been done, and now most of the <Project Name>.vcxproj already have their own extensive history.

Can the history of these two files be united and some how simulate the above flow?

Visual Example:

From:

x.vcproj                              x.vcxproj
 [main]                                 [main] 
   |                                      |
  (0)                                    (0)
   | \                                    | \
   |  \                                   |  \
   |  (0) [v1]                            |  (0) [v2]
   |   |                                  |   |
   |  (1)                                 |  (1) <<- First Node of x.vcxproj  
   |   | \                                |   |      
   |  (2) \                              (1)<(2) 
   |   |  (0) [v1.1]                      |   | \  
  (1)<(3)  |                              |   |  \ 
   |      (1)                             |   |  (0) [v2.1]
   |       |                              |   |   |
  (2)<----(2)                            (2)<(3)<(2)
   |                                      |       |  
  (3)                                    (3)<----(3)
   | \                                    | 
   |  \                                  (4) 
   |  (0) [v2]                            | \ 
   |   |                                  |  \
  (4)<(1) <<- Last node of x.vcproj       |  (0) [v3]
                                          |   |
                                         (5)<(1)

I want to get the following resulting tree:

x.vcproj -+-> x.vcxproj
       [main]           
         |                
        (0)               
         | \              
         |  \             
         |  (0) [v1]        
         |   |            
         |  (1)           
         |   | \          
         |  (2) \         
         |   |  (0) [v1.1]  
        (1)<(3)  |        
         |      (1)       
         |       |        
        (2)<----(2)       
         |                
        (3)               
         | \              
         |  \             
         |  (0) [v2]        
         |   |            
        (4)<(1) <<- Last node of x.vcproj          
         |   |
         |  (2) <<- First Node of x.vcxproj   
         |   |      Original Node (1) of [v2]
        (5)<(3) 
         |   | \  
         |   |  \ 
         |   |  (0) [v2.1]
         |   |   |
        (6)<(4)<(2)
         |       |  
        (7)<----(3)
         | 
        (8) 
         | \ 
         |  \
         |  (0) [v3]
         |   |
        (9)<(1)
Juv
  • 744
  • 7
  • 12

1 Answers1

1

Can the history of these two files be united and some how simulate the above flow?

Not through a native single cleartool command, but using a script which would, folder where both x.vcxproj and x.vcproj are present:

  • checkout the parent folder
  • delete x.vcxproj
  • checkout x.vcproj, rename it to x.vcxproj, and checkin
  • then, for each version of the x.vcxproj, read through a dynamic view, accessing the previous version of the parent folder (the one where both files were still present):
    • checkout x.vcxproj,
    • override its content with the old version of x.vcxproj
    • checkin

Use cleartool get for that:

cleartool get –to x.vcxproj /path@@/main/<previousVersion>/x.vcxproj@@/main/x
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • If I understand you correctly, I need to traverse all previous versions and reconstruct the tree (actually only on the latest version), loosing all time stamps and the versions of the original node. Some of the projects have hundred of nodes, and many, many versions (Since May 2012). So not a real easy way, and actually not really preserving the History. Never the less I will try this out, on some sample data I will create. – Juv Aug 03 '21 at 15:14
  • 1
    Yes. That is the idea. This kind of "history merging" is not easily supported, and if you are talking about files with 9 years worth of versions... that is even less supported ;) I was just trying to hint at a possible implementation, without knowing the exact scope of your codebase. – VonC Aug 03 '21 at 16:11
  • I'm not sure if ANY SCM tool will allow you to easily do this, if anything. This is a very "oddly specific" request. What's the backstory here? – Brian Cowan Aug 04 '21 at 19:01
  • @brian-cowan If there are ways to take the history from a different source control into ClearCase may be the same can be applied from ClearCase to ClearCase!? The back story is depicted above, we have hundreds of projects that were converted, but instead of rename the `vcproj` to `vcxproj` and then check-in with the converted one, there are now two files. 1) There are redundant files 2) The history is not complete for the projects - E.g. finding out when a file was added to a project requires going over several files. 3) And most annoying is opening the old `vcproj` by mistake. – Juv Aug 08 '21 at 06:14
  • 1
    @Juv "If there are ways to take the history from a different source control into ClearCase may be the same can be applied from ClearCase to ClearCase!? ": yes, if you can iterate from version to version from your different source control: it is called [`clearfsimport`](https://stackoverflow.com/a/59628346/6309), also detailed in https://stackoverflow.com/a/39368173/6309. – VonC Aug 08 '21 at 10:30
  • @Juv Visual Studio created the vcxproj file fresh on converting the older project to the new format. If this is a non-UCM VOB, you can get "creative" with clearexport_ccase and clearimport, but it's not simple. If this is a UCM component VOB, you can't use clearexport_ccase or clearimport. It would take experimentation to see how to put the vcproj file's history into branches of the vcxproj file, but it can be done. Clearfsimport would be rather clumsy to use for this... using lsvtree, describe, get mkbranch, checkout, and checkin -from would work as well, but that's more painful. – Brian Cowan Aug 11 '21 at 19:45