Use Subversion (SVN) to get and check in files



Dreamweaver can connect to a server that uses Subversion (SVN), a versioning control system that lets users collaboratively edit and manage files on remote web servers. Dreamweaver is not a full SVN client, but does let users get the latest versions of files, make changes, and commit the files.

Important: Dreamweaver CS4 uses the Subversion 1.4.5 client library. Later versions of the Subversion client library are not backward-compatible. Be aware, if you update a third-party client application (for example, TortoiseSVN) to work with Subversion 1.5 or later, the updated Subversion application will update local Subversion meta data, and Dreamweaver will no longer be able to communicate with Subversion. This issue is not affected by updates to the Subversion server as those updates are backward-compatible. For more information on this issue, see www.adobe.com/go/dw_svn_en.

Adobe recommends that you use a third-party file comparison tool as you work with SVN version-controlled files. When you compare files for differences, you can learn exactly what kinds of changes other users made to the files. For more information on file comparison tools, use a web search engine such as Google Search to search for “file comparison” or “diff” tools. Dreamweaver works with most third-party tools.

For a video overview of working with SVN and Dreamweaver, see www.adobe.com/go/lrvid4049_dw.

Set up an SVN connection

Before you use Subversion (SVN) as a version control system with Dreamweaver, you must set up a connection to an SVN server. You set up a connection to an SVN server in the Version Control category of the Site Definition dialog box.

The SVN server is a repository of files from which you and other users can get and commit files. It is different from the remote server you typically use with Dreamweaver. When using SVN, the remote server remains the “live” server for your web pages, and the SVN server exists to hold the repository of files over which you want to maintain version control. The typical workflow is to get and commit files back and forth between the SVN server, and then publish them to your remote server from Dreamweaver. The remote server setup is completely separate from the SVN set up.

You must have access to an SVN server and an SVN repository before you begin this set up. For more information about SVN, see the Subversion website at http://subversion.tigris.org/.

To set up the SVN connection, follow these steps:

  1. Choose Sites > Manage Sites, select the site you want to set up version control for, and click the Edit button.
    Note: If you haven’t already set up local and remote folders for a Dreamweaver site, you’ll at least need to set up a local site before proceeding. (The remote site is not required at this stage, but you will eventually need to set it up before publishing your files to the Web.) For more information, see Setting up a Dreamweaver site.
  2. Make sure the Advanced tab of the Site Definition dialog box is selected.

  3. Select the Version Control category in the Category column of the Site Definition dialog box.

  4. Select Subversion from the Access pop-up menu.

  5. Set access options as follows:

    • Select a protocol from the Protocol pop-up menu. The available protocols are HTTP, HTTPS, SVN, and SVN+SSH.

      Note: Using the SVN+SSH protocol requires special configuration. For more information, see www.adobe.com/go/learn_dw_svn_ssh_en.
    • Enter the address for the SVN server in the Server address text box (typically in the form of servername.domain.com).

    • Enter the path to your repository on the SVN server in the Repository path text box (typically something like /svn/your_root_directory. It is up to the server administrator to name the root folder for the SVN repository.)

    • (Optional) If you want to use a server port other than the default server port, select Non Default and enter the port number in the text box.

    • Enter your SVN server user name and password.

  6. Click Test to test your connection, or click OK to close the dialog box. Then click Done to close the Manage Sites dialog box.

Once the connection with the server established, your SVN repository is available for viewing in the Files panel. To view it, you can select Repository View from the View pop-up menu, or click the Repository Files button  in the expanded Files panel.

Mount folders from the SVN repository

The process of mounting folders from the SVN repository to your local machine creates an exact mapping of the folder structure in the SVN repository. When you mount a folder from the SVN repository, Dreamweaver gets all of the files that are in that folder, as well as any subfolders.

Note: When getting files for the first time from the repository, you should work with a local directory that is empty, or a local directory that does not contain files with the same names as files in the repository. Dreamweaver will not mount repository files to the local drive upon first try if the local drive contains files whose names match files in the remote repository.
  1. Make sure that you’ve successfully set up an SVN connection.

  2. Display the SVN repository files by selecting Repository View from the View pop-up menu in the Files panel, or by clicking the Repository Files button in the expanded Files panel.

  3. Right-click (Windows) or Control-click (Macintosh) the folder from the SVN repository that you want to mount, and select Mount Folders.

