Exemple #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="dp">DepotPath</param>
        /// <param name="cp">ClientPath</param>
        /// <param name="lp">LocalPath</param>
        /// <param name="version">VersionSpec</param>
        public FileSpec(DepotPath dp, ClientPath cp, LocalPath lp, VersionSpec version)
        {
            DepotPath  = dp;
            ClientPath = cp;
            LocalPath  = lp;

            Version = version;
        }
Exemple #2
0
 /// <summary>
 /// A revision range specifier consisting of a lower and upper revision.
 /// </summary>
 ///<param name="lower">version spec to get lower revision</param>
 ///<param name="upper">version spec to get upper revision</param>
 public VersionRange(VersionSpec lower, VersionSpec upper)
 {
     if (lower == null)
     {
         throw new ArgumentNullException("lower");
     }
     if (upper == null)
     {
         throw new ArgumentNullException("upper");
     }
     Lower = lower;
     Upper = upper;
 }
Exemple #3
0
 /// <summary>
 /// Constructor given path and version
 /// </summary>
 /// <param name="path">location of the file</param>
 /// <param name="version">version of the file</param>
 public FileSpec(PathSpec path, VersionSpec version)
 {
     if (path.GetType() == typeof(DepotPath))
     {
         DepotPath  = (DepotPath)path;
         ClientPath = null;
         LocalPath  = null;
     }
     else if (path.GetType() == typeof(ClientPath))
     {
         DepotPath  = null;
         ClientPath = (ClientPath)path;
         LocalPath  = null;
     }
     else if (path.GetType() == typeof(LocalPath))
     {
         DepotPath  = null;
         ClientPath = null;
         LocalPath  = (LocalPath)path;
     }
     Version = version;
 }
Exemple #4
0
 /// <summary>
 /// Create a FileSpec given a local file path and VersionSpec
 /// </summary>
 /// <param name="path">local file path</param>
 /// <param name="ver">VersionSpec</param>
 /// <returns></returns>
 public static FileSpec LocalSpec(String path, VersionSpec ver)
 {
     return(new FileSpec(new LocalPath(path), ver));
 }
Exemple #5
0
 /// <summary>
 /// Create a FileSpec given a depot path and VersionSpec
 /// </summary>
 /// <param name="path">depot path</param>
 /// <param name="ver">VersionSpec</param>
 /// <returns></returns>
 public static FileSpec DepotSpec(String path, VersionSpec ver)
 {
     return(new FileSpec(new DepotPath(path), ver));
 }
Exemple #6
0
 /// <summary>
 /// Create a FileSpec given Client path and VersionSpec
 /// </summary>
 /// <param name="path">client path</param>
 /// <param name="ver">VersionSpec</param>
 /// <returns>FileSpec</returns>
 public static FileSpec ClientSpec(String path, VersionSpec ver)
 {
     return(new FileSpec(new ClientPath(path), ver));
 }
Exemple #7
0
        public void ParseIntegratedCmdTaggedData(TaggedObject obj)
        {
            DepotPath   tp         = null;
            VersionSpec starttorev = null;
            VersionSpec endtorev   = null;

            if (obj.ContainsKey("toFile"))
            {
                string p = PathSpec.UnescapePath(obj["toFile"]);
                tp = new DepotPath(p);
            }

            if (obj.ContainsKey("startToRev"))
            {
                string str = obj["startToRev"];
                starttorev = new Revision(-1);

                if (str.StartsWith("#h")
                    |
                    str.StartsWith("#n"))
                {
                    if (str.Contains("#none"))
                    {
                        starttorev = Revision.None;
                    }

                    if (str.Contains("#have"))
                    {
                        starttorev = Revision.Have;
                    }

                    if (str.Contains("#head"))
                    {
                        starttorev = Revision.Head;
                    }
                }
                else
                {
                    str = str.Trim('#');
                    int rev = Convert.ToInt16(str);
                    starttorev = new Revision(rev);
                }
            }

            if (obj.ContainsKey("endToRev"))
            {
                string etr = obj["endToRev"];
                endtorev = new Revision(-1);

                if (etr.StartsWith("#h")
                    |
                    etr.StartsWith("#n"))
                {
                    if (etr.Contains("#none"))
                    {
                        endtorev = Revision.None;
                    }

                    if (etr.Contains("#have"))
                    {
                        endtorev = Revision.Have;
                    }

                    if (etr.Contains("#head"))
                    {
                        endtorev = Revision.Head;
                    }
                }
                else
                {
                    etr = etr.Trim('#');
                    int rev = Convert.ToInt16(etr);
                    endtorev = new Revision(rev);
                }
            }

            ToFile = new FileSpec(tp, null, null, new VersionRange(starttorev, endtorev));

            DepotPath   fp           = null;
            VersionSpec startfromrev = null;
            VersionSpec endfromrev   = null;

            if (obj.ContainsKey("fromFile"))
            {
                string p = PathSpec.UnescapePath(obj["fromFile"]);
                fp = new DepotPath(p);
            }

            if (obj.ContainsKey("startFromRev"))
            {
                string sfr = obj["startFromRev"];
                startfromrev = new Revision(-1);

                if (sfr.StartsWith("#h")
                    |
                    sfr.StartsWith("#n"))
                {
                    if (sfr.Contains("#none"))
                    {
                        startfromrev = Revision.None;
                    }

                    if (sfr.Contains("#have"))
                    {
                        startfromrev = Revision.Have;
                    }

                    if (sfr.Contains("#head"))
                    {
                        startfromrev = Revision.Head;
                    }
                }
                else
                {
                    sfr = sfr.Trim('#');
                    int rev = Convert.ToInt16(sfr);
                    startfromrev = new Revision(rev);
                }
            }

            if (obj.ContainsKey("endFromRev"))
            {
                string efr = obj["endFromRev"];
                endfromrev = new Revision(-1);

                if (efr.StartsWith("#h")
                    |
                    efr.StartsWith("#n"))
                {
                    if (efr.Contains("#none"))
                    {
                        endfromrev = Revision.None;
                    }

                    if (efr.Contains("#have"))
                    {
                        endfromrev = Revision.Have;
                    }

                    if (efr.Contains("#head"))
                    {
                        endfromrev = Revision.Head;
                    }
                }
                else
                {
                    efr = efr.Trim('#');
                    int rev = Convert.ToInt16(efr);
                    endfromrev = new Revision(rev);
                }
            }

            FromFile = new FileSpec(fp, null, null, new VersionRange(startfromrev, endfromrev));

            if (obj.ContainsKey("how"))
            {
                How = (IntegrateAction) new StringEnum <IntegrateAction>(obj["how"], true, true);
            }

            if (obj.ContainsKey("change"))
            {
                int change = -1;
                int.TryParse(obj["change"], out change);
                ChangeId = change;
            }
        }
        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);
        }