Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   How do you manage code changes? (http://www.chiefdelphi.com/forums/showthread.php?t=44799)

ericand 27-02-2006 03:32

How do you manage code changes?
 
I'm curious about experiences with the use of source code repositories (CVS, RCS, DARCS,...) and if anyone has been able to incorporate them into their teams development process.

We've tried but the use of a central repository has not worked well due to the fact that our development is on machines that are not regularly networked together. We archive the best code of the day and use it to seed a development directory for the next day's work.

What we have done that has worked fairly well, is use a contextual diff tool (KDIFF3) that provides a quick way to compare and merge two source directories. Using this tool, we can quickly see what has changed from a previous day's work, or we can merge separate development directories into one.

gnirts 27-02-2006 07:00

Re: How do you manage code changes?
 
Our team uses Subversion. It is supported by MPLAB 7.30 (just look in the help files under "Version Control" or something like that). The fact the machines are not regularly networked is not an issue. You create a repository on one machine with your base code, and all other machines can connect to it and perform what is called a "check out." You can then edit the code you checked out all you want, and later you reconnect to the repo and "commit" your changes. Performing an "update" allows you to receive the changes that others have made and integrate to the code on your machine. SVN (Subversion) has great internal differencing tools, and will be familiar to those who have worked with CVS. You can find it here: http://subversion.tigris.org/

I also suggest using http://tortoisesvn.tigris.org/ (like TortoiseCVS but for Subversion) and http://winmerge.sourceforge.net/ (A powerful file-differ for Windows)

You can even convert existing CVS (which Subversion is designed to replace) repos to SVN using http://cvs2svn.tigris.org/

Good Luck,
Robinson

X-Istence 27-02-2006 07:25

Re: How do you manage code changes?
 
I use Subversion with TortoiseSVN. Mostly because it is really nice to be able to go back a few revisions and see what changes were made and why i made them in the first place. See the above post for more subversion information.

Timothy D. Ginn 27-02-2006 08:01

Re: How do you manage code changes?
 
For openFIRST we currently use CVS but are in the process of migrating to Subversion (it was only last week that SourceForge rolled out Subversion support to all projects).

We're running this in an environment where contributors are (or have at various points been) spread across at least 3 different countries (and two continents). They both work well over dialup and/or unreliable connections (well, as well as anything can work over an unreliable connection).

For learning either the SourceForge site documents for CVS and Subversion are good. They've also got recommended software for both, too (Subversion is below the CVS one in that list).

comwiz7 27-02-2006 16:54

Re: How do you manage code changes?
 
Every time I make a major revision, I copy the old code to another folder and call it like FRC2006Rev1, the number being the version or whatever. Then I save the new change as FRC2006Rev2 and so on...I'm assuming there is a better way to do this. Anybody want to clue me in?

Eldarion 27-02-2006 16:56

Re: How do you manage code changes?
 
I used CVS on Linux through the whole build season. It even allowed us to merge each other's changes pretty much seamlessly.

TortiseCVS is a great Windows CVS client. :)

Keith Watson 27-02-2006 17:40

Re: How do you manage code changes?
 
Quote:

Originally Posted by comwiz7
Every time I make a major revision, I copy the old code to another folder and call it like FRC2006Rev1, the number being the version or whatever. Then I save the new change as FRC2006Rev2 and so on...I'm assuming there is a better way to do this. Anybody want to clue me in?

Use one of the version control systems mentioned in this thread.

Copying entire folders like you are doing works. Just be very careful if you are going to open a workspace in one of the saved folders. MPLAB stores the absolute pathnames to the source code so it is still using the source files in the original folder, not the new folder!

Keith Watson 27-02-2006 17:45

Re: How do you manage code changes?
 
Quote:

Originally Posted by Eldarion
TortiseCVS is a great Windows CVS client.

I used TortoiseCVS at home.

Here is a tip: After you have checked in a major revision of your code, tag it. The tag makes it easy to keep track of the major revisions.

devicenull 27-02-2006 18:16

Re: How do you manage code changes?
 
Quote:

Originally Posted by ericand
I'm curious about experiences with the use of source code repositories (CVS, RCS, DARCS,...) and if anyone has been able to incorporate them into their teams development process.

We've tried but the use of a central repository has not worked well due to the fact that our development is on machines that are not regularly networked together. We archive the best code of the day and use it to seed a development directory for the next day's work.

What we have done that has worked fairly well, is use a contextual diff tool (KDIFF3) that provides a quick way to compare and merge two source directories. Using this tool, we can quickly see what has changed from a previous day's work, or we can merge separate development directories into one.

Check out SVK, it's basically a decentralized SVN. I've never actually used it, but I hear its pretty good.

