Paulis software -> Vedit resources -> SVN Support 28. 01. 2018  
--------

SVN support for VEDIT

Subversion (SVN) is a free open source revision control system. Unlike git, SVN is a centralized system that requires a server.

With this package you can perform some of the most common SVN functions directly from within Vedit text editor. This makes it easy to perform the functions on the file you are editing, and to easily perform some operations that would require cryptic commands when using the command line tool.

The macro has been tested with Vedit 6.24, but it should work with older versions, too. However, some of the functionality (such as double-click) require Vedit 6.21 or later.

See below for description of each file in the package.

Download Download vedit_svn_1_0.zip   -   V1.0   -   2018-01-28   -   15 K   -   Vedit 6.24

Main macro

SVN.vdm main dialog box

svn.vdm displays a dialog box for performing some basic svn operations on your work files. The options available depend on context.   (Click on a button below to go to description of corresponding function.)

Status - Displays list of modified/added/deleted files that need to be committed.
Log - Lists commit log for current file, directory or repository.
Diff - Compare different versions of a file or directory.
Add - Add current file to repository. 1)
Remove - Remove current file from repository. 1)
Undo - Undo file add or remove. 1)
Revert - Discards changes in the work file and fetches current version from repository.
Commit - Commits all modified files into svn repository.
Options - Displays Options dialog.

1) Button [Add], [Remove] or [Undo] is shown depending on whether the file is already on repository or not, or if the file is scheduled to be added or removed.

If svn.vdm is called while Log output (svn_log.tmp) is the current file, some of the buttons in the main dialog are different. Buttons Add/Remove/Undo and Revert are not displayed. Instead, the following additional buttons are shown:

Files - Displays list of files modified in the selected revision.
Get - Get the selected revision of the file from repository to your local disk.

Detailed description:

Status

Opens a window to display current commit status. Lists files on your working directory that have been modified, added or removed since the last commit, and files that are not in repository.

If you double-click on a filename in this window, that file is opened for edit (requires Vedit 6.20 or later).
If you call svn.vdm when the status window is active, you can perform operations (Add, Remove, Undo, Log, Diff) for the file on the cursor line. (If there is no filename on cursor line, the next filename is searched forward.)

Note: You can use ignore list to specify files that you do not want to be shown in this list (e.g. *.obj and *.bak files) using ignore list. See Options dialog.

Log

svn Log dialog

Lists commit log for the changes on the current file (or file selected from status display) / current dir / all files in the repository.
A dialog box opens where you can choose options for log:

"List commits for" selection defaults to "File". Other options are remembered if you change them.

Click OK to create the log listing. A new window opens to display the log with syntax highlighting.

If you call svn.vdm while the log display is active, you have some additional options:
  - Some of the buttons in main dialog are different (see above).
  - If you select Diff while the Log display is active, you can choose diff for selected commit (See Diff below).
  - If you select Log again, the option "List commits for" is replaced with option to choose first revision to list:

Diff

SVN Diff dialog

Compares two revisions of files with diff algorithm and creates list of changes between the revisions.

A dialog box opens where you can select the options for svn diff:

If you call svn diff while svn_log.tmp is the active file, you have an option to choose an earlier commit from the list. Move cursor anywhere on the description of the commit you are interested in and call svn diff. Now you have additional options to compare your work file to selected commit, or to compare selected commit to its parent.

You can even compare any two revisions listed in the log display. First highlight a block anywhere in the description of the first (older) revision you want to compare (for example the commit number). Then move cursor to the second revision and execute svn diff. Now you have yet another option, "Compare Selected revision to Highlighted revision".

Additional options can be selected with checkboxes:
  [ ] Ignore space change - If number of spaces (e.g. indent level) has changed, that change is not shown.
  [ ] ignore EOL style - CR, LF or CR-LF change is ignored.
  [ ] Summary only - Only list names of changed files. (Useful especially when comparing changes over several revisions.)

The diff results are displayed in a new window with syntax highlighting (so you can clearly to see which lines have been changed, added or deleted). If you double-click on a code line in the listing, the corresponding file is opened and the cursor is moved to corresponding line in your work-file.

Add, Remove, Undo

Which button of these is displayed depends on whether the file is already on repository or not, or if the file is scheduled to be added or removed.
Add button schedules the current file (or a file selected from Status window) to be added to repository on next commit (svn add).
Remove button is displayed if the file is already in repository. The file will be removed from repository on next commit, but it will remain in your workspace. (svn delete --keep-local).
Undo button is displayed if the file has been added or removed but not yet committed. This option undoes the Add/Remove operation. (svn revert).

Revert

