Exemplo n.º 1
0
        public ChangelistResult DefaultChangelist(string workspace)
        {
            var default_changelist = new Changelist {
                Id          = 0,
                Description = "Default Changelist",
                Workspace   = workspace,
                User        = Client.Username
            };
            // canalize and pare the default changelist p4 change -o
            string command    = "-p " + Server.Host + " -u " + Client.Username + " -c " + workspace + " opened -c default";
            var    output     = Exec.Run(command);
            var    list_files = output.Split('\n')
                                .Select(entry => entry.Replace("\r", "")).ToArray();
            var files = new List <File>();

            for (var index = 0; index < list_files.Length; index++)
            {
                var match = Regex.Match(list_files[index], @"(.*)\/(.*)#([0-9]+)\s-(.*)\s(.*)\s(.*)\s");
                if (match.Success)
                {
                    var groups = match.Groups;
                    var file   = new File();
                    file.Path     = groups[1].Value.Replace("\t", " ") + groups[2].Value.Replace("\t", " ");
                    file.Name     = groups[2].Value.Replace("\t", " ");
                    file.Revision = groups[3].Value.Replace("\t", " ");
                    file.Status   = groups[4].Value;
                    files.Add(file);
                }
            }
            default_changelist.Files = files;
            return(new ChangelistResult(default_changelist, true));// will always be true because its the Default one even if there are no files!
        }
Exemplo n.º 2
0
        private static Changelist CreateChangelist(GroupCollection groups)
        {
            var changelist = new Changelist();

            changelist.Id        = Int32.Parse(groups[1].Value);
            changelist.Date      = Convert.ToDateTime(groups[2].Value);
            changelist.User      = groups[3].Value;
            changelist.Status    = P4Connector.Changelist.StringToStatus(groups[5].Value);
            changelist.Workspace = groups[4].Value;
            return(changelist);
        }