Example #1
0
        public static FileResolveRecord FromResolvedCmdTaggedOutput(TaggedObject obj)
        {
            FileResolveRecord frr = new FileResolveRecord();
            int startRev          = -1;
            int endRev            = -1;

            if (obj.ContainsKey("path"))
            {
                frr.LocalFilePath = new LocalPath(obj["path"]);
            }

            if (obj.ContainsKey("startToRev"))
            {
                int.TryParse(obj["startToRev"].Trim('#'), out startRev);
            }
            if (obj.ContainsKey("endToRev"))
            {
                int.TryParse(obj["endToRev"].Trim('#'), out endRev);
            }
            if (obj.ContainsKey("clientFile"))
            {
                VersionRange versions = null;
                if ((startRev >= 0) && (endRev >= 0))
                {
                    versions = new VersionRange(startRev, endRev);
                }

                frr.BaseFileSpec = new FileSpec(new LocalPath(obj["clientFile"]), versions);
            }
            else if (obj.ContainsKey("toFile"))
            {
                VersionRange versions = null;
                if ((startRev >= 0) && (endRev >= 0))
                {
                    versions = new VersionRange(startRev, endRev);
                }
                frr.BaseFileSpec = new FileSpec(new ClientPath(obj["toFile"]), versions);
            }

            if (obj.ContainsKey("startFromRev"))
            {
                int.TryParse(obj["startFromRev"].Trim('#'), out startRev);
            }
            if (obj.ContainsKey("endFromRev"))
            {
                int.TryParse(obj["endFromRev"].Trim('#'), out endRev);
            }
            if (obj.ContainsKey("fromFile"))
            {
                VersionRange versions = null;
                if ((startRev >= 0) && (endRev >= 0))
                {
                    versions = new VersionRange(startRev, endRev);
                }
                frr.FromFileSpec = new FileSpec(new DepotPath(obj["fromFile"]), versions);
            }
            if (obj.ContainsKey("how"))
            {
                frr._action = obj["how"];
            }
            return(frr);
        }
Example #2
0
        public static FileResolveRecord FromResolveCmdTaggedOutput(TaggedObject obj)
        {
            FileResolveRecord frr = new FileResolveRecord();
            int startRev          = -1;
            int endRev            = -1;

            if (obj.ContainsKey("clientFile"))
            {
                frr.LocalFilePath = new LocalPath(obj["clientFile"]);
            }
            if (obj.ContainsKey("baseFile"))
            {
                int         baseRev = -1;
                VersionSpec vs      = null;
                if (obj.ContainsKey("baseRev"))
                {
                    if (int.TryParse(obj["baseRev"], out baseRev))
                    {
                        vs = new Revision(baseRev);
                    }
                }
                frr.BaseFileSpec = new FileSpec(new DepotPath(obj["baseFile"]), vs);
            }

            if (obj.ContainsKey("startFromRev"))
            {
                int.TryParse(obj["startFromRev"], out startRev);
            }
            if (obj.ContainsKey("endFromRev"))
            {
                int.TryParse(obj["endFromRev"], out endRev);
            }
            if (obj.ContainsKey("fromFile"))
            {
                VersionRange versions = null;
                if ((startRev >= 0) && (endRev >= 0))
                {
                    versions = new VersionRange(startRev, endRev);
                }
                frr.FromFileSpec = new FileSpec(new DepotPath(obj["fromFile"]), versions);
            }
            if (obj.ContainsKey("how"))
            {
                frr._action = obj["how"];
            }
            else
            {
                frr.Action = FileAction.None;
            }
            if (obj.ContainsKey("resolveType"))
            {
                frr._resolveType = obj["resolveType"];
            }
            else
            {
                frr.ResolveType = ResolveType.None;
            }
            if (obj.ContainsKey("contentResolveType"))
            {
                switch (obj["contentResolveType"])
                {
                case "3waytext":
                    frr.ResolveSubtype = ResolveSubtype.ThreeWayText;
                    break;

                case "3wayraw":
                    frr.ResolveSubtype = ResolveSubtype.ThreeWayRaw;
                    break;

                case "2wayraw":
                    frr.ResolveSubtype = ResolveSubtype.TwoWayRaw;
                    break;

                default:
                    frr.ResolveSubtype = ResolveSubtype.None;
                    break;
                }
            }
            else
            {
                frr.ResolveSubtype = ResolveSubtype.None;
            }
            return(frr);
        }