//slow function //public bool Add(string path = "") //{ // if (!Initialized) // return false; // string commandline = string.Empty; // if (!string.IsNullOrEmpty(path)) // { // commandline = string.Format(" add \"{0}\" * --force", path); // } // commandline += GetAuthenCmd(); // ProcessCommand(commandline); // return true; //} public bool AddFile(string path = "") { if (!Initialized) { return(false); } string commandline = string.Empty; if (!string.IsNullOrEmpty(path)) { commandline = string.Format(" add \"{0}\" --force", path); } commandline += GetAuthenCmd(); ProcessCommand(commandline); if (OutputResult.Contains("Can't find parent")) { string parent = path.Remove(path.LastIndexOf('\\')); AddFile(parent); } return(true); }
public bool TestSVNConnect() { //if (string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(Password)) // return false; string commandline = " up dummy"; string authen = string.Format(" --non-interactive --username {0} --password {1}", UserName, Password); commandline += authen; OutputResult = ProcessCommand(commandline); //if (string.IsNullOrEmpty(OutputResult)) //{ // return false; //} if (OutputResult.Contains("No repository found") || OutputResult.Contains("Authentication realm") || OutputResult.Contains("Authentication error") || OutputResult.Contains("Can't connect to host")) { // UEEngine.UELogMan.LogError("TestSVNConnect error: " + OutputResult); return(false); } return(true); }
public bool CommitForceAdd(string path = "", string message = "autoCommit") { if (!Initialized) { return(false); } string messagestr = "[提交类型][修改说明]" + message + "[相关禅道][所属版本][验证情况]"; string commandline; if (string.IsNullOrEmpty(path)) { commandline = string.Format(" commit -m \"{0}\"", messagestr); } else { commandline = string.Format(" commit \"{0}\" -m \"{1}\"", path, messagestr); } commandline += GetAuthenCmd(); ProcessCommand(commandline); if (OutputResult.Contains("Commit failed")) { if (OutputResult.Contains("not under version control")) { AddFile(path); return(Commit(path, message)); } return(false); } return(true); }
public bool Lock(string filename) { if (!Initialized) { return(false); } string commandline = string.Format(" lock {0} ", filename); commandline += GetAuthenCmd(); ProcessCommand(commandline); if (OutputResult.Contains("is already locked by")) { int pos = 0; pos = OutputResult.IndexOf('\'', pos + 1); pos = OutputResult.IndexOf('\'', pos + 1); int start = OutputResult.IndexOf('\'', pos + 1); int end = OutputResult.IndexOf('\'', start + 1); string name = OutputResult.Substring(start + 1, end - start - 1); if (name != UserName) { UnityEditor.EditorUtility.DisplayDialog("Error", OutputResult, "OK"); return(false); } } OutputResult = ""; return(true); }
public bool Update(string path = "") { if (!Initialized) { return(false); } string commandline; if (string.IsNullOrEmpty(path)) { commandline = " update --accept tf"; } else { commandline = string.Format(" update \"{0}\" --accept tf", path); } commandline += GetAuthenCmd(); OutputResult = ProcessCommand(commandline); if (OutputResult.Contains("Error")) { return(false); } ShowSvnError(OutputResult); return(true); }
public bool Commit(string path = "", string message = "autoCommit") { if (!Initialized) { return(false); } string messagestr = "[提交类型][修改说明]" + message + "[相关禅道][所属版本][验证情况]"; string commandline; if (string.IsNullOrEmpty(path)) { commandline = string.Format(" commit -m \"{0}\"", messagestr); } else { commandline = string.Format(" commit \"{0}\" -m \"{1}\"", path, messagestr); } //commandline += GetAuthenCmd(); ProcessCommand(commandline); if (OutputResult.Contains("Commit failed")) { if (OutputResult.Contains("child")) { string parent = path.Remove(path.LastIndexOf('\\')); commandline = string.Format(" commit \"{0}\" -m \"{1}\"", parent, messagestr); ProcessCommand(commandline); if (OutputResult.Contains("Commit failed")) { return(false); } } else { return(false); } } ShowSvnError(OutputResult); return(true); }
public bool IsFileExist(string filename) { if (!Initialized) { return(false); } if (string.IsNullOrEmpty(filename)) { return(false); } string commandline = string.Format(" lock \"{0}\" ", filename); commandline += GetAuthenCmd(); ProcessCommand(commandline); if (OutputResult.Contains("is not under version control")) { return(false); } return(true); }