TFS: ChangeType is Add,Edit either for Edit or for Add

472 views Asked by At

1.txt is added and 2.txt is modified.

The problem is, the changeType is always "Add, Edit, Encoding"!

var tfs = ...;
var changeset = tfs.GetChangeset(new Uri("tfs path"), 999);
foreach (var w in changeset.Changes)
   Debug.Print( w.Item.ServerItem + " -> " + w.ChangeType );

//Output:
$/.../1.txt -> Add, Edit, Encoding
$/.../2.txt -> Add, Edit, Encoding

Does anybody know what happened to each file and why i always have these three types?

Thanks!

1

There are 1 answers

0
George Kosmidis On

A little late but happened to saw it unanswered so this is what i did:

var vcs = projects.GetService<VersionControlServer>();
foreach ( var w in changeset.Changes ) {
    w.Item.DownloadFile( tmpFile );
    var str = System.IO.File.ReadAllText( tmpFile );
    var bocs = GetCodeBytes( str, fileType.RemovesRegExp );
    try{
        Item previousItem = vcs.GetItem( w.Item.ItemId, Convert.ToInt32( iRevision - 1 ), true );
        previousItem.DownloadFile( tmpFile );
        var str2 = System.IO.File.ReadAllText( tmpFile );
        bocs = bocs - GetCodeBytes( str2, fileType.RemovesRegExp );
        changeTypeString = "mod";
    }
    catch{
        bocs = w.Item.ContentLength;
    }
}

That's not a working code, it's just the basic idea