Main Content

Work with Files Under SVN in MATLAB

You can use Subversion® (SVN) source control in MATLAB® to manage your files and collaborate with others. Using SVN, you can track changes to your files and recall specific versions later. From the MATLAB Current Folder browser, you can checkout an existing repository, add files to SVN source control, and commit changes.

Basic SVN workflow

Check Out from SVN Repository

Create a new local copy of a repository by retrieving files from source control.

  1. Right-click in the white space (any blank area) in the Current Folder browser and select Source Control > Manage Files.

  2. In the Manage Files Using Source Control dialog box, select the source control interface from the Source control integration list. To use SVN, leave the default SVN.

  3. If you know your repository location, paste it into the Repository path field.

    Otherwise, to browse for and validate the repository path to retrieve files from, click Change.

    1. In the Specify SVN Repository URL dialog box, specify the repository URL by entering a URL in the box, using the list of recent repositories.

    2. Click Validate to check the repository path.

      If you see an authentication dialog box for your repository, enter the login information to continue.

    3. If the path is invalid, check the URL against your source control repository browser.

      If necessary, select a deeper folder in the repository tree. You might want to check out from trunk or from a branch folder under tags, if your repository contains tagged versions of files. You can check out from a branch, but the built-in SVN integration does not support branch merging. Use an external tool such as TortoiseSVN to perform branch merging.

    4. When you have finished specifying the URL path you want to retrieve, click OK. The dialog box closes and you return to the Manage Files Using Source Control dialog box.

  4. In the Manage Files Using Source Control dialog box, select the sandbox folder to store the retrieved files and click Retrieve.

    If you see an authentication dialog box for your repository, enter the login information to continue.

    Caution

    Use local sandbox folders. Using a network folder with SVN slows source control operations.

    The Manage Files Using Source Control dialog box displays messages as it retrieves the files from source control.

Retrieve Tagged Version of Repository

To use tags with SVN, you need the standard folder structure in your repository. For more information, see Standard Repository Structure.

  1. Right-click in the white space in the Current Folder browser, and select Source Control > Manage Files.

  2. In the Manage Files Using Source Control dialog box, select the source control interface from the Source control integration list. To use SVN, leave the default SVN.

  3. Click Change to select the repository path that you want to retrieve files from.

  4. In the Specify SVN Repository URL dialog box:

    1. Select a recent repository from the Repository list, or click the Repository button to browse for the repository location.

    2. Click Validate to show the repository browser.

    3. Expand the tags folder in the repository tree, and select the tag version you want. Navigate up a level in the repository if the URL contains the trunk.

    4. Click OK to continue and return to the Manage Files Using Source Control dialog box.

  5. Select the sandbox folder to receive the tagged files. You must use an empty sandbox folder or specify a new folder.

  6. Click Retrieve.

Mark Files for Addition to SVN Source Control

When you create a new file in a folder under source control, the Not Under Source Control symbol appears in the status column of the Current Folder browser. To add a file to source control, right-click the file in the Current Folder browser, and select Source Control > Add to SVN.

When you mark a file for addition to source control, the symbol changes to Added .

Update SVN File Status and Revision

To refresh the source control status of files and the icons in the source control column, select one or more files in the Current Folder browser, right-click and select Source Control > Refresh SVN status.

To refresh the status of all files in a folder, right-click the white space of the Current Folder browser and select Source Control > Refresh SVN status.

Note

Refreshing the SVN source control status does not contact the repository to get the latest file revisions.

To update the local copies of selected files, select one or more files in the Current Folder browser, right-click and select Source Control > Update Selection from SVN.

To update all files in a folder, right-click the Current Folder browser and select Source Control > Update All from SVN.

Review Changes in SVN Source Control

The files under source control that you have changed display the Modified File symbol in the Current Folder browser. Right-click the file in the Current Folder browser, select Source Control, and select:

  • Show Revisions to open the File Revisions dialog box and browse the history of a file. You can view information about who previously committed the file, when they committed it, the log messages, and the list of files in each change set. You can select multiple files and view revision history for each file.

    You also can select a revision and browse the lower list of files in the change set. Right-click files to view changes or save revisions.

  • Compare to Revision to open a dialog box where you can select the revisions you want to compare and view a comparison report. You can either:

    • Select a revision and click Compare to Local.

    • Select two revisions and click Compare Selected.

    You also can select a revision and browse the lower list of files in the change set. Right-click files to view changes or save revisions.

  • Compare to Ancestor to run a comparison with the last checked-out version in the sandbox. The Comparison Tool displays a report.

If you need to update the status of the modified files, see Update SVN File Status and Revision.

Commit or Revert Changes to Modified Files under SVN Source Control

Before you commit modified files, review changes and mark any new files for addition into source control. The files under source control that you can commit to a repository display the Added to Source Control symbol or the Modified File symbol in the Current Folder browser.

  1. Right-click in the Current Folder browser and select Source Control > View and Commit Changes. In the View and Commit Changes dialog box, select the files to commit to the repository.

  2. Enter comments in the dialog box, and click Commit.

  3. A message appears if you cannot commit because the repository has moved ahead. Before you can commit the file, you must update the revision up to the current HEAD revision.

    To update the revision, right-click in the Current Folder browser and select Source Control > Update All from SVN. Resolve any conflicts before you commit.

If you do want to commit changes to modified files under SVN source control and want to revert local changes instead, right-click the file and select Source Control > Revert Local Changes and Release Locks. This command releases locks and reverts to the version in the last sandbox update. If your file is not locked, the menu option is Source Control > Revert Local Changes. To abandon all local changes, select all the files in the Current Folder browser before you select the command.

To revert a file to a specified revision, follow these steps:

  1. Right-click the file in the Current Folder browser and select Source Control > Revert using SVN.

  2. In the Revert Files dialog box, choose a revision to revert to. Select a revision to view information about the change such as the author, date, and log message.

  3. Click Revert.

Related Topics