Get the latest versions of files

When you get the latest version of a file from the SVN repository, Dreamweaver merges the contents of that file with the contents of its corresponding local copy. (In other words, if someone else has updated the file since you last committed it, those updates are merged into the local version of the file on your computer.) If the file does not yet exist on the local hard drive, Dreamweaver simply gets the file.

Note: When getting files for the first time from the repository, you should work with a local directory that is empty, or a local directory that does not contain files with the same names as files in the repository. Dreamweaver will not mount repository files to the local drive upon first try if the local drive contains files whose names match files in the remote repository.
  1. Make sure that you’ve successfully set up an SVN connection.

  2. Do one of the following:

    • Display the local version of your SVN files in the Files panel by selecting Local view from the View pop-up menu. (If you are working in the expanded Files panel, the Local view is automatically displayed.) Then right-click (Windows) or Control-click (Macintosh) the file or folder you’re interested in and select Version Control > Get Latest Versions.

    • Display the SVN repository files by selecting Repository View from the View pop-up menu in the Files panel, or by clicking the Repository Files button in the expanded Files panel. Then right-click (Windows) or Control-click (Macintosh) the file or folder you’re interested in and select Get Latest Versions.

Note: You can also either right-click a file and choose Check Out from the context menu, or select the file and click the Check Out button to get the latest version. Because SVN does not support a check-out workflow, however, this action does not actually check out the file in the traditional sense.

Commit files

  1. Make sure that you’ve successfully set up an SVN connection.

  2. Do one of the following:

    • Display the local version of your SVN files in the Files panel by selecting Local view from the View pop-up menu. (If you are working in the expanded Files panel, the Local view is automatically displayed.) Then select the file you want to commit and click the Check In button.

    • Display the SVN repository files by selecting Repository View from the View pop-up menu in the Files panel, or by clicking the Repository Files button in the expanded Files panel. Then right-click (Windows) or Control-click (Macintosh) the file you want to commit and select Check In.

  3. Review the actions in the Commit dialog box, make changes if necessary, and click OK.

    You can change actions by selecting the file whose action you want to change, and clicking the buttons at the bottom of the Commit dialog box. Two choices are available: commit and ignore.

Note: A green check mark on a file in the Files panel denotes a changed file that has not yet been committed to the repository.

Update status of files or folders in the repository

You can update the SVN status of a single file or folder. The update does not refresh the entire display.

  1. Make sure that you’ve successfully set up an SVN connection.

  2. Display the SVN repository files by selecting Repository View from the View pop-up menu in the Files panel, or by clicking the Repository Files button in the expanded Files panel.

  3. Right-click (Windows) or Control-click (Macintosh) any folder or file in the repository and select Update Status.

Update status of local file or folders

You can update the SVN status of a single file or folder. The update does not refresh the entire display.

  1. Make sure that you’ve successfully set up an SVN connection.

  2. Display the local version of your SVN files in the Files panel by selecting Local view from the View pop-up menu. (If you are working in the expanded Files panel, the Local view is automatically displayed.)

  3. Right-click (Windows) or Control-click (Macintosh) any folder or file in the Files panel and select Update Status.

View revisions for a file

  1. Make sure that you’ve successfully set up an SVN connection.

  2. Do one of the following:
    • Display the local version of your SVN files in the Files panel by selecting Local view from the View pop-up menu. (If you are working in the expanded Files panel, the Local view is automatically displayed.) Then right-click (Windows) or Control-click (Macintosh) the file you want to see revisions for and select Version Control > Show Revisions.

    • Display the SVN repository files by selecting Repository View from the View pop-up menu in the Files panel, or by clicking the Repository Files button in the expanded Files panel. Then right-click (Windows) or Control-click (Macintosh) the file you want to see revisions for and select Show Revisions.

  3. In the Revision History dialog box, select the revision or revisions you’re interested in and do one of the following:

    • Click Compare to Local to compare the selected revision with the local version of the file.

      Note: You must install a third-party file comparison tool before you can compare files. For more information on file comparison tools, use a web search engine such as Google Search to search for “file comparison” or “diff” tools. Dreamweaver works with most third-party tools.
    • Click Compare to compare two selected revisions. Control-click to select two revisions simultaneously.

    • Click View to view the selected revision. This action does not overwrite the current local copy of the same file. You can save the selected revision to your hard drive just as you would save any other file.

    • Click Promote to make the selected revision the most current revision in the repository.

