Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: cjl3230 on February 01, 2016, 02:16:59 am

Title: my svn version is zero?!
Post by: cjl3230 on February 01, 2016, 02:16:59 am
1.update repo by git svn rebase.   (git svn clone svn://svn.code.sf.net/p/codeblocks/code  execut  first)    sorry,my english is very poor;
2.I found a problem at src/build_tools/autorevision/autorevision.cpp
3. this is my patch
Code: php
diff --git a/src/build_tools/autorevision/autorevision.cpp b/src/build_tools/autorevision/autorevision.cpp
index 5ca1727..9c74959 100644
--- a/src/build_tools/autorevision/autorevision.cpp
+++ b/src/build_tools/autorevision/autorevision.cpp
@@ -215,6 +215,22 @@ bool QuerySvn(const string& workingDir, string& revision, string &date)
             }
         }
 
+        if (getProcessOutput(output, "git log --grep=\"git-svn-id: svn\" --max-count=1" + workingDir))
+        {
+            string::size_type lineStart = output.find("git-svn-id: svn");
+            if (lineStart != string::npos)
+            {
+                string::size_type revStart = output.find("@", lineStart);
+                if (revStart != string::npos)
+                {
+                    revStart++;
+                    string::size_type revEnd = output.find(" ", revStart);
+                    revision = output.substr(revStart, revEnd - revStart);
+                    hasRev = true;
+                }
+            }
+        }
+
         if (getProcessOutput(output, "git log --date=iso --max-count=1 " + workingDir))
         {
             string::size_type lineStart = output.find("Date:");

at last, I would like to add it to the repository.
 :) :) :) :) :)
Title: Re: my svn version is zero?!
Post by: dmoore on February 01, 2016, 02:16:03 pm
This is probably what is causing problems with my PPA.
Title: Re: my svn version is zero?!
Post by: MortenMacFly on February 01, 2016, 07:47:58 pm
3. this is my patch
Does it work on all platforms, e.g. on Windows, too? I see "grep" there which does hopefully not call a Unix command...
Title: Re: my svn version is zero?!
Post by: oBFusCATed on February 01, 2016, 09:20:18 pm
Does it work on all platforms, e.g. on Windows, too? I see "grep" there which does hopefully not call a Unix command...
Yes, it works, this is not grep but "git log --grep", so if you have a working git installation then it should work.
Also this patch just adds another version of this command, that searches for checkouts with the svn protocol.
The original version searches for a https protocol.

@dmoore: I doubt this patch will fix it. I'll investigate, because I'm affected too...
Title: Re: my svn version is zero?!
Post by: MortenMacFly on February 01, 2016, 09:28:09 pm
@dmoore: I doubt this patch will fix it. I'll investigate, because I'm affected too...
For me, this is always zero if I don't work in the working copy (which I usually don't). Therefore the pre-build command in the cbp file simply fails silently. To "fix" that I added to complete path to the svn (git) working copy to the command. (see the target named "sdk" in the C::B project file).
Title: Re: my svn version is zero?!
Post by: oBFusCATed on February 05, 2016, 08:54:50 am
@cjl3230: I've committed a fix for your problem. Can you confirm that it really fixes it?

@Morten: As far as I understood you're copying the files from the repo somewhere else and when you're ready with your changes you copy the files back in the repo in order to commit them. Am I correct in my understanding?
Title: Re: my svn version is zero?!
Post by: cjl3230 on February 05, 2016, 09:24:14 am
@oBFusCATed: Yes, the problem is fixed in my centos 6.5. Thank You;