コード例 #1
0
        public bool WorkspaceExists(string client, string port)
        {
            string output = Helper.getProcessOutput("p4", string.Format("-p {0} clients", port), null);

            string[] lines = output.Split('\n');
            foreach (string line in lines)
            {
                string[] s2 = line.Split(' ');   // poor manz regex
                if (s2.Length > 1)
                {
                    if (s2[1].Trim('\r') == client)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
コード例 #2
0
ファイル: P4Submit.cs プロジェクト: divyang4481/ci-factory
        /// <summary>
        /// Builds the command string for this particular command.
        /// </summary>
        /// <returns>
        /// The command string for this particular command.
        /// </returns>
        protected string getSpecificCommandArguments( )
        {
            StringBuilder arguments = new StringBuilder();

            arguments.Append("submit ");

            string changelistnumber = Perforce.GetChangelistNumber(User, Client, Changelist);

            if (changelistnumber == null && View == null)
            {
                throw new BuildException("If the \"changelist\" does not currently"
                                         + " exist, a \"view\" is required.", Location);
            }

            if (changelistnumber == null)
            {
                changelistnumber = Perforce.GetChangelistNumber(User, Client,
                                                                Changelist, true);
            }
            if (View != null)
            {
                // reopen view into changelist
                Perforce.getProcessOutput("p4", string.Format("-u {0} -c {1} reopen -c {2} {3}",
                                                              User, Client, changelistnumber, View), null);
            }
            if (RevertUnchanged)
            {
                // revert
                Perforce.getProcessOutput("p4", string.Format("-u {0} -c {1} revert -a -c {2}",
                                                              User, Client, changelistnumber), null);
            }

            if (RemainOpen)
            {
                arguments.Append("-r ");
            }
            arguments.Append(string.Format("-c {0} ", changelistnumber));

            return(arguments.ToString());
        }