Lock and unlock files

Locking a file in the SVN repository lets other users know that you are working on a file. Other users can still edit the file locally, but will not be able to commit the file until you’ve unlocked it. When you lock a file in the repository, you’ll see an open-lock icon on the file. Other users see a completely locked icon.

  1. Make sure that you’ve successfully set up an SVN connection.

  2. Do one of the following:

    • Display the SVN repository files by selecting Repository View from the View pop-up menu in the Files panel, or by clicking the Repository Files button in the expanded Files panel. Then right-click (Windows) or Control-click (Macintosh) the file you’re interested in and select Lock or Unlock.

    • Display the local version of your SVN files in the Files panel by selecting Local view from the View pop-up menu. (If you are working in the expanded Files panel, the Local view is automatically displayed.) Then right-click (Windows) or Control-click (Macintosh) the file you’re interested in and select Lock or Unlock.

Add a new file to the repository

A blue plus sign on a file in the Files panel denotes a file that does not yet exist in the SVN repository.

  1. Make sure that you’ve successfully set up an SVN connection.

  2. In the Files panel, select the file you want to add to the repository and click the Check In button.

  3. Make sure that the file is selected for Commit in the Commit dialog box and click OK.

Resolve conflicting files

If your file conflicts with another file on the server, you can edit it and then mark it as resolved. For example, if you try to check in a file that conflicts with another user’s changes, SVN will not let you commit the file. You can get the latest version of the file from the repository, manually make changes to your working copy, and then mark your file as resolved so that you can commit it.

  1. Make sure that you’ve successfully set up an SVN connection.

  2. Display the local version of your SVN files in the Files panel by selecting Local view from the View pop-up menu. (If you are working in the expanded Files panel, the Local view is automatically displayed.)

  3. Right-click (Windows) or Control-click (Macintosh) the file you want to resolve and select Version Control > Mark as Resolved.

Go offline

You might find it useful to avoid repository access during other file-transfer activities by going off-line. Dreamweaver will reconnect to the SVN repository as soon as you invoke an activity that requires a connection (Get Latest Versions, Commit, and so on).

  1. Make sure that you’ve successfully set up an SVN connection.

  2. Display the local version of your SVN files in the Files panel by selecting Local view from the View pop-up menu. (If you are working in the expanded Files panel, the Local view is automatically displayed.)

  3. Right-click (Windows) or Control-click (Macintosh) any file or folder in the Files panel and select Version Control > Go Offline.

Clean up a local SVN site

This command lets you remove locks on files so that you can resume unfinished operations. You should use this command to remove old locks if you receive “working copy locked” errors.

  1. Make sure that you’ve successfully set up an SVN connection.

  2. Display the local version of your SVN files in the Files panel by selecting Local view from the View pop-up menu. (If you are working in the expanded Files panel, the Local view is automatically displayed.)

  3. Right-click (Windows) or Control-click (Macintosh) the file you want to clean up and select Version Control > Clean Up.

About moving files and folders in Subversion-controlled sites

When you move the local versions of files or folders in a Subversion-controlled site, you run the risk of creating problems for other users who might be synching to the SVN repository. For example, if you move a file locally, and don't commit that file to the repository for a few hours, another user might try to get the latest version of the file from the file’s old location. For this reason, you should always commit files back to the SVN server immediately after you've moved them locally.

Files and folders remain on the SVN server until you've manually deleted them. So even if you move a file to a different local folder and commit it, the old version of the file remains in the previous location on the server. To avoid confusion, delete the old copies of files and folders that you've moved.

When you move a file locally and commit it back to the SVN server, the file’s version history is lost.