Exemplo n.º 1
0
        public static string GetUpdateCmdArgumentsByConfigFile(string configFilePath)
        {
            ProjectUpdateData config = LoadProcessor.LoadConfigFile <ProjectUpdateData>(configFilePath);

            string command = "echo 开始";

            foreach (var item in config.updateSetting)
            {
                //更新SVN的命令
                command += " && " + CommandCreator.CreateCmdSVNProjectUpdateCommand(item.svnFilePath);

                //拷贝指定的文件的命令
                int           filesCount      = item.fileName.Count;
                List <string> sourceFilesPath = new List <string>();
                List <string> desFilesPath    = new List <string>();
                for (int i = 0; i < filesCount; i++)
                {
                    sourceFilesPath.Add(item.svnFilePath + "\\" + item.fileName[i]);
                    desFilesPath.Add(item.gitFilePath + "\\" + item.fileName[i]);
                }
                command += " && " + CommandCreator.CreateCmdCopyFilesCommand(sourceFilesPath.ToArray(), desFilesPath.ToArray());

                //cmd切换目录到Git项目的目录
                command += " && " + CommandCreator.CreateCmdSwitchDirCommand(item.gitFilePath);

                //Git Pull的命令
                command += " && " + CommandCreator.CreateCmdGitPullCommand();

                //暂存文件到Git的命令
                command += " && " + CommandCreator.CreateCmdGitAddSpecifyFilesCommand(desFilesPath.ToArray());

                //提交文件到Git的命令
                if (item.autoCommit)
                {
                    command += " && " + CommandCreator.CreateCmdGitCommitSpecifyFilesCommand(desFilesPath.ToArray(), item.commitComment);
                }
            }

            //推送Git的命令
            if (config.autoPush)
            {
                command += " && " + CommandCreator.CreateCmdGitPushCommand();
            }

            return(command);
        }
Exemplo n.º 2
0
        //提交并推送到Git
        private static void CommitAndPushToGit(string path, string comment)
        {
            string command = "echo 开始";

            //cmd切换目录到Git项目的目录
            command += " && " + CommandCreator.CreateCmdSwitchDirCommand(path);
            //Git Pull的命令
            command += " && " + CommandCreator.CreateCmdGitPullCommand();
            //Git Commit的命令
            command += " && " + CommandCreator.CreateCmdGitCommitCommand(comment);
            //Git Push的命令
            command += " && " + CommandCreator.CreateCmdGitPushCommand();

            UnityEngine.Debug.Log("更新所执行的命令如下:\n" + command);

            //执行cmd命令
            CommandProcessor.ExecuteCmdExe(command);

            if (currentWindow != null)
            {
                currentWindow.Close();
                currentWindow = null;
            }
        }