Discards changes in the work file and fetches current version from repository (svn revert).
Note: The file date will be restored to original date. Thus, if you want to re-compile the code, you may need to execute "Build All" or equivalent command in your development environment.

Files

This function is available when you call svn.vdm from Log display window. Displays list of files changed on the selected commit. To select the commit, move cursor anywhere in the description of the commit (on the commit line or below it), then call svn.vdm and select [Files].

The file list is opened in a new window, together with the commit description. You can double-click on a line containing filename to open that file. If you call svn.vdm while the file list is open, the svn commands (such as diff) are targetted to selected filename and revision.

Get

This function is available when you call svn.vdm from Log display window. It fetches the selected revision of the current file.

A dialog box opens for selecting the location where the file will be stored. You can choose either current files directory or VEDIT_TEMP directory. The filename for the fetched file is combination of revision number and the original filename. For example, if you fetch revision 123 of the file main.c, the fetched file will have name r123_main.c. The file is automatically opened for edit.

Commit

Updates all modified files from your working directory into svn repository. A second instance of Vedit opens for entering the commit message. Status of changed files is listed as comments (the comments will not be included in commit message). You can type one or more lines of text. When done, close this instance of Vedit and answer "Yes" when prompted to save the changes. If you leave the commit message empty (the message contains only comments), the commit is canceled.

After the commit has been performed, a message window is displayed at the bottom of screen. The window is green on success and red if there were any errors. You will have to close this window manually after reading the message.

Options

Opens Options dialog for editing some Subversion settings. Clicking a button on Options dialog opens one of Subversion configuration files for editing in a new Vedit instance. After editing the file, exit the Vedit instance and save the file if you want the settings to be stored.


Double-click event macros

svn_dclick_status.vdm - implements double-click on the svn Status window and Files window. Double-clicking on a filename opens (or switches to) the corresponding file. (If the cursor is not on a filename, the macro tries to search forward for a line which lists modified, added or deleted file.)

svn_dclick_diff.vdm - implements double-click on the svn diff window. Double-clicking on a code line opens (or switches to) the corresponding file and moves cursor to the line specified by the line number (in the current version of the file).

(Note: The double-click macros require Vedit 6.20 or later.)

Syntax files

The package contains syntax files to add some color to each of the listings.
The syntax highlighting is automatically activated if you copied the supplied filename specific configuration files (*.CFN) into your config directory (see Installing Svn Support below).

svn_diff.syn provides syntax highlighting for Diff listing (svn_diff.tmp). Colors are used to indicate changes. On the "Black chars on White" color scheme,
lines from old version (deleted lines) are shown as red, and
lines from new version (added lines) are shown as green.

svn_log.syn provides syntax highlighting for Log listing (svn_log.tmp) changed files list (svn_files.tmp) and commit message entry (svn-commit.tmp).

svn_status.syn provides syntax highlighting for Status display (svn_status.tmp).

svn_config.syn provides syntax highlighting for svn configuration file.

(Note: The syntax colors work best with black-on-white color scheme.)

File type specific configuration

The package contains .CFN files for each output file type. The main purpose of these packages is to automatically enable color syntax highlighting. These files should be moved to your file-cfg folder. This can be done with svn_setup.vdm macro below.

--------

Installing SVN Support

You must already have Subversion installed in such way that you can enter svn commands from DOS prompt. To install and configure Subversion, see svn documentation (check the links below).

To install this svn support package, unzip the files into your user-mac directory.
To configure svn for Vedit, you can run the supplied macro svn_setup.vdm. (This is not mandatory, you can do the configuration steps manually if you like.)

Svn_setup.vdm

Opens a dialog box where you can select the configuration steps you want. The macro performs the following steps:

  1. Move filename specific configuration files (*.CFN) to your file-cfg folder.
    The main purpose of this is to enable syntax highlighting for the status, log etc. displays. (If the files have already been moved, this option is grayed.)
  2. Set Vedit as svn default editor (used for entering commit text etc.).
  3. Create global Exclude file.
    Global exclude file will be used in all your projects. (In addition, you can have project specific ignore files.)
    Creates the exclude file by default in your Vedit USER_CFG directory and then opens it for editing. If you already have an exclude file, it is opened instead. The macro adds vedit temporary files, .bak files and Wildfilew.vdm temporary files to the list of ignored files. You can manually edit the file if you need. (Don't forget to save the file.)

To make it easier to run svn, you can add the following lines in your User or Tools menu:

1 + 128
Svn...
#124=Reg_Free Call_File(#124,"svn.vdm") Reg_Empty(#124)

(You may need to change the hot-key to suit your menu.)

---

Links

Apache™ Subversion - Subversion Homepage
Svn Book - On-line version of the book Version Control with Subversion. Learn to use svn.