How to use node to get SVN user information
We still use SVN for versioning, sometimes we have to monitor a person's code, and the SVN username is the best user tag.
So how do we get some svn information?
Assuming that everyone is using mac
as the development machine.
below, I provide some code.
/** * [user information via SVN] * @param {[type]} host [address of the SVN repository, e.g. 192.168.1.1:80] * @param {functi on} CB [callback after get] */var GetUserInfo = function (HOST,CB) {var cmd = ' cd ~/.subversion/auth/svn.simple/&& ls | Xargs cat $ ' child_process.exec (cmd,function (err,data) {var fragment = Data.split (host) [1]; Fragment.replace (/username\n.+\n (\w+) \n/,function () {CB && CB (ARGUMENTS[1]); }) });}
The code is a little bit simpler, but in node as the development environment, SVN is the version control that works.
If you are using Windows as your development machine, use子进程的方式
is not possible. But you can pass somefs
To replace the operation.
If there is time behind, I will put somesvn
Tools to solve some code-building problems.
But aside from that, the number of companies that are now using SVN is getting smaller, with the exception of some of the oldest and most important codes in SVN, all of which turn to git.
Let's go to git.
You can look at my blog Http://hirra.cn/2015/01/03/node There are not many things in the present, but the follow-up will slowly add.
How to use node to get SVN user information