Forcing TFS file verification through C #

How can I indicate that I ALWAYS want the local file to replace the server copy, even if the TFS copy is newer?


if (pendingChanges.GetUpperBound(0)>-1)
   ChangeSetNumber = workspace.CheckIn(pendingChanges, filename);

I can see from intelisense that I can specify checkinoptions as a parameter of the CheckIn method, I just can’t find what I need so that it is always checked and ignores any conflict. may occur.

Thanks in advance.
EDIT: I found the TF RESOLVE command "item" / auto: AcceptYours / recursive. So, I think my revised question would be to program equlivant for the / auto: AcceptYours switch?
NecroEDIT: handle conflicts before checking

Conflict [] conflicts = workspace.QueryConflicts (new string [] {TFSProject}, true);

foreach (Conflict conflict in conflicts)
{
    conflict.Resolution = Resolution.AcceptTheirs;
    workspace.ResolveConflict (conflict);
}
+3
source share
1 answer

Checks are atomic β€” either they all succeed, or they all fail. If there are any conflicts that need to be resolved before validation, the validation operation will throw an exception. (Documentation)

You must evaluate the checkin for conflicts and then resolve CheckinConflicts using the Workspace.ResolveConflict method. ResolveConflict expects a CheckinConflict, and the result of EvaluateCheckin (which is a CheckinEvaluationResult) includes CheckinConflicts.

This page may help.

Note: checkinoptions are not related to what you are asking.

Hope this helps.

+1
source

Source: https://habr.com/ru/post/1698424/


All Articles