public void SvnUp(string path) { UnitySVN.SVNCommand(UnitySVN.UPDATE, Application.dataPath + "/" + path); //using (SvnClient client = new SvnClient()) //{ // // Checkout the code to the specified directory // client.CheckOut(new Uri("http://sharpsvn.googlecode.com/svn/trunk/"), // "c:\\sharpsvn"); // // Update the specified working copy path to the head revision // client.Update("c:\\sharpsvn"); // SvnUpdateResult result; // client.Update("c:\\sharpsvn", out result); // client.Move("c:\\sharpsvn\\from.txt", "c:\\sharpsvn\\new.txt"); // // Commit the changes with the specified logmessage // SvnCommitArgs ca = new SvnCommitArgs(); // ca.LogMessage = "Moved from.txt to new.txt"; // client.Commit("c:\\sharpsvn", ca); //} }
public int GetSvnVersionStatus(string filePath) { Debug.LogError("【注意】这里跳过了SVN版本检查,实际开发需要打开"); return(0); UnitySVN.SVNCommand(UnitySVN.UPDATE, Application.dataPath + "/StreamingAssets/Resources/"); string connectionString = "URI=file:" + GetSvnDbPath(); IDbConnection dbcon = new SqliteConnection(connectionString); dbcon.Open(); IDbCommand dbcmd = dbcon.CreateCommand(); int version = 0; // requires a table to be created named employee // with columns firstname and lastname // such as, // CREATE TABLE employee ( // firstname nvarchar(32), // lastname nvarchar(32)); //const string sql = "SELECT revision FROM nodes where local_relpath = 'Assets/StreamingAssets/Resources'"; string sql = "SELECT revision FROM nodes where local_relpath like \"%" + filePath + "\""; dbcmd.CommandText = sql; IDataReader reader = dbcmd.ExecuteReader(); while (reader.Read()) { string revision = reader.GetString(0); Debug.Log("filePath:" + filePath); Debug.Log("revision:" + revision); int.TryParse(revision, out version); } // clean up reader.Dispose(); dbcmd.Dispose(); dbcon.Close(); return(version); }