Difference between revisions of "Engineering:Subversion Repository"

From NAMIC Wiki
Jump to: navigation, search
m (Update from Wiki)
 
m (Update from Wiki)
Line 2: Line 2:
  
 
NA-MIC SandBox is a repository of untested and unstable code developed as a part of NA-MIC. For more information, check the [[NAMIC_Wiki:Software_Process#The_Sandbox|NA-MIC Software Development Process]]
 
NA-MIC SandBox is a repository of untested and unstable code developed as a part of NA-MIC. For more information, check the [[NAMIC_Wiki:Software_Process#The_Sandbox|NA-MIC Software Development Process]]
 +
 +
See [http://svnbook.red-bean.com/ the SVN Book at red-bean.com]. In particular, check out the information about [http://svnbook.red-bean.com/en/1.1/ch03s05.html the Basic Work Cycle for svn].
  
 
The NA-MIC SVN is also used for the [[Slicer3|Slicer3]] development effort.
 
The NA-MIC SVN is also used for the [[Slicer3|Slicer3]] development effort.
Line 21: Line 23:
 
  svn update
 
  svn update
  
To check current state:
+
To check current state of your edits:
  
 
  svn status
 
  svn status
 +
 +
To check the current state compared to the repository:
 +
 +
svn -u status
  
 
To add new file:
 
To add new file:
  
 
  svn add filename
 
  svn add filename
 +
 +
followed by (very important):
 +
 +
svn commit -m"ENH: Adding a new file" filename
  
 
To remove file:
 
To remove file:
Line 38: Line 48:
  
 
If the update results in conflict, fix the file first before commiting it.
 
If the update results in conflict, fix the file first before commiting it.
 +
 +
Once you have fixed the file:
 +
 +
svn resolved <filename>
  
 
== Can I see the files through the Web ==
 
== Can I see the files through the Web ==
Line 89: Line 103:
 
  ----------------------------------------------------------------------</nowiki>
 
  ----------------------------------------------------------------------</nowiki>
  
Make sure there is no tabs in the source files. You can remove them with "perl -pi .-e 's/\t/ /g' <FileName>"
+
Make sure there is no tabs in the source files. You can remove them with
 +
 
 +
perl -pi .-e 's/\t/   /g' <FileName>
 +
 
 +
or
 +
 
 +
  sed -i -e 's/\t/  /g' <FileName>
  
 
=== Missing new line at the end of file ===
 
=== Missing new line at the end of file ===
Line 116: Line 136:
  
 
Make sure to remove any conflicts before removing files.
 
Make sure to remove any conflicts before removing files.
 +
 +
Once resolved:
 +
 +
svn resolved test.cxx
  
 
=== Things missing from SVN that were in CVS ===
 
=== Things missing from SVN that were in CVS ===

Revision as of 13:22, 18 December 2006

Home < Engineering:Subversion Repository

What is NA-MIC Subversion

NA-MIC SandBox is a repository of untested and unstable code developed as a part of NA-MIC. For more information, check the NA-MIC Software Development Process

See the SVN Book at red-bean.com. In particular, check out the information about the Basic Work Cycle for svn.

The NA-MIC SVN is also used for the Slicer3 development effort.

How do I get NA-MIC SandBox

Use Subversion. Checkout using the following command:

svn checkout http://www.na-mic.org:8000/svn/NAMICSandBox

Clients for subversion are avaialble for most operating systems. Please check if you already have Subversion on the system, or download apropriate one from http://subversion.tigris.org/project_packages.html.

How do I commit to NA-MIC Subversion

Fill the form at https://www.kitware.com/Admin/SendPassword.cgi and under Comment type "Request password for NA-MIC Sandbox". Once you have access to write to NA-MIC SandBox, you can work with repository using the following commands:

To update repository:

svn update

To check current state of your edits:

svn status

To check the current state compared to the repository:

svn -u status

To add new file:

svn add filename

followed by (very important):

svn commit -m"ENH: Adding a new file" filename

To remove file:

svn remove filename

To rename file:

svn move oldname newname

If the update results in conflict, fix the file first before commiting it.

Once you have fixed the file:

svn resolved <filename>

Can I see the files through the Web

Yes, check: WebSVN.

Or for Slicer3, WebSVN.

I get the following error when I try to commit...

If you want to enable this error reporting on your subversion repository, please foollow instructions about Subversion Input Filters.

Commit log error

The error would look like this:

---------------------------------------------------------------------
 Subversion Commits to NA-MIC require commit type in the comment.
 Valid commit types are:
   BUG:   - a change made to fix a runtime issue
            (crash, segmentation fault, exception, or incorrect result,
   COMP:  - a fix for a compilation issue, error or warning,
   ENH:   - new functionality added to the project,
   PERF:  - a performance improvement,
   STYLE: - a change that does not impact the logic or execution of the code.
            (improve coding style, comments, documentation).
 
 The Subversion command to commit the change is:
 
   svn commit -m "BUG: fixed core dump when passed float data" filename
 
 you can also use the syntax below which omits the -m flag. In this case
 subversion will start up an editor for you to enter a comment on why you made
 the change.
 
   svn commit filename
 ----------------------------------------------------------------------

Make sure to start the commit message with one of the specified tags.


Tabs in the source file

----------------------------------------------------------------------
 Problems in file "my baby.cxx":
 The following line(s) contain tabs:
     4: This line contains a tab-->      <--
 
 Found problems with 1 file(s). Cannot commit
 ----------------------------------------------------------------------

Make sure there is no tabs in the source files. You can remove them with

perl -pi .-e 's/\t/    /g' <FileName>

or

 sed -i -e 's/\t/  /g' <FileName>

Missing new line at the end of file

----------------------------------------------------------------------
 Problems in file "my baby.cxx":
 The following line(s) do not contain new-line character:
     5: another linex
 
 Found problems with 1 file(s). Cannot commit
 ----------------------------------------------------------------------

Make sure there is a new line at the end of the source file. Most editors should fix this automatically.

Conflicts in the file

----------------------------------------------------------------------
 Problems in file "test.cxx":
 The following line(s) contain conflicts:
     1: <<<<<<< .mine
    11: =======
    22: >>>>>>> .r13
 
 Found problems with 2 file(s). Cannot commit
 ----------------------------------------------------------------------

Make sure to remove any conflicts before removing files.

Once resolved:

svn resolved test.cxx

Things missing from SVN that were in CVS

No cvs diff -w

Some workarounds here: http://kitt.hodsden.com/ignoring_whitespace_changes_with_svn_diff

No cvs update -C

Remove the file and then update (nothing more clean?) (mathieu). I believe this is describe here: http://svnbook.red-bean.com/nightly/en/svn.tour.cycle.html#svn.tour.cycle.resolve

...snip...

If you get a conflict, you need to do one of three things:

  • Merge the conflicted text “by hand” (by examining and editing the conflict markers within the file).
  • Copy one of the temporary files on top of your working file.
  • Run svn revert <filename> to throw away all of your local changes.

Once you've resolved the conflict, you need to let Subversion know by running svn resolved. This removes the three temporary files and Subversion no longer considers the file to be in a state of conflict.

$ svn resolved <filename>

...snip...