From 7794355a913232e793fe63adfb6c9be999cbbd18 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Thu, 22 Dec 2011 14:37:48 +0000 Subject: [PATCH] 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://svn.code.sf.net/p/rathena/svn/trunk@15211 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/common/core.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/common/core.c b/src/common/core.c index e05f5a5719..99ac1c6bd6 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");