Author Topic: AutoVersioning Plugin  (Read 185740 times)

Offline Jeisson

  • Multiple posting newcomer
  • *
  • Posts: 26
Re: AutoVersioning Plugin
« Reply #120 on: December 09, 2007, 04:56:44 pm »
Hi JGM!.

I am trying to use the Change log feature. Is it possible to write changes in the log without incrementing the version?. For example. While I am working in the project, I fix a bug, so I want to track the change before I do some other tasks (and before I forget the change's details :D), but I am not ready for incrementing the version yet. So change events could be grouped by date then project version. That is only an idea, it seems laborious to implement...

I feel so thankful for the new changes.
Greetings!

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: AutoVersioning Plugin
« Reply #121 on: December 09, 2007, 10:51:18 pm »
I am trying to use the Change log feature. Is it possible to write changes in the log without incrementing the version?. For example. While I am working in the project, I fix a bug, so I want to track the change before I do some other tasks (and before I forget the change's details :D), but I am not ready for incrementing the version yet. So change events could be grouped by date then project version. That is only an idea, it seems laborious to implement...

That was something that I thought when implementing that feature of the plugin, but I did'nt do it because I was on a hurry :(. I was thinking on doing a data grid consisting of two cells, the first cell to select the type of changes as:
 1. Fixed
 2. New Feature
 3. etc...
and the second cell to write the description. And store those changes, until the user feel is time to make a release.

For example:
[Type]   [Description]
"Fixed" "Crash on destructor, deleting pointer already deleted"
"New"  "Now the user can modified some internal settings"

So the user should be able to write row by row the changes on the data grid and then choose when to write them to the change log, using the actual date that the user wrote the changes to the file, instead of storing the date when the user wrote the row in the data grid.

In that way the user will have the ability to keep adding to the list of changes every time he mades a change, and when hi finish the software, write the changes to the change log and the date he wrote the changes to the change log, so there should be an option where the user should be able to select if he wants the data grid to appear before compilation after a change has been made, and a button on the autoversioning dialog to show that data grid to edit or add rows of changes, even a menu item under the project menu named ChangeLog, to call the data grid.

I will implement that! :)

Offline Jeisson

  • Multiple posting newcomer
  • *
  • Posts: 26
Re: AutoVersioning Plugin
« Reply #122 on: December 10, 2007, 12:41:19 am »
Fantastic idea!

I plenty understand your hurry situation, I am in the same conditions :(. Of course, no stress, take all the time you need for the amusement adventure :D. I think is a very great job!, and again, thanks for sharing it with us.

Greetings :wink:

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: AutoVersioning Plugin
« Reply #123 on: December 13, 2007, 08:43:00 am »
FInally made the corresponding changes to the changes log editor, now it uses a data grid and has the ability to save the changes temporarily to write them later. Attached is a screenshot

Here is a sample output:
Code
13 December 2007
   released version 1.1.0 of AutoVersioning-Linux

     Change log:
        -Added: Now the changes log has a data grid
        -Applied: Nice drop down menu for the "Type" column

[attachment deleted by admin]

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: AutoVersioning Plugin
« Reply #124 on: December 13, 2007, 10:48:11 pm »
Updated the wiki page to reflect the new changes of the plugin as the new changes log generator (v1.1)

Offline foldingBLACKlinesSUCK

  • Multiple posting newcomer
  • *
  • Posts: 29
Re: AutoVersioning Plugin
« Reply #125 on: March 23, 2008, 03:38:37 am »
Referring to Plugin included in CodeBlocks 8.02 (official release NOT SVN)

Quote
make.exe: Nothing to be done for `all'.
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings


1) Why does Build Count increment even if BUILD is NOT DONE as in above message? Could you please fix it? :(
    It makes sense that it increments if "Rebuild" is done / "Clean" + "Build" but not the above case.

2) Why does the Revision increment randomly. The use? ofcourse, we can choose not to use it. But still, isn't it redundant?

GREAT PLUGIN other than that  :P
« Last Edit: March 23, 2008, 03:52:53 am by foldingBLACKlinesSUCK »

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: AutoVersioning Plugin
« Reply #126 on: March 23, 2008, 04:32:46 am »
1) Why does Build Count increment even if BUILD is NOT DONE as in above message? Could you please fix it? :(
    It makes sense that it increments if "Rebuild" is done / "Clean" + "Build" but not the above case.

Well, build count is a value to keep track of every test we make, to know how many times we ran the program no matter what (good for our bosses, if any). For the exact times that you build the program you should use the BUILD variable not the BUILDS_COUNT

2) Why does the Revision increment randomly. The use? ofcourse, we can choose not to use it. But still, isn't it redundant?

That was a suggestion of Thomas if I recall correctly, and is similar in the way microsoft does it on their IDE's. You can set the incrementation value of random numbers to 1 and will eventually increment by one and not randomly (just set preferences on the scheme tab).

However, in some circles, it is also understood as:
  • major: must be a bigger number than the competitor's product
  • minor: increments with every new feature
  • release: increments by a random amount in regular intervals, even in absence of changes to code

There I found it, release is equivalent to revision on the autoversioning plugin
« Last Edit: March 23, 2008, 04:36:04 am by JGM »

mariocup

  • Guest
Re: AutoVersioning Plugin
« Reply #127 on: April 12, 2008, 10:40:07 pm »
Hi JGM,

i found a strange bug in your plugin.

How to reproduce:
1. Save two projects in a workspace
2. Close the workspace
3. Open a workspace in Code::Blocks that contains 2 projects
4. Select Project->Autoversioning

Now Autoversioning tries to configure the second project although the first project is activated. The strange thing is that if you open these projects (not from a workspace) everything works well.

Bye,

Mario

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: AutoVersioning Plugin
« Reply #128 on: April 14, 2008, 06:47:23 pm »
If I recall correctly that was a problem of codeblocks not notifying the activated project after a workspace is completely loaded. First it reads the workspace then activates the first project so autoversioning sets it as the activated project, then loads the seconds projects and activates it so autoversioning change to this project as the activated one. After all the projects are loaded codeblocks switch back to the first project as the activated one but the plugin doesn't get notified so here is why the plugin still manages the seconds project (last one) and not the activated one (first one).

Anyways I will make some deep test this night if I have the time, since now I'm self employed and I'm working really hard to get my company going on. Thanks for pointing the problem  :D

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: AutoVersioning Plugin
« Reply #129 on: April 16, 2008, 05:50:26 am »
Well I finally had the time to check the codeblocks sources, since I want to be able to create a patch ready to applied to svn. Well It has been a lot of time I doesn't saw c++ code, actually like 3 weeks, that's for me too many time :shock:

Well, mariocup  this is the event that was not getting notified the last time I worked with the plugin, with the situation that you described.

Code
void AutoVersioning::OnProjectActivated(CodeBlocksEvent& event)
{
if (IsAttached())
{
// switch to the settings of the now activated project [I assume it has already been loaded before this triggers]
m_Project = event.GetProject();
}
}

I haven't found the time to make another deep test since only I had the time to check the new sources and write this message, but I think is a codeblocks problem, like the other similar problem that I found with the oncompilerstartedevent that was fixed on codeblocks some hundred of revisions ago :D But when I make the deep test I will report back so developers could fix it if possible.

PS: That nick "mariocup" reminds me of the nintendo 64 game mario kart :) oohh those days!!
« Last Edit: April 16, 2008, 05:52:22 am by JGM »

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: AutoVersioning Plugin
« Reply #130 on: April 16, 2008, 08:27:48 am »
Quote
If I recall correctly that was a problem of codeblocks not notifying the activated project after a workspace is completely loaded.

I 'm not sure what your question exactly is but, trust me, this event gets sent alright.
Another event you might want to check out would be WORKSPACE_CHANGED...
Be patient!
This bug will be fixed soon...

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: AutoVersioning Plugin
« Reply #131 on: April 16, 2008, 11:25:08 pm »
I 'm not sure what your question exactly is but, trust me, this event gets sent alright.
Another event you might want to check out would be WORKSPACE_CHANGED...

Mandrav, you're the main creator of codeblocks (so you know what you're saying) and yes is been called right  :D
I found the bug, and was actually on this function

===========================================================
void AutoVersioning::OnProjectLoadingHook(cbProject* project, TiXmlElement* elem, bool loading)
{
   if(loading)
   {
       wxMessageBox(_T("Loading: ") + project->GetTitle());
      // TODO (KILLERBOT) : should we have default values, in case something would be missing ?
      // OPTI : we could choose not to write out default values in the xml --> smaller cbp
      avConfig Config;
      m_IsCurrentProjectVersioned = false; // default not active unless we find xml for it
      const TiXmlElement* Node = elem->FirstChildElement("AutoVersioning");
      if (Node)
      {
         m_IsCurrentProjectVersioned = true;
         TiXmlHandle Handle(const_cast<TiXmlElement*>(Node));
         if(const TiXmlElement* pElem = Handle.FirstChildElement("Scheme").ToElement())
         {
            int Help = 0;
            if(pElem->QueryIntAttribute("minor_max", &Help) == TIXML_SUCCESS)
            {
               Config.Scheme.MinorMax = static_cast<long>(Help);
            }
            if(pElem->QueryIntAttribute("build_max", &Help) == TIXML_SUCCESS)
            {
               Config.Scheme.BuildMax = static_cast<long>(Help);
            }
            if(pElem->QueryIntAttribute("rev_max", &Help) == TIXML_SUCCESS)
            {
               Config.Scheme.RevisionMax = static_cast<long>(Help);
            }
            if(pElem->QueryIntAttribute("rev_rand_max", &Help) == TIXML_SUCCESS)
            {
               Config.Scheme.RevisionRandMax = static_cast<long>(Help);
            }
            if(pElem->QueryIntAttribute("build_times_to_increment_minor", &Help) == TIXML_SUCCESS)
            {
               Config.Scheme.BuildTimesToIncrementMinor = static_cast<long>(Help);
            }
         }
         if(const TiXmlElement* pElem = Handle.FirstChildElement("Settings").ToElement())
         {
            Config.Settings.Language = pElem->Attribute("language");
            Config.Settings.SvnDirectory = pElem->Attribute("svn_directory");
            Config.Settings.HeaderPath = pElem->Attribute("header_path");

            int Help = 0;
            if(pElem->QueryIntAttribute("autoincrement", &Help) == TIXML_SUCCESS)
            {
               Config.Settings.Autoincrement = Help?true:false;
            }
            if(pElem->QueryIntAttribute("date_declarations", &Help) == TIXML_SUCCESS)
            {
               Config.Settings.DateDeclarations = Help?true:false;
            }
            if(pElem->QueryIntAttribute("do_auto_increment", &Help) == TIXML_SUCCESS)
            {
               Config.Settings.DoAutoIncrement = Help?true:false;
            }
            if(pElem->QueryIntAttribute("ask_to_increment", &Help) == TIXML_SUCCESS)
            {
               Config.Settings.AskToIncrement = Help?true:false;
            }
            if(pElem->QueryIntAttribute("svn", &Help) == TIXML_SUCCESS)
            {
               Config.Settings.Svn = Help?true:false;
            }
         }
         if(const TiXmlElement* pElem = Handle.FirstChildElement("Changes_Log").ToElement())
         {
            Config.ChangesLog.AppTitle = pElem->Attribute("app_title");
            Config.ChangesLog.ChangesLogPath = pElem->Attribute("changeslog_path");

            int Help = 0;
            if(pElem->QueryIntAttribute("show_changes_editor", &Help) == TIXML_SUCCESS)
            {
               Config.ChangesLog.ShowChangesEditor = Help?true:false;
            }
         }
      }
      avVersionState VersionState;
      m_versionHeaderPath = FileNormalize(cbC2U(Config.Settings.HeaderPath.c_str()),project->GetBasePath());

      avHeader VersionHeader;
        if(VersionHeader.LoadFile(m_versionHeaderPath))
        {
            VersionState.Values.Major = VersionHeader.GetValue(_("MAJOR"));
            VersionState.Values.Minor = VersionHeader.GetValue(_("MINOR"));
            VersionState.Values.Build = VersionHeader.GetValue(_("BUILD"));
            VersionState.Values.Revision = VersionHeader.GetValue(_("REVISION"));
            VersionState.Values.BuildCount = VersionHeader.GetValue(_("BUILDS_COUNT"));
            VersionState.Status.SoftwareStatus = cbU2C(VersionHeader.GetString(_("STATUS")));
            VersionState.Status.Abbreviation = cbU2C(VersionHeader.GetString(_("STATUS_SHORT")));
            VersionState.BuildHistory = VersionHeader.GetValue(_("BUILD_HISTORY"));
        }
      m_ProjectMap[project] = Config;
      m_ProjectMapVersionState[project] = VersionState;
      m_Project = project; //Here is the bug
   }
   else
   {
        wxMessageBox(_T("Saving: ") + project->GetTitle());
      // Hook called when saving project file.

      // since rev4332, the project keeps a copy of the <Extensions> element
      // and re-uses it when saving the project (so to avoid losing entries in it
      // if plugins that use that element are not loaded atm).
      // so, instead of blindly inserting the element, we must first check it's
      // not already there (and if it is, clear its contents)
      if(m_IsCurrentProjectVersioned)
      {
         TiXmlElement* node = elem->FirstChildElement("AutoVersioning");
         if (!node)
         {
            node = elem->InsertEndChild(TiXmlElement("AutoVersioning"))->ToElement();
         }
         node->Clear();

         //Used this instead of GetConfig() since if the project is not activated
         //before saving, then the m_Project is not updated.
         //This will happen when having multiple projects opened.
         avConfig NewConfig = m_ProjectMap[project];

         TiXmlElement Scheme("Scheme");
         Scheme.SetAttribute("minor_max", NewConfig.Scheme.MinorMax);
         Scheme.SetAttribute("build_max", NewConfig.Scheme.BuildMax);
         Scheme.SetAttribute("rev_max", NewConfig.Scheme.RevisionMax);
         Scheme.SetAttribute("rev_rand_max", NewConfig.Scheme.RevisionRandMax);
         Scheme.SetAttribute("build_times_to_increment_minor", NewConfig.Scheme.BuildTimesToIncrementMinor);
         node->InsertEndChild(Scheme);
         TiXmlElement Settings("Settings");
         Settings.SetAttribute("autoincrement", NewConfig.Settings.Autoincrement);
         Settings.SetAttribute("date_declarations", NewConfig.Settings.DateDeclarations);
         Settings.SetAttribute("do_auto_increment", NewConfig.Settings.DoAutoIncrement);
         Settings.SetAttribute("ask_to_increment", NewConfig.Settings.AskToIncrement);
         Settings.SetAttribute("language", NewConfig.Settings.Language.c_str());
         Settings.SetAttribute("svn", NewConfig.Settings.Svn);
         Settings.SetAttribute("svn_directory", NewConfig.Settings.SvnDirectory.c_str());
         Settings.SetAttribute("header_path", NewConfig.Settings.HeaderPath.c_str());
         node->InsertEndChild(Settings);
         TiXmlElement ChangesLog("Changes_Log");
         ChangesLog.SetAttribute("show_changes_editor", NewConfig.ChangesLog.ShowChangesEditor);
         ChangesLog.SetAttribute("app_title", NewConfig.ChangesLog.AppTitle.c_str());
         ChangesLog.SetAttribute("changeslog_path", NewConfig.ChangesLog.ChangesLogPath.c_str());
         node->InsertEndChild(ChangesLog);
      }
      // TODO (KILLERBOT) : what if we decide to not version anymore : how to remove ??
   }
}// OnProjectLoadingHook
===========================================================

well that statement ( m_Project = project;) should be only called when the project is activated not when loading oops   :oops:

Now, I have found other bug  :(, the configuration stored on the project file is not working (to not say loading) fine when loading a workspace instead of a project directly. Im currently checking this.

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: AutoVersioning Plugin
« Reply #132 on: April 16, 2008, 11:39:56 pm »
Now, I have found other bug  :(, the configuration stored on the project file is not working (to not say loading) fine when loading a workspace instead of a project directly. Im currently checking this.

Ok, I found what the problem is, bool m_IsCurrentProjectVersioned is a member variable of the main autoversioning class (global variable) and it should be a member of the project struct.

Oh men, this are really silly things :P

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: AutoVersioning Plugin
« Reply #133 on: April 16, 2008, 11:54:16 pm »
Problems fixed!

Now going to solve the problems pointed by jomeggs

Thanks mariocup and mandrave!

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: AutoVersioning Plugin
« Reply #134 on: April 16, 2008, 11:58:02 pm »
Now, I have found other bug  :(, the configuration stored on the project file is not working (to not say loading) fine when loading a workspace instead of a project directly. Im currently checking this.

Ok, I found what the problem is, bool m_IsCurrentProjectVersioned is a member variable of the main autoversioning class (global variable) and it should be a member of the project struct.

Oh men, this are really silly things :P

or it is not correctly updated during switching of the projects ... ?