svn-number
Subversion (SVN) management in terminal made easy.
svn-number
does
What svn-number
makes management of your SVN projects a blast.
This library includes:
- Pointers
Pointers are file indexes, added in front file references when runningsvn-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 samesvn
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]
.
- Ranges
- Colors
Colors are added tosvn status
andsvn diff
- i.e. when usingsvn-number status
andsvn-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
becomesC:/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 - throughsvn-number status
- copy-paste the file names, and use them with the standardsvn
actions.
Screenshots
svn-number status
Notice the alternating background coloration of even line numbers. For improved readability.
svn-number diff 3
svn-number
does not do
What - 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 runningsvn-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:
- It's
git
equivalent:git-number
(https://github.com/holygeek/git-number) svn-color
(https://github.com/philchristensen/svn-color)
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 whichsvn-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 ansvn 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.