Esempio n. 1
0
        public void UpdateChangeListInfo()
        {
            string changelist = TerrainGlobals.getPerforce().getConnection().P4Cmd("change -o ", ID.ToString(), "");

            ParseChanges(changelist);
            mbKnownDirty = false;
        }
Esempio n. 2
0
        /// <summary>
        /// Do you want a file in a change list.  This will accomplish the goal in several ways.
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="reopen">pulls the file from another one of the user's change list into this one</param>
        /// <returns></returns>
        public bool AddOrEdit(string fileName, bool reopen)
        {
            SimpleFileStatus status = TerrainGlobals.getPerforce().GetFileStatusSimple(fileName);

            if (status.State == eFileState.NotInPerforce)
            {
                return(AddFile(fileName));
            }
            //else if (status.IsLatestRevision == false)
            //{
            //   return EditFile(fileName);
            //}
            else if (reopen && status.CheckedOutThisUser == true)
            {
                if (status.UserChangeListNumber != ID)
                {
                    return(ReOpenFile(fileName));//yoink
                }
                else
                {
                    return(true);//we already have it!
                }
            }
            else
            {
                return(EditFile(fileName));
            }
        }
Esempio n. 3
0
        public bool Submitchanges()
        {
            bool result = TerrainGlobals.getPerforce().getConnection().P4Submit(ID);

            mbKnownDirty = true;
            return(result);
        }
Esempio n. 4
0
        public bool RevertFile(string fileName)
        {
            bool result = TerrainGlobals.getPerforce().getConnection().P4Revert(ID, fileName);

            mbKnownDirty = true;
            return(result);
        }
Esempio n. 5
0
        public bool EditFile(string fileName)
        {
            bool result  = TerrainGlobals.getPerforce().getConnection().P4Sync(fileName);
            bool result2 = TerrainGlobals.getPerforce().getConnection().P4Checkout(ID, fileName);

            mbKnownDirty = true;
            return(result);
        }
Esempio n. 6
0
            public P4Resource(PerforceChangeList list, string localName, string perforceName, string perforceAction)
            {
                mList           = list;
                mLocalName      = localName;
                mPerforceName   = perforceName;
                mPerforceAction = (ePerforceAction)Enum.Parse(typeof(ePerforceAction), perforceAction, true);

                mStatus = TerrainGlobals.getPerforce().getConnection().P4GetFileStatus(mPerforceName);
            }
Esempio n. 7
0
        public bool HasFilesOpen(int changelistID)
        {
            string results = TerrainGlobals.getPerforce().getConnection().P4Cmd("opened -c " + changelistID.ToString(), "", "");

            if (TerrainGlobals.getPerforce().getConnection().mLastError.Contains("not opened"))
            {
                return(false);
            }
            return(true);
        }
Esempio n. 8
0
 public void Refresh()
 {
     if (mStatus.ContainsKey("depotFile"))
     {
         mStatus = TerrainGlobals.getPerforce().getConnection().P4GetFileStatus(mStatus["depotFile"]);
     }
     else
     {
         mStatus = TerrainGlobals.getPerforce().getConnection().P4GetFileStatus(mFileName);
     }
     ComputeState();
 }
Esempio n. 9
0
        public bool RemoveListAndRevert()
        {
            if (mbListAlive == false)
            {
                return(false);
            }
            bool result = true;

            result &= Revert();
            result &= TerrainGlobals.getPerforce().getConnection().P4DeleteList(ID);

            mbListAlive = false;

            return(result);
        }
Esempio n. 10
0
        public void CleanEmptyChangeLists(string prefix)
        {
            Dictionary <int, string> lists = TerrainGlobals.getPerforce().GetCurrentUserChangelists();

            Dictionary <int, string> .Enumerator it = lists.GetEnumerator();

            while (it.MoveNext())
            {
                if (it.Current.Value.StartsWith(prefix))
                {
                    if (TerrainGlobals.getPerforce().HasFilesOpen(it.Current.Key) == false)
                    {
                        //TerrainGlobals.ShowMessage("Deleting empty changelist:" + it.Current.Value);
                        TerrainGlobals.getPerforce().getConnection().P4DeleteList(it.Current.Key);
                    }
                }
            }
        }
Esempio n. 11
0
        //Change 35576 on 2007/07/10 by Pthomas@SYS487 *pending* 'Auto import gr2: D:\x\work\art\'
        //List<Pair<string,int>>
        public Dictionary <int, string> GetCurrentUserChangelists()
        {
            Dictionary <int, string> lists = new Dictionary <int, string>();
            string userName;

            if (TerrainGlobals.getPerforce().getConnection().mSettings.TryGetValue("User name", out userName))
            {
                string results = TerrainGlobals.getPerforce().getConnection().P4Cmd("changes -l -s pending -u " + userName, "", "");

                StringReader res = new StringReader(results);

                string line = res.ReadLine();
                while (line != null && line != "")
                {
                    string[] tokens = line.Split(' ');
                    int      id     = -1;
                    int.TryParse(tokens[1], out id);
                    res.ReadLine(); //blank
                    string name = res.ReadLine().Trim();
                    //string name = line.Substring(1 + line.IndexOf('\''), -2 + line.Length - line.IndexOf('\''));
                    lists[id] = name;

                    //res.ReadLine();  //blank
                    //line = res.ReadLine();
                    line = res.ReadLine();
                    while (line != null)// && line != "" )
                    {
                        if (line.StartsWith("Change"))
                        {
                            break; //next entry
                        }
                        else
                        {
                            //could appened to description.. but that doesn't matter to us
                        }
                        line = res.ReadLine();
                    }
                }
            }

            return(lists);
        }
Esempio n. 12
0
 public bool SyncFile(string fileName)
 {
     return(TerrainGlobals.getPerforce().getConnection().P4Sync(fileName));
 }
Esempio n. 13
0
 public string GetLastError()
 {
     return(TerrainGlobals.getPerforce().getConnection().mLastError);
 }
Esempio n. 14
0
 public bool Revert()
 {
     return(TerrainGlobals.getPerforce().getConnection().P4Revert(mList.ID, mPerforceName));
 }
Esempio n. 15
0
 public bool SyncToLatest()
 {
     return(TerrainGlobals.getPerforce().getConnection().P4Sync(mStatus["depotFile"]));
 }