Any way to find out who made the file changes, during the build process?

I am now doing some code review tasks, as well as StyleCop, during the build process.  I can get the changed file list from 'teamcity_build_changedFiles_file' and I can get the Subversion revision number from the same file.  What I don't have, is the name of the person who edited the file, or the bug number.  We are using Subversion and Bugzilla.

Is there any way to get to the name of the person, given the file name and subversion revision?  I want to be able to email the person who edited the file, if it fails the StyleCop scan.

Comment actions Permalink,

The information about the committers is not passed to the build. Actually, it is might be several names (since a build may include several changes) so names are probably not the only information that will be necessary in this case.

I'd consider one of the following approaches:
- fail the build with specific messages and rely on TeamCity ability to send email notifications for users who committed into the build (users need to have "builds with my changes" notification enabled)
- if you use TeamCity 5.0, use REST API to get information on the changes of the current build in XML
- write a Java plugin to TeamCity that will gather and pass all the necessary information to the build
- write a plugin that will send necessary emails based ont he build resutls.

Comment actions Permalink

I ended up writing a MSBuild task to do it, using SharpSvn library stuff.  Here is the code, in case someone else would like to see how to do it.  This will actually give you want you need to pull just about anything out of SVN, once you have the file name and version from the TC's teamcity_build_changedFiles_file parameter.


Here is the MSBuild Task, which reads the TC changed files file during the build.  Then this calls the ParseFile task for each file in the changed file list.

  <Target Name="FileList"
          Condition=" $(teamcity_build_changedFiles_file) != '' ">
    <Message Text="                                                        " />
    <Message Text=" ****************************************************** " />
    <Message Text=" ****                    FileList                  **** " />
    <Message Text=" ****************************************************** " />
    <Message Text="                                                        " />

      <ChangedList Include="$(teamcity_build_changedFiles_file)" />
    <ReadLinesFromFile File="@(ChangedList)">
      <Output TaskParameter="Lines"
              ItemName="ItemsFromChangedList" />

    <Message Text="%(ItemsFromChangedList.Identity)" />

   <ParseFile BuildCheckout="$(dirFileTest)"
                    BuildString="%(ItemsFromChangedList.Identity)" />

Here is most important parts of my MSBuild task, just to give you an idea how to do this:

    public class ParseFile : Task
        private string buildCheckout;
        private string buildString;
        private string fileName;
        private string fileStatus;
        private string fileSvn;
        private string fileRevision;

        public string BuildCheckout
            get { return buildCheckout; }
            set { buildCheckout = value; }

        public string BuildString
            get { return buildString; }
            set { buildString = value; }

        public override bool Execute()
            Log.LogMessage(MessageImportance.High, " ");
            Log.LogMessage(MessageImportance.High, " Checking File String: " + buildString);
            Log.LogMessage(MessageImportance.High, " ");


            return true;

        private void SplitString()
            string [] _splitString = Regex.Split(buildString, ":");

            fileSvn = _splitString[0];
            fileStatus = _splitString[1];
            fileRevision = _splitString[2];

            Log.LogMessage(MessageImportance.High, fileSvn);
            Log.LogMessage(MessageImportance.High, fileStatus);
            Log.LogMessage(MessageImportance.High, fileRevision);

        private bool TestSvn()
            string fileNameAuthor = "";
            string filePathSvn = "svn://bwgrvss/Broadway/" + fileSvn;
            int fileRevisionSvn = Int32.Parse(fileRevision);

            Log.LogMessage(MessageImportance.High, "These are values going into SVN Methods");
            Log.LogMessage(MessageImportance.High, filePathSvn);
            Log.LogMessage(MessageImportance.High, fileRevisionSvn.ToString());

            SvnClient _sc = new SvnClient();
            SvnRevision _sr = new SvnRevision(fileRevisionSvn);
            SvnUriTarget _su = new SvnUriTarget(filePathSvn, _sr);

            _sc.GetRevisionProperty(_su, "svn:author", out fileNameAuthor);

            Log.LogMessage(MessageImportance.High, "This is what came out of the SVN Methods");
            Log.LogMessage(MessageImportance.High, fileNameAuthor);

            return true;


Please sign in to leave a comment.