none
Cannot get Warnings/Conflicts list when doing Workspace.Get with GetOptions.Preview

    คำถาม

  • Hi all,

    I would like to run an API version of the commandline command:
    tf get /recursive /force /preview "<itempath>"

    That is:

    var getreq = new GetRequest(new ItemSpec(@"<itempath>", RecursionType.Full), VersionSpec.Latest);
    var status = myWorkspace.Get(getreq, GetOptions.Preview | GetOptions.GetAll | GetOptions.Overwrite);
    Console.WriteLine("NumWarnings=" + status.NumWarnings);
    Console.WriteLine("Failures:" + status.GetFailures().Count());
    Console.WriteLine("Conflicts:"+myWorkspace.QueryConflicts(new string[] {"<itempath>"}, true).Count());

    I see that the number of warnings is 7 but I cannot get any failures or conflicts.



    • แก้ไขโดย Mark Babayev 5 มีนาคม 2555 16:14
    5 มีนาคม 2555 16:12

คำตอบ

  • Hi all,

    The solution is found:

    var vcServer = (VersionControlServer)tfscoll.GetService(typeof(VersionControlServer));
    Workspace myWorkspace = vcext.Explorer.Workspace;
    vcServer.Getting += new GettingEventHandler(vcServer_Getting);
    var getreq = new GetRequest(new ItemSpec(sourcePath, RecursionType.Full), VersionSpec.Latest);
    var status = myWorkspace.Get(getreq, GetOptions.Preview);
    vcServer.Getting -= new GettingEventHandler(vcServer_Getting);

    void vcServer_Getting(object sender, GettingEventArgs e)
    {
          string warning = "";
          string fileName = Path.GetFileName(e.TargetLocalItem);
          string message = e.GetMessage(fileName, out warning); 
          PrintOutputWindow(e.Status+", "+e.TargetLocalItem+", "+message+", "+warning);
    }



    • ทำเครื่องหมายเป็นคำตอบโดย Mark Babayev 15 มีนาคม 2555 14:59
    • แก้ไขโดย Mark Babayev 15 มีนาคม 2555 15:00
    15 มีนาคม 2555 14:59

ตอบทั้งหมด

  • When you use the /preview option, conflicts aren't filed. (This is because it's a preview.) And there can be no failures, since the set of operations returned from the server isn't actually executed. An example of a failure might be a file that has a new version on the server, but it can't be replaced on disk because it's locked by another process.
    7 มีนาคม 2555 0:32
  • Hi markolog,

    How about the issue now?

    P.Kelley has provided information in the reply.

    If anything is unclear, please free feel to let me know.

    Best Regards,


    Lily Wu [MSFT]
    MSDN Community Support | Feedback to us

    7 มีนาคม 2555 4:44
  • Hi all,

    The solution is found:

    var vcServer = (VersionControlServer)tfscoll.GetService(typeof(VersionControlServer));
    Workspace myWorkspace = vcext.Explorer.Workspace;
    vcServer.Getting += new GettingEventHandler(vcServer_Getting);
    var getreq = new GetRequest(new ItemSpec(sourcePath, RecursionType.Full), VersionSpec.Latest);
    var status = myWorkspace.Get(getreq, GetOptions.Preview);
    vcServer.Getting -= new GettingEventHandler(vcServer_Getting);

    void vcServer_Getting(object sender, GettingEventArgs e)
    {
          string warning = "";
          string fileName = Path.GetFileName(e.TargetLocalItem);
          string message = e.GetMessage(fileName, out warning); 
          PrintOutputWindow(e.Status+", "+e.TargetLocalItem+", "+message+", "+warning);
    }



    • ทำเครื่องหมายเป็นคำตอบโดย Mark Babayev 15 มีนาคม 2555 14:59
    • แก้ไขโดย Mark Babayev 15 มีนาคม 2555 15:00
    15 มีนาคม 2555 14:59