MAS SCM Subversion

From DDCIDeos
Jump to navigationJump to search

Initial SVN Repository

The instructions to create your initial SVN repository are provided here:
Initial SVN Repository

Additional Initial Checkouts

In addition to the normal scm/Deos tree, use the following steps to create the cert, test, and DDCI SVN folders:

cd ~/scm
svn checkout -N https://deos.ddci.com/scm/cert
svn checkout -N https://deos.ddci.com/scm/test
cd ~
mkdir svn
cd svn
svn checkout -N https://deos.ddci.com/svn/DDCI

Check Out A Component

To check out the file associated with a component, you need to first know the path to the component. Use the "SVN Deos" link from the Shared IP List on the main DDCI page to traverse to the desired component.

Check Out One Level at a Time

cd ~/scm/Deos
svn up -N <folderName>
cd <folderName>
# Repeat above 2 commands until you are at the "branches" folder
svn up <folderName> --set-depth=infinity

An example is provided below:

cd ~/scm/Deos
svn up -N products
cd products
svn up -N arinc653
cd arinc653
svn up -N runtime
cd runtime
svn up -N branches
cd branches
svn up mainline --set-depth=infinity

Check Out Entire Path

To check out the entire path and ONLY the children of the final folder, then use the following command:

svn up --parents ~/scm/Deos/products/arinc653/runtime/branches/mainline

SVN Commands

SVN Command Description
svn add fileName.ext Adds the file to subversion
svn add fileName.ext --no-auto-props Adds the file to subversion without any automatic subversion properties. Use this for review files. Example:

svn add rr01.* --no-auto-props

svn cleanup Recursively clean up the working copy, removing working copy locks and resuming unfinished operations
svn commit -m "PCR XXXXX: useful comment" fileName.ext Commit a file into the subversion repository, adding the provided comment to the version history. Examples:

svn commit -m "PCR 10469: updated test externals" common
svn commit -m "PCR 12345: Modified API calls to always check return status" fileName.ext

svn commit -F textFile.txt fileName.ext Commit a file into the subversion repository using the contents of the textFile.txt as the comment.

svn commit -f commentFile.txt tpk001.cpp

svn diff -r rNNNNN fileName.ext Display the difference between version NNNNN and the current contents of the file. Example:

svn diff -r r97224 tc0081.htm

svn info Display information about the current SVN branch such as latest SVN revision, etc
svn mv fromFile toFile Move (or rename) a file or folder. This preserves the version history.
NOTE: an svn commit is needed after the mv.
svn rm fileName.ext Remove/delete a file (or directory) from SVN
svn stat Show the list of modified and non-committed files
svn propget
svn propget
See below
svn stat -u Detailed list of files that differ from the current SVN repository
svn up Update to SVN head
svn up -rNNNNN Update all files (current folder and subfolders) to SVN version NNNNN

propget and propset

These commands are used to retrieve and modify the svn properties on a file or folder.

Deos:pcr-required

See Configuration Management Howto: Setting Subversion Property pcr-required

svn:externals

SVN Command Description
svn propget svn:externals common Display the list of external folders and the associated svn version number. Example which sends info to text file:

svn propget svn:externals common > textfile.txt

svn propset --file textfile.txt svn:externals common Update the svn version number(s) of the associated external folders.

Patches

To create a patch:

svn diff > mypatchfile.patch

To apply a patch:

svn patch mypatchfile.patch

To apply a patch to a PCR as an attachment:

  • On the PCR, select "Add an attachment" link near the top of the PCR
  • Using the Browse button, navigate to the correct folder and select “Open”
  • Description: Enter a brief summary of the patch
  • Select the "Patch" check box
  • Enter a more detailed summary of the issues noted in the patch file
  • Select Submit

To extract a patch from a PCR:

  • Find the list of attachments at the top of the PCR
  • Right click the patch file name and select “Save link as …”
  • Navigate to the correct folder and select “OK”

Subversion Configuration Files

Each file type has a list of subversion properties that are expected/required. The configuration files can be found in the following location:
/desk/etc/config

If you load the above file into an editor, you can see the required SVN properties based upon file type.

SVN with GPG Agent (Avoiding the excessive password requests)

If you are tired of the number of times that you are asked to enter your SVN username and password when you attempt to run subversion commands, then see these helpful wiki links for instructions to modify your environment:

Tips and Tricks

Check Out a Specific Version of a Folder

There are times when you want to have access to an entire folder and its children, BUT you want it to be an older version. For example, you want to look at a PRIOR baseline and compare it to the current baseline.
svn checkout -r NNNN [http_path] NEWNAME

Example:

svn checkout -r 96688 https://deos.ddci.com/scm/Deos/products/ioi/ioiapi/branches/mainline mainline_96688

The above creates a new folder called "mainline_96688" and the contents will be version at SVN 96688.

Connect an Editor to SVN Commit

Add the following environment variable to your .bashrc file if you want to associate the commit command with an editor:
SVN_EDITOR=vim

If the -m or -f parameter is NOT included with a commit, then subversion will attempt to launch the editor you specified so you can add a commit message.

Corrupted SVN Database

This occurs when you get the following message when you are attempting to execute any SVN command:
svn: E200030: sqlite[S11]: database disk image is malformed

There is no "easy" way to fix this. SVN cleanup and SVN revert do nothing to help resolve this issue. You need to create a new SVN tree as shown below. These steps assume the /scm/Deos tree has become corrupted:

  • Navigate to the root directory of the corrupted SVN tree:
cd ~/scm
  • Rename the corrupted tree OR delete the tree:
mv Deos Deos-corrupt

OR

rm -rf Deos
  • Checkout the Deos folder:
svn checkout -N https://deos.ddci.com/scm/Deos
  • Create the needed branches in your new SCM tree:
svn up --parents ~/scm/Deos/products/arinc653/runtime/branches/mainline/
  • [Optional] Use BeyondCompare on the old (Deos-corrupt) tree and the new tree to add back any changes that were still active in the corrupted tree
  • Delete the old (Deos-corrupt) folder
sudo rm -rf Deos-corrupt