Overview

Sublime Text 3 CVSDiff Plugin

This plugin allows you to view diffs generated by your cvs of choice inside Sublime. Also, it links diff hunks to your files, allowing to go from diff to code.

Install

The files can be obtained on bitbucket:

https://bitbucket.org/domu/sublimecvsdiff

Complete Documentation

Commands

sublime_diff_generate_file_diff

Will run diff on the file opened in current tab.

sublime_diff_generate_repo_diff

Will run diff on the whole repo

sublime_diff_goto_source

When run in diff view, it will determine current diff hunk and will jump to appropriate file, placing cursor to the same position.

Both "sublime_diff_generate_file_diff" and "sublime_diff_generate_repo_diff" will open new scratch buffer with diff. It will use Diff syntax highlighter ("Packages/Diff/Diff.tmLanguage"). Also "sublime_diff.view" will be added to this view settings, so you can use it in your commands context.

Example:

{ "keys": ["super+alt+down"], "command": "sublime_diff_goto_source", "context":
   [
       { "key": "setting.sublime_diff.view", "operator": "equal", "operand": true }
   ]
}

Options

use_one_diff_view

will reuse diff view if it exists (default: true)

draw_hunk_outline

will draw outline around diff hunks (default: false)

All options can be set both in "sublime-diff.sublime-settings" and user settings.

Project Options

sublime_diff.cvs

the cvs to use with this project

sublime_diff.root

repo folder for this project

Example:

This one is taken from sublime_diff project itself

"settings":
{
    "sublime_diff.cvs":"hg",
    "sublime_diff.root":"./"
}

These options should be set in your project file

CVS options

CVSDiff will look into cvs_binding/sublime-diff-<cvs_name>-sublime-settings for per-cvs setup. If some option is absent it will be taken from cvs_binding/sublime-diff-default-sublime-settings

command

cvs diff command with all the args to get unified diff.

For example default hg command is hg diff -w --nodates

re.src_file

regex for source file in diff hunk header (default: ^---\\s+([^\\t]+))

re.dst_file

regex for destination file in diff hunk header (default: ^\\+\\+\\+\\s+([^\\t]+))

re.range_info

regex for diff hunk range (default: ^@@ -(\\d+),(\\d+) \\+(\\d+),(\\d+) @@)

re.added_line

regex for added line (default: ^\\+.+$)

re.hunk_line

regex for line in diff hunk (default: ^[-+ ].+$)

License

The code is written by Alexey Orlov alexey.orlov.by@gmail.com and placed in the Public Domain