Ejemplo n.º 1
0
 public StreamMetaData(DepotPath stream,
                       DepotPath parent,
                       StreamType type,
                       StreamType parenttype,
                       bool firmerthanParent,
                       bool changeflowstoparent,
                       bool changeflowsfromparent,
                       bool integtoparent,
                       IntegAction integtoparenthow,
                       string toresult,
                       bool integfromparent,
                       IntegAction integfromparenthow,
                       string fromresult
                       )
 {
     Stream                = stream;
     Parent                = parent;
     Type                  = type;
     ParentType            = parenttype;
     FirmerThanParent      = firmerthanParent;
     ChangeFlowsToParent   = changeflowstoparent;
     ChangeFlowsFromParent = changeflowsfromparent;
     IntegToParent         = IntegToParent;
     IntegToParentHow      = IntegToParentHow;
     ToResult              = toresult;
     IntegFromParent       = integfromparent;
     IntegFromParentHow    = integfromparenthow;
     FromResult            = fromresult;
 }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Parse the fields from a stream specification
        /// </summary>
        /// <param name="spec">Text of the stream specification in server format</param>
        /// <returns></returns>
        public bool Parse(String spec)
        {
            _baseForm = new FormBase();
            _baseForm.Parse(spec); // parse the values into the underlying dictionary
            GetSpecDefinition(_baseForm);

            Id          = ParseSingleString(_baseForm, "Stream");
            OwnerName   = ParseSingleString(_baseForm, "Owner");
            Name        = ParseSingleString(_baseForm, "Name");
            Description = ParseDescription(_baseForm);
            Ignored     = ParseView(_baseForm, "Ignored");
            Paths       = ParseView(_baseForm, "Paths");
            Remapped    = ParseView(_baseForm, "Remapped");
            View        = ParseView(_baseForm, "View");
            ChangeView  = ParseView(_baseForm, "ChangeView");
            Updated     = ParseDate(_baseForm, "Update");
            Accessed    = ParseDate(_baseForm, "Access");

            if (_baseForm.ContainsKey("Options"))
            {
                _options = _baseForm["Options"] as string;
                specDef.Remove("Options");
            }

            if (_baseForm.ContainsKey("Type"))
            {
                _type = _baseForm["Type"] as string;
                specDef.Remove("Type");
            }

            if (_baseForm.ContainsKey("ParentView"))
            {
                _parentView = (_baseForm["ParentView"].ToString() == "inherit") ? ParentView.Inherit : ParentView.NoInherit;
                //_parentView = _baseForm["ParentView"] as string;
                specDef.Remove("ParentView");
            }

            if (_baseForm.ContainsKey("Parent"))
            {
                string line = _baseForm["Parent"] as string;
                Parent = new DepotPath(line);
                specDef.Remove("Parent");
            }

            SetCustomFields();

            return(true);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Get the Directory this file is in by checking DepotPath, ClientPath and LocalPath as needed
 /// </summary>
 /// <returns>Directory name</returns>
 public string GetDirectoryName()
 {
     if ((DepotPath != null) && (string.IsNullOrEmpty(DepotPath.Path) == false))
     {
         return(DepotPath.GetDirectoryName());
     }
     else if ((ClientPath != null) && (string.IsNullOrEmpty(ClientPath.Path) == false))
     {
         return(ClientPath.GetDirectoryName());
     }
     else if ((LocalPath != null) && (string.IsNullOrEmpty(LocalPath.Path) == false))
     {
         return(LocalPath.GetDirectoryName());
     }
     return(null);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Fully parameterized constructor
 /// </summary>
 /// <param name="depotPath">Server Depot Path</param>
 /// <param name="clientPath">Client workspace Path</param>
 /// <param name="rev">Latest Revision of this file</param>
 /// <param name="haveRev">Revision of this file in the workspace</param>
 /// <param name="change">Change ID which contains this file</param>
 /// <param name="action">Last Action taken on this file</param>
 /// <param name="type">The file type</param>
 /// <param name="submittime">The time when the file was submitted</param>
 /// <param name="user">the User which created this file</param>
 /// <param name="client">the name of the client/workspace which contains this file</param>
 public File(
     DepotPath depotPath,
     ClientPath clientPath,
     Revision rev,
     Revision haveRev,
     int change,
     FileAction action,
     FileType type,
     DateTime submittime,
     string user,
     string client)
     : base(depotPath, clientPath, null, rev)
 {
     ChangeId   = change;
     Action     = action;
     Type       = type;
     SubmitTime = submittime;
     HaveRev    = haveRev;
     User       = user;
     Client     = client;
 }
Ejemplo n.º 6
0
 public void FromIstatCmdTaggedData(TaggedObject obj)
 {
     if (obj.ContainsKey("stream"))
     {
         string p = PathSpec.UnescapePath(obj["stream"]);
         Stream = new DepotPath(p);
     }
     if (obj.ContainsKey("parent"))
     {
         string p = PathSpec.UnescapePath(obj["parent"]);
         Parent = new DepotPath(p);
     }
     if (obj.ContainsKey("type"))
     {
         _type = (obj["type"]);
     }
     if (obj.ContainsKey("parentType"))
     {
         _parenttype = (obj["parentType"]);
     }
     if (obj.ContainsKey("firmerThanParent"))
     {
         bool value;
         bool.TryParse(obj["firmerThanParent"], out value);
         FirmerThanParent = value;
     }
     if (obj.ContainsKey("changeFlowsToParent"))
     {
         bool value;
         bool.TryParse(obj["changeFlowsToParent"], out value);
         ChangeFlowsToParent = value;
     }
     if (obj.ContainsKey("changeFlowsFromParent"))
     {
         bool value;
         bool.TryParse(obj["changeFlowsFromParent"], out value);
         ChangeFlowsFromParent = value;
     }
     if (obj.ContainsKey("integToParent"))
     {
         bool value;
         bool.TryParse(obj["integToParent"], out value);
         IntegToParent = value;
     }
     if (obj.ContainsKey("integToParentHow"))
     {
         _integtoparenthow = (obj["integToParentHow"]);
     }
     if (obj.ContainsKey("toResult"))
     {
         ToResult = obj["toResult"];
     }
     if (obj.ContainsKey("integFromParent"))
     {
         bool value;
         bool.TryParse(obj["integFromParent"], out value);
         IntegFromParent = value;
     }
     if (obj.ContainsKey("integFromParentHow"))
     {
         _integfromparenthow = (obj["integFromParentHow"]);
     }
     if (obj.ContainsKey("fromResult"))
     {
         FromResult = obj["fromResult"];
     }
 }
Ejemplo n.º 7
0
        private void PopulateCommonFields(TaggedObject objectInfo)
        {
            if (objectInfo.ContainsKey("Stream"))
            {
                Id = objectInfo["Stream"];
                specDef.Remove("Stream");
            }

            if (objectInfo.ContainsKey("Owner"))
            {
                OwnerName = objectInfo["Owner"];
                specDef.Remove("Owner");
            }

            if (objectInfo.ContainsKey("Name"))
            {
                Name = objectInfo["Name"];
                specDef.Remove("Name");
            }

            if (objectInfo.ContainsKey("Parent"))
            {
                Parent = new DepotPath(objectInfo["Parent"]);
                specDef.Remove("Parent");
            }

            if (objectInfo.ContainsKey("baseParent"))
            {
                BaseParent = new DepotPath(objectInfo["baseParent"]);
                specDef.Remove("baseParent");
            }

            if (objectInfo.ContainsKey("Type"))
            {
                _type = (objectInfo["Type"]);
                specDef.Remove("Type");
            }

            if (objectInfo.ContainsKey("Description"))
            {
                Description = objectInfo["Description"];
                specDef.Remove("Description");
            }

            if (objectInfo.ContainsKey("desc"))
            {
                Description = objectInfo["desc"];
                specDef.Remove("desc");
            }

            if (objectInfo.ContainsKey("Options"))
            {
                String optionsStr = objectInfo["Options"];
                _options = optionsStr;
                specDef.Remove("Options");
            }

            if (objectInfo.ContainsKey("firmerThanParent"))
            {
                FirmerThanParent = objectInfo["firmerThanParent"];
                specDef.Remove("firmerThanParent");
            }

            if (objectInfo.ContainsKey("changeFlowsToParent"))
            {
                ChangeFlowsToParent = objectInfo["changeFlowsToParent"];
                specDef.Remove("changeFlowsToParent");
            }

            if (objectInfo.ContainsKey("changeFlowsFromParent"))
            {
                ChangeFlowsFromParent = objectInfo["changeFlowsFromParent"];
                specDef.Remove("changeFlowsFromParent");
            }

            if (objectInfo.ContainsKey("ParentView"))
            {
                _parentView = (objectInfo["ParentView"]);
                specDef.Remove("ParentView");
            }
        }
Ejemplo n.º 8
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;
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Given tagged output from an "fstat" command instantiate this object.
        /// </summary>
        /// <param name="obj">Tagged output from fstat</param>
        public void FromFstatCmdTaggedData(TaggedObject obj)
        {
            if (obj.ContainsKey("clientFile"))
            {
                string path = obj["clientFile"];
                if (path.StartsWith("//"))
                {
                    ClientPath = new ClientPath(obj["clientFile"]);
                }
                else
                {
                    ClientPath = new ClientPath(obj["clientFile"]);
                    LocalPath  = new LocalPath(obj["clientFile"]);
                }
            }

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

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

            if (obj.ContainsKey("movedFile"))
            {
                MovedFile = new DepotPath(obj["movedFile"]);
                if (obj.ContainsKey("movedRev"))
                {
                    int movedrev = -1;
                    if (int.TryParse(obj["movedRev"], out movedrev))
                    {
                        MovedRev = movedrev;
                    }
                }
            }

            if (obj.ContainsKey("isMapped"))
            {
                IsMapped = true;
            }

            if (obj.ContainsKey("shelved"))
            {
                Shelved = true;
            }

            if (obj.ContainsKey("headAction"))
            {
                _headAction = obj["headAction"];
            }

            if (obj.ContainsKey("headChange"))
            {
                int r = -1;
                if (int.TryParse(obj["headChange"], out r))
                {
                    HeadChange = r;
                }
            }

            if (obj.ContainsKey("headRev"))
            {
                int r = -1;
                if (int.TryParse(obj["headRev"], out r))
                {
                    HeadRev = r;
                }
            }

            if (obj.ContainsKey("headType"))
            {
                HeadType = new FileType(obj["headType"]);
            }

            if (obj.ContainsKey("headTime"))
            {
                HeadTime = FormBase.ConvertUnixTime(obj["headTime"]);
            }

            if (obj.ContainsKey("headModTime"))
            {
                HeadModTime = FormBase.ConvertUnixTime(obj["headModTime"]);
            }

            if (obj.ContainsKey("haveRev"))
            {
                int r = -1;
                if ((int.TryParse(obj["haveRev"], out r)) && (r > 0))
                {
                    HaveRev = r;
                }
            }

            if (obj.ContainsKey("desc"))
            {
                Desc = obj["desc"];
            }

            if (obj.ContainsKey("digest"))
            {
                Digest = obj["digest"];
            }

            if (obj.ContainsKey("fileSize"))
            {
                long s = -1;
                if (long.TryParse(obj["fileSize"], out s))
                {
                    FileSize = s;
                }
            }

            if (obj.ContainsKey("action"))
            {
                _action = obj["action"];
            }

            if (obj.ContainsKey("type"))
            {
                Type = new FileType(obj["type"]);
            }
            else if (obj.ContainsKey("headType"))
            {
                // If not on mapped in current client, will not have
                //the Type filed so User the HeadType
                Type = new FileType(obj["headType"]);
            }
            else
            {
                Type = new FileType(BaseFileType.Text, FileTypeModifier.None);
            }

            if (obj.ContainsKey("actionOwner"))
            {
                ActionOwner = obj["actionOwner"];
            }

            if (obj.ContainsKey("change"))
            {
                int c = -1;
                if (int.TryParse(obj["change"], out c))
                {
                    Change = c;
                }
                else
                {
                    Change = 0;
                }
            }

            if (obj.ContainsKey("resolved"))
            {
                Resolved = true;
            }

            if (obj.ContainsKey("unresolved"))
            {
                Unresolved = true;
            }

            if (obj.ContainsKey("reresolvable"))
            {
                Reresolvable = true;
            }


            if (obj.ContainsKey("otherLock"))
            {
                OtherLock = true;
            }

            if (obj.ContainsKey("otherOpen"))
            {
                int cnt = 0;
                if (int.TryParse(obj["otherOpen"], out cnt))
                {
                    OtherOpen            = cnt;
                    OtherLockUserClients = new List <string>();
                }

                if (cnt > 0)
                {
                    OtherUsers = new OtherUsers();

                    OtherOpenUserClients = new List <String>();
                    OtherActions         = new List <FileAction>();
                    OtherChanges         = new List <int>();

                    for (int idx = 0; idx < cnt; idx++)
                    {
                        string        key             = String.Format("otherOpen{0}", idx);
                        string        otherClientName = null;
                        OtherFileUser ofi             = null;

                        if (obj.ContainsKey(key))
                        {
                            otherClientName = obj[key];
                            OtherOpenUserClients.Add(otherClientName);
                        }

                        ofi        = OtherUsers[otherClientName];
                        ofi.Client = otherClientName;

                        key = String.Format("otherAction{0}", idx);

                        if (obj.ContainsKey(key))
                        {
                            StringEnum <FileAction> otheraction = obj[key];
                            OtherActions.Add(otheraction);
                            ofi.Action = otheraction;
                        }

                        key = String.Format("otherChange{0}", idx);

                        if (obj.ContainsKey(key))
                        {
                            int otherchange;
                            if (!int.TryParse(obj[key], out otherchange))
                            {
                                otherchange = 0;
                            }
                            OtherChanges.Add(otherchange);

                            ofi.ChangelistId = otherchange;
                        }

                        key = String.Format("otherLock{0}", idx);

                        if (obj.ContainsKey(key))
                        {
                            string s = obj[key];
                            OtherLockUserClients.Add(s);

                            OtherUsers[s].hasLock = true;
                        }
                    }
                }
            }

            if (obj.ContainsKey("ourLock"))
            {
                OurLock = true;
            }

            if (obj.ContainsKey("resolved") || obj.ContainsKey("unresolved"))
            {
                int idx = 0;
                StringEnum <ResolveAction> resolveaction = ResolveAction.Unresolved;
                FileSpec          resolvebasefile        = null;
                FileSpec          resolvefromfile        = null;
                int               resolvestartfromrev    = -1;
                int               resolveendfromrev      = -1;
                FileResolveAction resolverecord          = null;

                ResolveRecords = new List <FileResolveAction>();

                while (true)
                {
                    string key = String.Format("resolveAction{0}", idx);

                    if (obj.ContainsKey(key))
                    {
                        resolveaction = obj[key];
                    }
                    else
                    {
                        break;
                    }

                    key = String.Format("resolveBaseFile{0}", idx);

                    if (obj.ContainsKey(key))
                    {
                        string basefile       = obj[key];
                        int    resolvebaserev = -1;
                        int.TryParse(obj[String.Format("resolveBaseRev{0}", idx)], out resolvebaserev);
                        resolvebasefile = new FileSpec(new DepotPath(basefile), new Revision(resolvebaserev));
                    }
                    else
                    {
                        break;
                    }

                    key = String.Format("resolveFromFile{0}", idx);

                    if (obj.ContainsKey(key))
                    {
                        string fromfile = obj[key];
                        int    startfromrev, endfromrev = -1;
                        int.TryParse(obj[String.Format("resolveStartFromRev{0}", idx)], out startfromrev);
                        int.TryParse(obj[String.Format("resolveEndFromRev{0}", idx)], out endfromrev);
                        resolvefromfile = new FileSpec(new DepotPath(fromfile),
                                                       new VersionRange(new Revision(startfromrev), new Revision(endfromrev)));
                    }
                    else
                    {
                        break;
                    }

                    resolverecord = new FileResolveAction
                                        (resolveaction, resolvebasefile, resolvefromfile, resolvestartfromrev, resolveendfromrev);
                    ResolveRecords.Add(resolverecord);

                    idx++;
                }
            }

            Attributes = new Dictionary <string, object>();

            foreach (string key in obj.Keys)
            {
                if (key.StartsWith("attr-"))
                {
                    object val   = obj[key];
                    string atrib = key.Replace("attr-", "");
                    Attributes.Add(atrib, val);
                }
            }

            AttributesProp = new Dictionary <string, object>();

            foreach (string key in obj.Keys)
            {
                if (key.StartsWith("attrProp-"))
                {
                    object val   = obj[key];
                    string atrib = key.Replace("attrProp-", "");
                    AttributesProp.Add(atrib, val);
                }
            }

            AttributeDigests = new Dictionary <string, object>();

            foreach (string key in obj.Keys)
            {
                if (key.StartsWith("attrDigest-"))
                {
                    object val         = obj[key];
                    string atribDigest = key.Replace("attrDigest-", "");
                    AttributeDigests.Add(atribDigest, val);
                }
            }

            OpenAttributes = new Dictionary <string, object>();

            foreach (string key in obj.Keys)
            {
                if (key.StartsWith("openattr-"))
                {
                    object val   = obj[key];
                    string atrib = key.Replace("openattr-", "");
                    OpenAttributes.Add(atrib, val);
                }
            }

            OpenAttributesProp = new Dictionary <string, object>();

            foreach (string key in obj.Keys)
            {
                if (key.StartsWith("openattrProp-"))
                {
                    object val   = obj[key];
                    string atrib = key.Replace("openattrProp-", "");
                    OpenAttributesProp.Add(atrib, val);
                }
            }

            if (obj.ContainsKey("totalFileCount"))
            {
                long s = -1;
                if (long.TryParse(obj["totalFileCount"], out s))
                {
                    TotalFileCount = s;
                }
            }

            if (obj.ContainsKey("dir"))
            {
                Directory = PathSpec.UnescapePath(obj["dir"]);
            }
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Parameterized constructor
 /// </summary>
 /// <param name="movedfile">was file moved?</param>
 /// <param name="ismapped">is file in workspace?</param>
 /// <param name="shelved">is file shelved</param>
 /// <param name="headaction">Last Action to File</param>
 /// <param name="headchange">Change ID</param>
 /// <param name="headrev">Head Revision</param>
 /// <param name="headtype">Type of File</param>
 /// <param name="headtime">Time file created</param>
 /// <param name="headmodtime">Last modified time</param>
 /// <param name="movedrev">Revision which was moved</param>
 /// <param name="haverev">Revision we have</param>
 /// <param name="desc">Description of File</param>
 /// <param name="digest">Digest for file</param>
 /// <param name="filesize">size of file</param>
 /// <param name="action">current action on file</param>
 /// <param name="type">file type</param>
 /// <param name="actionowner">owner of file</param>
 /// <param name="change">current change ID</param>
 /// <param name="resolved">Resolved</param>
 /// <param name="unresolved">Unresolved</param>
 /// <param name="reresolvable">Re-Resolvable</param>
 /// <param name="otheropen">How many others have file open?</param>
 /// <param name="otheropenuserclients">List of other clients with file open</param>
 /// <param name="otherlock">true if other user has file locked</param>
 /// <param name="otherlockuserclients">List of other clients locking this file</param>
 /// <param name="otheractions">List of other FileActions</param>
 /// <param name="otherchanges">List of other change ID's</param>
 /// <param name="ourlock">This file is locked by us</param>
 /// <param name="resolverecords">List of resolve records</param>
 /// <param name="attributes">Dictionary of attributes</param>
 /// <param name="attributesprop">Dictionary of attribute properties</param>
 /// <param name="attributedigests">Dictionary of attribute digests</param>
 /// <param name="openattributes">Dictionary of open attributes</param>
 /// <param name="openattributesprop">Dictionary of open attribute properties</param>
 /// <param name="totalfilecount">count of files</param>
 /// <param name="directory">location of file</param>
 public FileMetaData(DepotPath movedfile,
                     bool ismapped,
                     bool shelved,
                     FileAction headaction,
                     int headchange,
                     int headrev,
                     FileType headtype,
                     DateTime headtime,
                     DateTime headmodtime,
                     int movedrev,
                     int haverev,
                     string desc,
                     string digest,
                     int filesize,
                     FileAction action,
                     FileType type,
                     string actionowner,
                     int change,
                     bool resolved,
                     bool unresolved,
                     bool reresolvable,
                     int otheropen,
                     List <string> otheropenuserclients,
                     bool otherlock,
                     List <string> otherlockuserclients,
                     List <FileAction> otheractions,
                     List <int> otherchanges,
                     bool ourlock,
                     List <FileResolveAction> resolverecords,
                     Dictionary <String, Object> attributes,
                     Dictionary <String, Object> attributesprop,
                     Dictionary <String, Object> attributedigests,
                     Dictionary <String, Object> openattributes,
                     Dictionary <String, Object> openattributesprop,
                     long totalfilecount,
                     string directory
                     )
 {
     MovedFile            = movedfile;
     IsMapped             = ismapped;
     Shelved              = shelved;
     HeadAction           = headaction;
     HeadChange           = headchange;
     HeadRev              = headrev;
     HeadType             = headtype;
     HeadTime             = headtime;
     HeadModTime          = headmodtime;
     MovedRev             = movedrev;
     HaveRev              = haverev;
     Desc                 = desc;
     Digest               = digest;
     FileSize             = filesize;
     Action               = action;
     Type                 = type;
     ActionOwner          = actionowner;
     Change               = change;
     Resolved             = resolved;
     Unresolved           = unresolved;
     Reresolvable         = reresolvable;
     OtherOpen            = otheropen;
     OtherOpenUserClients = otheropenuserclients;
     OtherLock            = otherlock;
     OtherLockUserClients = otherlockuserclients;
     OtherActions         = otheractions;
     OtherChanges         = otherchanges;
     OurLock              = ourlock;
     ResolveRecords       = resolverecords;
     Attributes           = attributes;
     AttributesProp       = attributesprop;
     AttributeDigests     = attributedigests;
     OpenAttributes       = openattributes;
     OpenAttributesProp   = openattributesprop;
     TotalFileCount       = totalfilecount;
     Directory            = directory;
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Parse the fields from a stream specification
        /// </summary>
        /// <param name="spec">Text of the stream specification in server format</param>
        /// <returns></returns>
        public bool Parse(String spec)
        {
            _baseForm = new FormBase();
            _baseForm.Parse(spec);             // parse the values into the underlying dictionary

            if (_baseForm.ContainsKey("Stream"))
            {
                Id = _baseForm["Stream"] as string;
            }

            if (_baseForm.ContainsKey("Update"))
            {
                DateTime d;
                if (DateTime.TryParse(_baseForm["Update"] as string, out d))
                {
                    Updated = d;
                }
            }

            if (_baseForm.ContainsKey("Access"))
            {
                DateTime d;
                if (DateTime.TryParse(_baseForm["Access"] as string, out d))
                {
                    Accessed = d;
                }
            }

            if (_baseForm.ContainsKey("Owner"))
            {
                OwnerName = _baseForm["Owner"] as string;
            }

            if (_baseForm.ContainsKey("Name"))
            {
                Name = _baseForm["Name"] as string;
            }

            if (_baseForm.ContainsKey("Parent"))
            {
                string line = _baseForm["Parent"] as string;
                Parent = new DepotPath(line);
            }

            if (_baseForm.ContainsKey("Type"))
            {
                _type = _baseForm["Type"] as string;
            }

            if (_baseForm.ContainsKey("Description"))
            {
                Description = _baseForm["Description"] as string;
            }

            if (_baseForm.ContainsKey("Options"))
            {
                _options = _baseForm["Options"] as string;
            }

            return(true);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Read the fields from the tagged output of a 'stream' command
        /// </summary>
        /// <param name="objectInfo">Tagged output from the 'stream' command</param>
        public void FromStreamCmdTaggedOutput(TaggedObject objectInfo)
        {
            _baseForm = new FormBase();

            _baseForm.SetValues(objectInfo);

            if (objectInfo.ContainsKey("Stream"))
            {
                Id = objectInfo["Stream"];
            }

            if (objectInfo.ContainsKey("Update"))
            {
                DateTime v = DateTime.MinValue;
                DateTime.TryParse(objectInfo["Update"], out v);
                Updated = v;
            }

            if (objectInfo.ContainsKey("Access"))
            {
                DateTime v = DateTime.MinValue;
                DateTime.TryParse(objectInfo["Access"], out v);
                Accessed = v;
            }

            if (objectInfo.ContainsKey("Owner"))
            {
                OwnerName = objectInfo["Owner"];
            }

            if (objectInfo.ContainsKey("Name"))
            {
                Name = objectInfo["Name"];
            }

            if (objectInfo.ContainsKey("Parent"))
            {
                Parent = new DepotPath(objectInfo["Parent"]);
            }

            if (objectInfo.ContainsKey("baseParent"))
            {
                BaseParent = new DepotPath(objectInfo["baseParent"]);
            }

            if (objectInfo.ContainsKey("Type"))
            {
                _type = (objectInfo["Type"]);
            }

            if (objectInfo.ContainsKey("Description"))
            {
                Description = objectInfo["Description"];
            }

            if (objectInfo.ContainsKey("Options"))
            {
                String optionsStr = objectInfo["Options"];
                _options = optionsStr;
            }

            if (objectInfo.ContainsKey("firmerThanParent"))
            {
                FirmerThanParent = objectInfo["firmerThanParent"];
            }

            if (objectInfo.ContainsKey("changeFlowsToParent"))
            {
                ChangeFlowsToParent = objectInfo["changeFlowsToParent"];
            }

            if (objectInfo.ContainsKey("changeFlowsFromParent"))
            {
                ChangeFlowsFromParent = objectInfo["changeFlowsFromParent"];
            }

            int    idx = 0;
            string key = String.Format("Paths{0}", idx);

            if (objectInfo.ContainsKey(key))
            {
                Paths = new ViewMap();
                while (objectInfo.ContainsKey(key))
                {
                    Paths.Add(objectInfo[key]);
                    idx++;
                    key = String.Format("Paths{0}", idx);
                }
            }
            else
            {
                Paths = null;
            }

            idx = 0;
            key = String.Format("Remapped{0}", idx);
            if (objectInfo.ContainsKey(key))
            {
                Remapped = new ViewMap();
                PathSpec LeftPath  = new ClientPath(string.Empty);
                PathSpec RightPath = new ClientPath(string.Empty);
                MapEntry Remap     = new MapEntry(MapType.Include, LeftPath, RightPath);

                while (objectInfo.ContainsKey(key))
                {
                    string   l = (objectInfo[key]);
                    string[] p = l.Split(' ');
                    LeftPath  = new ClientPath(p[0]);
                    RightPath = new ClientPath(p[1]);
                    Remap     = new MapEntry(MapType.Include, LeftPath, RightPath);
                    Remapped.Add(Remap);
                    idx++;
                    key = String.Format("Remapped{0}", idx);
                }
            }
            else
            {
                Remapped = null;
            }

            idx = 0;
            key = String.Format("Ignored{0}", idx);
            if (objectInfo.ContainsKey(key))
            {
                Ignored = new ViewMap();
                PathSpec LeftPath  = new ClientPath(string.Empty);
                PathSpec RightPath = new ClientPath(string.Empty);
                MapEntry Ignore    = new MapEntry(MapType.Include, LeftPath, RightPath);

                while (objectInfo.ContainsKey(key))
                {
                    string   l = (objectInfo[key]);
                    string[] p = l.Split(' ');
                    LeftPath = new ClientPath(p[0]);
                    if (p.Length > 1)
                    {
                        RightPath = new ClientPath(p[1]);
                    }
                    Ignore = new MapEntry(MapType.Include, LeftPath, RightPath);
                    Ignored.Add(Ignore);
                    idx++;
                    key = String.Format("Ignored{0}", idx);
                }
            }
            else
            {
                Ignored = null;
            }

            idx = 0;
            key = String.Format("View{0}", idx);
            if (objectInfo.ContainsKey(key))
            {
                View = new ViewMap();
                while (objectInfo.ContainsKey(key))
                {
                    View.Add(objectInfo[key]);
                    idx++;
                    key = String.Format("View{0}", idx);
                }
            }
            else
            {
                View = null;
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Read the fields from the tagged output of a 'streams' command
        /// </summary>
        /// <param name="objectInfo">Tagged output from the 'streams' command</param>
        /// <param name="offset">Date processing</param>
        /// <param name="dst_mismatch">DST for date</param>
        public void FromStreamsCmdTaggedOutput(TaggedObject objectInfo, string offset, bool dst_mismatch)
        {
            _baseForm = new FormBase();

            _baseForm.SetValues(objectInfo);

            if (objectInfo.ContainsKey("Stream"))
            {
                Id = objectInfo["Stream"];
            }

            if (objectInfo.ContainsKey("Update"))
            {
                DateTime UTC = FormBase.ConvertUnixTime(objectInfo["Update"]);
                DateTime GMT = new DateTime(UTC.Year, UTC.Month, UTC.Day, UTC.Hour, UTC.Minute, UTC.Second,
                                            DateTimeKind.Unspecified);
                Updated = FormBase.ConvertFromUTC(GMT, offset, dst_mismatch);
            }

            if (objectInfo.ContainsKey("Access"))
            {
                DateTime UTC = FormBase.ConvertUnixTime(objectInfo["Access"]);
                DateTime GMT = new DateTime(UTC.Year, UTC.Month, UTC.Day, UTC.Hour, UTC.Minute, UTC.Second,
                                            DateTimeKind.Unspecified);
                Accessed = FormBase.ConvertFromUTC(GMT, offset, dst_mismatch);
            }

            if (objectInfo.ContainsKey("Owner"))
            {
                OwnerName = objectInfo["Owner"];
            }

            if (objectInfo.ContainsKey("Name"))
            {
                Name = objectInfo["Name"];
            }

            if (objectInfo.ContainsKey("Parent"))
            {
                Parent = new DepotPath(objectInfo["Parent"]);
            }

            if (objectInfo.ContainsKey("baseParent"))
            {
                BaseParent = new DepotPath(objectInfo["baseParent"]);
            }

            if (objectInfo.ContainsKey("Type"))
            {
                _type = (objectInfo["Type"]);
            }

            if (objectInfo.ContainsKey("desc"))
            {
                Description = objectInfo["desc"];
            }

            if (objectInfo.ContainsKey("Options"))
            {
                String optionsStr = objectInfo["Options"];
                _options = optionsStr;
            }

            if (objectInfo.ContainsKey("firmerThanParent"))
            {
                FirmerThanParent = objectInfo["firmerThanParent"];
            }

            if (objectInfo.ContainsKey("changeFlowsToParent"))
            {
                ChangeFlowsToParent = objectInfo["changeFlowsToParent"];
            }

            if (objectInfo.ContainsKey("changeFlowsFromParent"))
            {
                ChangeFlowsFromParent = objectInfo["changeFlowsFromParent"];
            }

            int    idx = 0;
            string key = String.Format("Paths{0}", idx);

            if (objectInfo.ContainsKey(key))
            {
                ViewMap Paths                  = new ViewMap();
                StringEnum <MapType> map       = null;
                PathSpec             LeftPath  = null;
                PathSpec             RightPath = null;
                MapEntry             Path      = new MapEntry(map, LeftPath, RightPath);

                while (objectInfo.ContainsKey(key))
                {
                    string   l = (objectInfo[key]);
                    string[] p = l.Split(' ');
                    map       = p[0];
                    LeftPath  = new DepotPath(p[1]);
                    RightPath = new DepotPath(p[2]);
                    Path      = new MapEntry(map, LeftPath, RightPath);
                    Paths.Add(Path);
                    idx++;
                    key = String.Format("Paths{0}", idx);
                }
            }

            idx = 0;
            key = String.Format("Remapped{0}", idx);
            if (objectInfo.ContainsKey(key))
            {
                ViewMap  Remapped  = new ViewMap();
                PathSpec LeftPath  = null;
                PathSpec RightPath = null;
                MapEntry Remap     = new MapEntry(MapType.Include, LeftPath, RightPath);

                while (objectInfo.ContainsKey(key))
                {
                    string   l = (objectInfo[key]);
                    string[] p = l.Split(' ');
                    LeftPath  = new DepotPath(p[0]);
                    RightPath = new DepotPath(p[1]);
                    Remap     = new MapEntry(MapType.Include, LeftPath, RightPath);
                    Remapped.Add(Remap);
                    idx++;
                    key = String.Format("Remapped{0}", idx);
                }
            }

            idx = 0;
            key = String.Format("Ignored{0}", idx);
            if (objectInfo.ContainsKey(key))
            {
                List <FileSpec> Ignored = new List <FileSpec>();
                FileSpec        ignore  = new FileSpec(new DepotPath(string.Empty), null);

                while (objectInfo.ContainsKey(key))
                {
                    string i = (objectInfo[key]);
                    ignore = new FileSpec(new DepotPath(i), null);
                    Ignored.Add(ignore);
                    idx++;
                    key = String.Format("Remapped{0}", idx);
                }
            }
            else
            {
                Ignored = null;
            }
        }