示例#1
0
        public VersionedAsset ToVersionedAsset(ExtendedItem eachItem)
        {
            VersionedAsset asset = new VersionedAsset(GetAssetPath(eachItem, Workspace));

            asset.SetChangeListID(eachItem.VersionLocal.ToString());
            asset.SetRevision(eachItem.VersionLocal.ToString());

            if (asset.ExistsOnDisk)
            {
                asset.AddState(State.kLocal);
            }
            else
            {
                asset.AddState(State.kMissing);
            }

            if (eachItem.IsInWorkspace)
            {
                if (eachItem.IsLatest)
                {
                    asset.AddState(State.kSynced);
                }
                else
                {
                    asset.AddState(State.kOutOfSync);
                }
            }

            if (Workspace.Location == Microsoft.TeamFoundation.VersionControl.Common.WorkspaceLocation.Local)
            {
                ApplyStatusFromExtendedItem(asset, eachItem);
            }

            return(asset);
        }
示例#2
0
        private void GetConflictInfo(TfsTask task, string assetPath, string tmpFile, out VersionedAsset mine, out VersionedAsset theirs, out VersionedAsset baseAsset)
        {
            mine      = null;
            theirs    = null;
            baseAsset = null;

            var conflicts = task.Workspace.QueryConflicts(new[] { assetPath }, false);

            if (conflicts.Length > 0)
            {
                var conflict = conflicts[0];

                mine = new VersionedAsset(assetPath);

                theirs = new VersionedAsset(tmpFile + "_" + conflict.TheirVersion.ToString());
                theirs.SetRevision(conflict.TheirVersion.ToString());
                conflict.DownloadTheirFile(theirs.GetPath());

                baseAsset = new VersionedAsset(tmpFile + "_" + conflict.BaseVersion.ToString());
                baseAsset.SetRevision(conflict.BaseVersion.ToString());
                conflict.DownloadBaseFile(baseAsset.GetPath());
            }
        }