Ask a questionAsk a question
 

AnswerFile Versioning

  • Thursday, October 29, 2009 6:32 PMKurt_Stockell Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    My company is looking to migrate from Perforce to Team System for our source control.

    Some of our developers have an issue with the way TFS version files, in Perforce each file has it's own individual file version while TFS seems to version files by changeset number.

    Is there a way to change how TFS versions files?

    Thanks in advance
    Kurt

Answers

  • Saturday, October 31, 2009 7:22 AMRichard Berg Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code

    I don't think the database stores those numbers anywhere, no.  On the bright side, if you're calling an API like QueryHistory then you don't really need it -- the number is directly related to the index in the resultset...

    $hist = tfhist .\Links.html
    for($i = 0; $i -lt $hist.Count; ++$i) {
        $hist[$i] = $hist[$i] | Add-Member noteproperty -name Version -val ($hist.Count - $i) -pass
    }
    $hist | ft -auto changesetid, version, creationdate, comment
    
    ChangesetId Version CreationDate          Comment                                                          
    ----------- ------- ------------          -------                                                          
          12359       7 10/19/2009 3:15:23 PM XML parser in Powershell RC doesn't like doctypes anymore (?)    
          11960       6 9/18/2009 12:51:45 PM                                                                  
          10733       5 7/9/2009 3:52:35 PM   put build info on links page                                     
          10363       4 6/19/2009 3:12:05 PM  Update master page for new silverlight URI format                
           9054       3 4/3/2009 1:35:47 AM                                                                    
           9044       2 4/2/2009 11:43:21 PM  fisheye                                                          
           9019       1 4/2/2009 6:38:18 PM   - alternate TickerLife project w/o BlackLight layout...     
    

All Replies

  • Thursday, October 29, 2009 8:21 PMEwald Hofman - Avanade Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Each individual file is stored by version, but TFS treats a checkin as an atomic action in a changeset.

    So you can see the history of a file, and when you look at the details, you see the context (changeset) of the checkin.

    So what do you think is limiting the functionality you require?
    Ewald - Please remember to mark the replies as answers if they help.

    Ewald Hofman
    Blog: www.ewaldhofman.nl
  • Friday, October 30, 2009 12:34 AMRichard Berg Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    He wants to be able to do something like:

    # fetch the 1st version of the file that was ever checked in, regardless what changeset counter on the server was at the time
    tf get file.cs -version V1

    Many other systems (notably, CVS and VSS) use a similar numbering scheme.  It need not contradict the concept of atomic checkins, as shown by Perforce.  Even TFS had something like this in 2005 Beta 1, using the special 'V' syntax, but it was cut shortly afterward.   

    In theory you could extend it all sorts of fun ways:

    # fetch the third most recent version
    tf get file.cs -version T-2

    # fetch the version immediately prior to what Bob is working on
    tf get file.cs -version WBob-1

    ...but those aren't necessary given the rich client object model, in my opinion.
  • Saturday, October 31, 2009 12:55 AMKurt_Stockell Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    First of all thank you for the responses, I think I can explain a little better now.

    The main issue is when looking at the history in TFS you only see the changeset number and not the actual version number of the file which perforce displays both.

    So if I understand correctly each file does actually have an individual file version it's just not displayed in the history window, correct?

    Thanks in advance

  • Saturday, October 31, 2009 7:11 AMEwald Hofman - Avanade Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    That is correct. When you look at the properties of the file, you can see the version of the file though.
    Ewald - Please remember to mark the replies as answers if they help.

    Ewald Hofman
    Blog: www.ewaldhofman.nl
  • Saturday, October 31, 2009 7:22 AMRichard Berg Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code

    I don't think the database stores those numbers anywhere, no.  On the bright side, if you're calling an API like QueryHistory then you don't really need it -- the number is directly related to the index in the resultset...

    $hist = tfhist .\Links.html
    for($i = 0; $i -lt $hist.Count; ++$i) {
        $hist[$i] = $hist[$i] | Add-Member noteproperty -name Version -val ($hist.Count - $i) -pass
    }
    $hist | ft -auto changesetid, version, creationdate, comment
    
    ChangesetId Version CreationDate          Comment                                                          
    ----------- ------- ------------          -------                                                          
          12359       7 10/19/2009 3:15:23 PM XML parser in Powershell RC doesn't like doctypes anymore (?)    
          11960       6 9/18/2009 12:51:45 PM                                                                  
          10733       5 7/9/2009 3:52:35 PM   put build info on links page                                     
          10363       4 6/19/2009 3:12:05 PM  Update master page for new silverlight URI format                
           9054       3 4/3/2009 1:35:47 AM                                                                    
           9044       2 4/2/2009 11:43:21 PM  fisheye                                                          
           9019       1 4/2/2009 6:38:18 PM   - alternate TickerLife project w/o BlackLight layout...