Esempio n. 1
0
        /// <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("change ");

            if (Changelist == null)
            {
                throw new BuildException("A \"changelist\" is required for p4edit");
            }

            string _changelistnumber = null;

            if (Delete)
            {
                arguments.Append("-d ");
                _changelistnumber = Perforce.GetChangelistNumber(User, Client, Changelist);
            }
            else
            {
                _changelistnumber = Perforce.GetChangelistNumber(User, Client, Changelist, true);
            }
            arguments.Append(_changelistnumber);

            return(arguments.ToString());
        }
Esempio n. 2
0
        /// <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("reopen ");

            if (Changelist != null)
            {
                if (Changelist.ToLower() == "default")
                {
                    arguments.Append("-c default ");
                }
                else
                {
                    arguments.Append(string.Format("-c {0} ", Perforce.GetChangelistNumber(
                                                       User, Client, Changelist, true)));
                }
            }
            if (Type != null)
            {
                arguments.Append(string.Format("-t {0} ", Type));
            }
            arguments.Append(View);

            return(arguments.ToString());
        }
Esempio n. 3
0
        /// <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("info ");

            if (User == null && Client == null && Port == null)
            {
                throw new BuildException("At least one of the following: \"client\", \"user\", or \"port\" is required for p4set");
            }

            if (User != null)
            {
                Perforce.SetVariable("P4USER", User);
            }
            if (Client != null)
            {
                Perforce.SetVariable("P4CLIENT", Client);
            }
            if (Port != null)
            {
                Perforce.SetVariable("P4PORT", Port);
            }

            return(arguments.ToString());
        }
Esempio n. 4
0
        /// <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("label ");

            if (!Delete && View == null)
            {
                throw new BuildException("<p4label> requires either a \"view\""
                                         + " to create, or \"delete\"=\"true\" to delete a label.",
                                         Location);
            }

            if (Delete)
            {
                arguments.Append("-d ");
            }
            else
            {
                // this creates or edits the label, then the -o outputs to standard out
                Perforce.CreateLabel(User, Label, View);
                arguments.Append("-o ");
            }
            arguments.Append(Label);

            return(arguments.ToString());
        }
Esempio n. 5
0
        /// <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("revert ");

            if (!RevertUnchanged && Changelist == null && View == null)
            {
                throw new BuildException(Usage);
            }

            if (RevertUnchanged)
            {
                arguments.Append("-a ");
            }
            if (Changelist != null)
            {
                arguments.Append(string.Format("-c {0} ", Perforce.GetChangelistNumber(User, Client, Changelist)));
            }
            if (View != null)
            {
                arguments.Append(View);
            }

            return(arguments.ToString());
        }
Esempio n. 6
0
        /// <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("client ");

            if (!Delete && View == null)
            {
                throw new BuildException("<p4client> requires either a \"view\""
                                         + " to create, or \"delete\"=\"true\" to delete a client.",
                                         Location);
            }

            if (Delete)
            {
                arguments.Append("-d ");
                if (Force)
                {
                    arguments.Append("-f ");
                }
            }
            else
            {
                if (View == null || Root == null)
                {
                    throw new BuildException("A \"view\" and \"root\" are required for creating/editing with <p4client>.");
                }
                // this creates or edits the client, then the -o outputs to standard out
                Perforce.CreateClient(User, ClientName, Root, View);
                arguments.Append("-o ");
            }
            arguments.Append(ClientName);

            return(arguments.ToString());
        }
Esempio n. 7
0
        protected override void ExecuteTask()
        {
            string[] find    = { "User name:", "Client name:", "Client host:", "Client root:" };
            string[] results = Perforce.GetP4Info(find);

            Project.Properties[User]   = results[0].ToString();
            Project.Properties[Client] = results[1].ToString();
            Project.Properties[Host]   = results[2].ToString();
            Project.Properties[Root]   = results[3].ToString();
        }
Esempio n. 8
0
        /// <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("delete ");

            if (Changelist != null)
            {
                arguments.Append(string.Format("-c {0} ", Perforce.GetChangelistNumber(
                                                   User, Client, Changelist, true)));
            }
            arguments.Append(View);

            return(arguments.ToString());
        }
Esempio n. 9
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);
        }
Esempio n. 10
0
        /// <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());
        }
Esempio n. 11
0
 public string GetChangeListNumber(string changelistName)
 {
     return(Helper.GetChangelistNumber(Helper.GetUserName(), Helper.GetClient(), changelistName, true));
 }