开发者

Can you query subversion to find all checkins by a specific author out of hours

I would like to run a query on subversion to find all the checkins performed by a specific user outside of the normal working hours (9am to 5pm) is there a way to do thi开发者_如何转开发s?


You can get the subversion history als xml output from the command line:

svn log <url> --xml

You can then write a script to parse the output and apply your search criteria...


You could lauch this and specify an hour at a time

 svn log | sed -n '/ XX:/,/-----$/ p'

Replace XX with the hour you want ex. 22.

Edit: To output all the hours you want, you could do a script that launch this command for every hours, and put it in a log file.

 #!/bin/sh
 svn log | sed -n '/ 19:/,/-----$/ p' >> svn.log
 svn log | sed -n '/ 20:/,/-----$/ p' >> svn.log
 svn log | sed -n '/ 21:/,/-----$/ p' >> svn.log
 svn log | sed -n '/ 22:/,/-----$/ p' >> svn.log
 ...


I have taken ChrisK's advice, and created an XML file using the following syntax...

svn log <url> --xml <path>

And then used the following query in LinqPad C# Statements to identify all checkins out of hours....

var xml = XElement.Load (@"c:\\work\\log.xml");

var query =
  from logEntry in xml.Elements()
  from myDate in logEntry.Elements()
  //from author in logEntry.Elements() //These lines get a specific author
  //where author.Value == "digiguru"
  //where author.Name == "author"
  where myDate.Name == "date"
  where !(DateTime.Parse(myDate.Value).Hour >= 9 && DateTime.Parse(myDate.Value).Hour <= 17)
  select logEntry;

query.Dump();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