I've got SVN installed on my laptop (Hint: You don't need a server to use SVN with, file:/// repositories work fine). When I get home, I run a batch script that backs up the SVN tree to my desktop, then I have another script there which copies it over to my linux SVN server, so I can use stuff like ViewCV :) It also has the nice advantage of me having three seperate copies of the code, so I can't lose it.

gnirts 27-02-2006 18:21

Re: How do you manage code changes?
 
So it seems that others are using Subversion as well. A few questions about version control in general:

Which files in the code directory does everyone put under version control? Just .c and .h? .hex too? What about documentation?

And how often does everyone commit? Major revisions? Every compile?

Lastly, do people using CVS/SVN use the tools inside MPLAB or Tortoise?

Just Curious,
Robinson

devicenull 27-02-2006 18:42

Re: How do you manage code changes?
 
Quote:

Originally Posted by gnirts
So it seems that others are using Subversion as well. A few questions about version control in general:

Which files in the code directory does everyone put under version control? Just .c and .h? .hex too? What about documentation?

And how often does everyone commit? Major revisions? Every compile?

Lastly, do people using CVS/SVN use the tools inside MPLAB or Tortoise?

Just Curious,
Robinson

*.c, *.h, hex files don't matter, they can be re-created.

Documentation? What documentation?

I commit usually after I get something working correctly.. every compile is a bit excessive, because about half my compiles are something simple, like switching a sign.

I use the tools inside MPlab.

Cuog 27-02-2006 18:54

Re: How do you manage code changes?
 
this will depend on the size of your progtramming team but the approach i used this year was to split up the work and merge eceryone's completed work manually, for example this year the driving code was written byt my team mate Tom and i wrote the autonomous i then got the user_routines file from him and added it to my project that had modifications in user_routines_fast and got the two running nicely. basically just subdivide what needs to be done and give spots for it to be placed then copy and paste

Timothy D. Ginn 27-02-2006 19:29

Re: How do you manage code changes?
 
Quote:

Originally Posted by gnirts
So it seems that others are using Subversion as well. A few questions about version control in general:

Which files in the code directory does everyone put under version control? Just .c and .h? .hex too? What about documentation?

Generally speaking the version control systems work best with textual data rather than binary files. So, things like documentation, the .h and .c files, etc. would be good to put in. You can, of course, have binary data there too (like the .hex files, images, etc.), but, the version control systems generally won't give you features like comparing the changes from one version to another with that type of data.

Quote:

Originally Posted by gnirts
And how often does everyone commit? Major revisions? Every compile?

The general rule of thumb we use is commit after any changes that are stable enough to have passed some very basic preliminary testing (e.g. no syntax errors and such). I tend to do it more or less every time I would ordinarily save a file (less any of those where it would fail the preliminary tests).

Quote:

Originally Posted by gnirts
Lastly, do people using CVS/SVN use the tools inside MPLAB or Tortoise?

Since we're not using it for robot code (and thus not MPLAB) I can't directly answer that question. What I will mention (which may not be of particular relevance to you personally, but others reading this thread later may find useful to know) is that Eclipse (which I believe I've read from some other threads in the past can be used to program the robot, but that I use with the PHPEclipse plugin for writing PHP code) has plugins for both Subversion and CVS. I haven't used those extensively; I usually use the command line interface to CVS/Subversion (then again, I often develop these things when logged remotely into other boxes and anything else could be prohibitively slow).

Donut 27-02-2006 20:22

Re: How do you manage code changes?
 
We use a set of folders with different version names, and a good old USB drive. My job this year (other than doing a few tasks that had to be finished) was pretty much merging code and making sure everything got coded.

We should probably invest in something else though.

Eldarion 27-02-2006 22:13

Re: How do you manage code changes?
 
Quote:

Originally Posted by Keith Watson
I used TortoiseCVS at home.

Here is a tip: After you have checked in a major revision of your code, tag it. The tag makes it easy to keep track of the major revisions.

Thanks for the tip. I was aware of that and have been making good use of it. :)

Do you have any experience branching from the main revision? I have been running into some problems, mainly I don't know how to merge the branch back into the head revision. :o

X-Istence 27-02-2006 23:30

Re: How do you manage code changes?
 
Quote:

Originally Posted by Eldarion
Thanks for the tip. I was aware of that and have been making good use of it. :)

Do you have any experience branching from the main revision? I have been running into some problems, mainly I don't know how to merge the branch back into the head revision. :o

I make branches for when something changes radically, and I want head to stay the same for a while.

phrontist 27-02-2006 23:36

Re: How do you manage code changes?
 
I use subversion with Tortise . Elite Frontier will provide SVN hosting to FIRST teams for free (they already host 116 and 1418).

Keith Watson 28-02-2006 00:16

Re: How do you manage code changes?
 
Quote:

Originally Posted by Eldarion
Do you have any experience branching from the main revision? I have been running into some problems, mainly I don't know how to merge the branch back into the head revision. :o

