且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何查看SVN工作副本中每个文件的修订号?

更新时间:2022-05-06 23:49:05

最后,我使用了Dmitry Yudakov发布的命令和js-rhino中的litle脚本的组合解决方案.现在,我可以找到所有具有不同修订版本号的文件,例如:

Finally I used combined solution using the command posted by Dmitry Yudakov and a litle script in js-rhino. Now I can find all the files with a different revision number doing something like:

svn信息-R> tmp_info犀牛read-svn.js | grep -v 295

svn info -R > tmp_info rhino read-svn.js | grep -v 295

/* The script */ 
lines = readFile("tmp_info").split("\n");  
lines.pop();
String.prototype.trim = function() {
  return this.replace(/^\s+|\s+$/g,"");
}
var idx = 0;
var files = [];
files[0] = {};
var line;
for (i in lines) {
  line = lines[i].toString();
  if(line.length) { 
    key = line.split(':')[0];
    if(key == 'Name' || key == 'Revision' || key == 'Path')
      files[idx][key] = line.split(':')[1];
  } else {
    idx++;
    files[idx] = {};
  }
}

print( 'files : ' + files.length + "\n");
for (i = 0; i< files.length ; i++) {
  var file = files[i];
  if(typeof(file.Name) !== "undefined")
    print(" REVISION: " + file.Revision.trim() + ' -  ' + file.Path.trim() +'/' + file.Name.trim() );
}