From 7c6fa6ed09fc2031a9307ac70e8916c76e319781 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Thu, 22 Dec 2011 14:37:48 +0000 Subject: Adding support for subversion 1.7' method of storing working copy numbers (reads from sqlite file in rough manner), bugreport:5138 git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15211 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/common/core.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/common/core.c') diff --git a/src/common/core.c b/src/common/core.c index e05f5a571..99ac1c6bd 100644 --- a/src/common/core.c +++ b/src/common/core.c @@ -173,7 +173,28 @@ const char* get_svn_revision(void) } fclose(fp); } - + /** + * subversion 1.7 introduces the use of a .db file to store it, and we go through it + **/ + if(!(*eA_svn_version) && ((fp = fopen(".svn/wc.db", "r")) != NULL || (fp = fopen("../.svn/wc.db", "r")) != NULL)) { + char lines[512]; + int revision,last_known = 0; + while(fgets(lines, sizeof(lines), fp)) { + if( strstr(lines,"!svn/ver/") ) { + if (sscanf(strstr(lines,"!svn/ver/"),"!svn/ver/%d/%*s", &revision) == 1) { + if( revision > last_known ) { + last_known = revision; + } + } + } + } + fclose(fp); + if( last_known != 0 ) + snprintf(eA_svn_version, sizeof(eA_svn_version), "%d", last_known); + } + /** + * we definitely didn't find it. + **/ if(!(*eA_svn_version)) snprintf(eA_svn_version, sizeof(eA_svn_version), "Unknown"); -- cgit v1.2.3-70-g09d2