summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-22 14:37:48 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-22 14:37:48 +0000
commit7c6fa6ed09fc2031a9307ac70e8916c76e319781 (patch)
tree2758c801f7f3b401c4e17df5ae10ca33908a593c /src/common
parent813371183d4f73cc71f283714d91822a57ebfbe2 (diff)
downloadhercules-7c6fa6ed09fc2031a9307ac70e8916c76e319781.tar.gz
hercules-7c6fa6ed09fc2031a9307ac70e8916c76e319781.tar.bz2
hercules-7c6fa6ed09fc2031a9307ac70e8916c76e319781.tar.xz
hercules-7c6fa6ed09fc2031a9307ac70e8916c76e319781.zip
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
Diffstat (limited to 'src/common')
-rw-r--r--src/common/core.c23
1 files changed, 22 insertions, 1 deletions
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");