Skip to content

kafoso/svn-number

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

svn-number

Subversion (SVN) management in terminal made easy.


What svn-number does

svn-number makes management of your SVN projects a blast.

This library includes:

  • Pointers
    Pointers are file indexes, added in front file references when running svn-number status. By referencing said indexes when you type new commands, svn-number turns each number into its respective file path, meaning you only have to type a number instead of partial or full file paths.
    • Ranges
      Apply the same svn command to multiple files at once using the hypen, -, to indicate a number ranges. E.g. 2-6 = [2,3,4,5,6].
    • Non-consecutive numbers (comma separated)
      Use commas (without any spaces) to reference non-consecutive numbers. E.g. 2,4 = [2,4]. May also be combined with ranges, e.g. 2-4,7 = [2,3,4,7].
  • Colors
    Colors are added to svn status and svn diff - i.e. when using svn-number status and svn-number diff, respectively - vastly improving readability. For details, see Styling.
  • Fixed file paths & escapes
    File paths are converted to always use forward slashes, e.g. C:\bad\windows\is\bad becomes C:/bad/windows/is/bad. No more backslash frustrations!

    Additionally, file paths are escaped, meaning space characters no longer pose a problem!

    If you dislike the pointer logic (explained above), you may now - through svn-number status - copy-paste the file names, and use them with the standard svn actions.

Screenshots

svn-number status

svn-number status

Notice the alternating background coloration of even line numbers. For improved readability.

svn-number diff 3

svn-number diff 3

What svn-number does not do

  • It does not modify other arguments than the Pointers and the file paths (slash conversion and escaping). This means you still have to apply additional arguments as needed. E.g. svn-number revert -R my/folder to recursively revert a folder and all of its contents.

Installation

Requires: PHP 5.3+

  • Retrieve this repository, e.g.: git clone git@github.com:kafoso/svn-number.git.
  • Add an alias or symlink, referencing the location of svn-number.php.

That's it!

Usage

  • In a terminal, navigate to your respective SVN project repository.
  • Use svn-number, e.g. by running svn-number status.

Use svn-number same way as svn, but instead write svn-number. I.e. svn-number <args> or svn-number # <args>, where the # is the integer presented to you when doing svn-number status.

Styling

Styling is added to svn-number status and svn-number diff.

Aliasing

I recommend doing some aliases in your .bashrc or .profile for convenience, ease of use, and speed.

For instance:

  • sn = svn-number

  • sa = svn-number add

  • sd = svn-number diff

  • so = svn-number checkout

  • srev = svn-number revert

  • srm = svn-number remove

  • ss = svn-number status

Motivation

Going from git to svn, and from OSX/Linux to Windows, I needed a convenient yet reliable means of managing my SVN projects in a Git Bash terminal on Windows.

I'm not fond of GUIs for these purposes (PhpStorm, TortoiseSVN, WinSVN, etc.), and I wanted to stick with my ol' faithful terminal.

git svn was not an option due to a workplace policy, and getting existing libraries (svn-color, colordiff, etc.) to function properly on Windows is often tedious and frustrating.

Therefore, I decided it was time for a minimalist SVN library, providing some much needed conveniences. A library, which should work cross-platform.

PHP became the choice of programming language. It's a language I'm fairly adept in, it's easy to install on most operating systems, and these days it usually works out-of-the-box 1.

Inspiration & Credits

This library was inspired by:

Disclaimer

License: MIT

Basically: Use svn-number at your own risk.

TODO

  • svn merge
  • Make argument order insignificant. Currently, the svn action and pointers must be provided as 2nd and/or 3rd arguments, e.g. "svn-number status 1" or "svn-number 1 status". However, a command like svn -u st js\views\home\HomeView.js is valid; a behavior which svn-number should reflect.
  • Terminal overflow on diffs.

Future plans

  • Enhance execution speed. Perhaps comparing change hashes is faster than a full svn status when having to do an svn diff?

Footnotes

1: If you run Git Bash on Windows (as I am), you need to setup the PHP PATH in Environment Variables so that it points to the location of your php.exe file.

About

Do your Subversion modifications in terminal through numbers instead of full file paths.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages