• Post Reply Bookmark Topic Watch Topic
  • New Topic

Storing the version of code in code itself  RSS feed

 
ak singh
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

v have a project with oracle as its back end. The code and database are both upgraded regularly. To track this we version the database, for this there is a table in the database which stores the version. But the code does not have any version.
V are currently using CVS, and branching and version tagging are performed also performed.

My problem is that v need to add version to the code also, so that any miss match b/w the db and code version raises alarm. M clueless about how to add a version to the code.

NEED HELP
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Posts: 12090
246
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow, I would love to help you, but its just too hard to read your post. Perhaps you should use real words.
 
lalit upadheyay
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can add a property file like application.properties in your code and load a property say app.version as System property at application startup so that it is accessible throught the code at runtime.

You can check in that to the repository (CVS) and update it for new code branches. As you create new branches, you only need to check out, update the app.version property and check in the property file.

At this time I can think of this way of tracking the application version. Someone having some other idea please do share.
 
ak singh
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andrew Monkhouse wrote:Wow, I would love to help you, but its just too hard to read your post. Perhaps you should use real words.



@Andrew

Thanks for the quick reply, here is the problem again :-

we have a project with oracle as its back end. The code and database are both upgraded regularly. To track this we version the database, for this there is a table in the database which stores the version. But the code does not have any version.
we are currently using CVS(concurrent version systems), and branching and version tagging are also performed .

My problem is that we need to add version to the code also, so that any miss match between the database and code version raises alarm. I am clueless about how to add a version to the code, so that the above comparison can take place.

kindly ask if in doubt.
 
ak singh
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
lalit upadheyay wrote:You can add a property file like application.properties in your code and load a property say app.version as System property at application startup so that it is accessible throught the code at runtime.

You can check in that to the repository (CVS) and update it for new code branches. As you create new branches, you only need to check out, update the app.version property and check in the property file.

At this time I can think of this way of tracking the application version. Someone having some other idea please do share.


Hi lalit,

The problem with the property file is that, the version changes every week. So to reflect this we need to check in the latest properties file regularly.
Is there any way to find out the tag (version/branch) from which we have checked out the code ?
 
lalit upadheyay
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok. I was under impression that you have a separate code branch in CVS for different version of code and tagging is in place for the branches. So anytime you could have reverted to any of the existing versions with correct proeprty file in place.

BTW, how are you maintaing db version info in database ?
Are you just updating the same single row for upcoming versions ?
By db changes do you mean the schema enhancements ?
 
ak singh
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
lalit upadheyay wrote:Ok. I was under impression that you have a separate code branch in CVS for different version of code and tagging is in place for the branches. So anytime you could have reverted to any of the existing versions with correct proeprty file in place.

BTW, how are you maintaing db version info in database ?
Are you just updating the same single row for upcoming versions ?
By db changes do you mean the schema enhancements ?


hi lalit
the db has a table , which contains the versions till date. The latest version is extracted from the table and used whereever needed
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Posts: 12090
246
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might want to look at CVS keyword substitution. It has been a really long time since I played with anything like this, but you could try something like:

Check that into your source control system then check it out again. You should see it has been expanded by CVS into something like:

You could probably do something with this, perhaps splitting it out. Just thinking off the top of my head ...

Is this close to what you need or have I gone off on a tangent?
 
ak singh
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andrew Monkhouse wrote:You might want to look at CVS keyword substitution. It has been a really long time since I played with anything like this, but you could try something like:

Check that into your source control system then check it out again. You should see it has been expanded by CVS into something like:


But correct me if am wrong, the revision number is maintained by the CVS, everytime a new check in is made its revised. So it may or may not reflect the current version. Because in our case the current version is different from the "head".

Had 1 query, when we checkout from a version, we checkout from a tag, is there any way to know afterwards that from which tag was the code checked out ?
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Posts: 12090
246
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ak singh wrote:Had 1 query, when we checkout from a version, we checkout from a tag, is there any way to know afterwards that from which tag was the code checked out ?


Yep - that would be the $Name: $ tag. Same concepts could apply.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!