Author Topic: my svn version is zero?!  (Read 7028 times)

Offline cjl3230

  • Single posting newcomer
  • *
  • Posts: 2
my svn version is zero?!
« 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.
 :) :) :) :) :)

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: my svn version is zero?!
« Reply #1 on: February 01, 2016, 02:16:03 pm »
This is probably what is causing problems with my PPA.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: my svn version is zero?!
« Reply #2 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...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: my svn version is zero?!
« Reply #3 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...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: my svn version is zero?!
« Reply #4 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).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: my svn version is zero?!
« Reply #5 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?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline cjl3230

  • Single posting newcomer
  • *
  • Posts: 2
Re: my svn version is zero?!
« Reply #6 on: February 05, 2016, 09:24:14 am »
@oBFusCATed: Yes, the problem is fixed in my centos 6.5. Thank You;