Exemplo n.º 1
0
        /// <summary>
        /// Returns a list of revisions for the given file. Does not include rename/move changes.
        /// </summary>
        /// <param name="DepotFilename"></param>
        /// <returns></returns>
        public RevisionInfo[] Filelog(string DepotFilename, bool bQuiet = false)
        {
            if (!bQuiet)
            {
                CommandUtils.LogInformation("Filelog({0})", DepotFilename);
            }
            var Result        = new List <RevisionInfo>();
            var FilelogResult = P4("filelog " + DepotFilename, AllowSpew: false);
            var LogLines      = FilelogResult.Output.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);

            foreach (var Line in LogLines)
            {
                if (Line.StartsWith("... #"))
                {
                    var RevInfo = RevisionInfo.FromFilelogOutput(Line);
                    Result.Add(RevInfo);
                    if (RevInfo.Revision == 1)
                    {
                        // There may be other revisions but they are move/rename changes.
                        break;
                    }
                }
            }
            // Sort ascending.
            Result.Sort((A, B) => { return(A.Revision - B.Revision); });
            return(Result.ToArray());
        }