I used cvs (including scripts written on top of cvs) for many, many years. We did not use branches very often. More than 95% of our stuff was done on the mainline. Branching is best used when you need to do isolated development with version control while the mainline goes through several revisions.

If you use TortoiseCVS check the User's Guide, it's simple. If you use a flavor of regular cvs look for "cvs update -j branchname". This means "join the branch to the mainline". Here is some documentation on Branching and Merging.

Joe Ross 28-02-2006 12:36

Re: How do you manage code changes?
 
Quote:

Originally Posted by Keith Watson
If you use TortoiseCVS check the User's Guide, it's simple. If you use a flavor of regular cvs look for "cvs update -j branchname". This means "join the branch to the mainline". Here is some documentation on Branching and Merging.

Be sure to read the section Merging from a branch several times. I missed that part the first time I merged a branch and it caused me grief later on.

We ended up with only one branch, when I completely rewrote our PID framework. I worked off the PID branch while everyone else worked from head.

Joe Ross 28-02-2006 13:00

Re: How do you manage code changes?
 
We used a dedicated laptop running Debian Linux (stable) as the server. I used cvsd to chroot the cvs pserver process. Each team member had a unique login and a trivial password*. I used viewcvs (now renamed to viewvc) as a web interface to let anyone without cvs knowledge browse the repository. We stored all kinds of stuff in the repository, not just our code. For example, we stored all the rules and updates and other documentation, our team roster, even photos of the robot.

We do not have internet access at our build, but do have an internal wireless lan. When we were at our build location, the cvs laptop is there. When we aren't building, it's at my house accessible over our dsl connection. The laptop ran a dns server such that when it was at our build location, you could use the same address as when you were accessing it over the internet.

The commit philosophy we used was such that you should commit after testing when a test platform was availible, but if a test platform wasn't availible commit once you were happy and the code compiled.

For our programming directory, we stored all the .c, .h, .lkr, .lib, .mcp, all the text readmes, and the .hex file. We wanted to have a complete history of the hex file so we could pull up exactly the program we used for each match, without worrying about library changes or other things like that.

Right now we have a tag for the state it was after ship, and for after each fix-it window. We'll also have a tag for the code as it was in the robot for each match so that the drive team can easily request an old version. Depending on whether significant changes get implemented between matches, we may end up branching.

*We'll probably be switching to a more secure form of authentication next year, I just wanted to get something that worked easily out of the box

Eldarion 28-02-2006 17:44

Re: How do you manage code changes?
 
Quote:

Originally Posted by Keith Watson
I used cvs (including scripts written on top of cvs) for many, many years. We did not use branches very often. More than 95% of our stuff was done on the mainline. Branching is best used when you need to do isolated development with version control while the mainline goes through several revisions.

If you use TortoiseCVS check the User's Guide, it's simple. If you use a flavor of regular cvs look for "cvs update -j branchname". This means "join the branch to the mainline". Here is some documentation on Branching and Merging.

Thaks for the links. For some reason I was finding it difficult to locate CVS documentation. :)

Astronouth7303 28-02-2006 20:41

Re: How do you manage code changes?
 
Quote:

Originally Posted by gnirts
So it seems that others are using Subversion as well. A few questions about version control in general:

Which files in the code directory does everyone put under version control? Just .c and .h? .hex too?

The source files & headers (*.c, *.h), libraries (*.lib), the makefile, any additional scripts, the doxygen configuration, and any documentation sources (*.dox).

Quote:

Originally Posted by gnirts
What about documentation?

API-type documentation is generated by doxygen and uploaded to a server. Anyone with doxygen can generate their own edition.


Quote:

Originally Posted by gnirts
And how often does everyone commit? Major revisions? Every compile?

I try to commit when I have a working version, at the end of a meeting, or when we need to sync systems during a meeting.

Quote:

Originally Posted by gnirts
Lastly, do people using CVS/SVN use the tools inside MPLAB or Tortoise?

I use Subversion inside of Eclipse via Subclipse. Occasionally I have to do more advanced stuff using TortoiseSVN.

Quote:

Originally Posted by gnirts
Just Curious,
Robinson

That's what we're here for. ;)

(A warning about SVN, it doesn't have tagging/branching in the same way that CVS does. What happens is that it copies the files to a new directory in your repository. So if you placed your sources in the root of the repo, you can't really branch/tag.)

ericand 01-03-2006 03:56

Re: How do you manage code changes?
 
That is what we do for the most part. The merge is made much easier by
using a contextual diff tool that visually shows which files are different, and
helps us merge the files.

Quote:

Originally Posted by Donut
We use a set of folders with different version names, and a good old USB drive. My job this year (other than doing a few tasks that had to be finished) was pretty much merging code and making sure everything got coded.

We should probably invest in something else though.



All times are GMT -5. The time now is 12:50.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi