Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-1816

Problem with "changes" report if build done based on CVS label

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • cvs-plugin
    • None
    • Platform: All, OS: All

      We use CVS for version control.
      "Changes" report doesn't appear to show any changes if builds were performed
      from a label rather than as a "tip/HEAD/Latest" revision build.

      I have a project that is set up in Maven as a CI build for the development team.
      The change report works fine here. For the very same project, I do "official"
      QA builds off a label and the changelog report doesn't show any changes.

        1. 1816.patch
          2 kB
        2. CVSSCM.java.patch
          0.5 kB
        3. hudson-core.zip
          37 kB
        4. issue1816.patch
          1 kB

          [JENKINS-1816] Problem with "changes" report if build done based on CVS label

          jferr created issue -

          jferr added a comment -

          Just did some research (I'm sure you already know these details, but for
          completeness); It appears that the ant task "ChangeLog" won't take tags as
          parameters, but the CVSTagDiff task will. But CVSTagDiff doesn't appear to
          include check-in comments in it's xml output.

          So, I suppose this is an enhancement if you were to add "CVSTagDiff" for builds
          that were based on tags.

          Minimally (if running CVSTagDIff doesn't work for some reason), Hudson shouldn't
          falsely display "no changes" if a build was based on a tag.

          jferr added a comment - Just did some research (I'm sure you already know these details, but for completeness); It appears that the ant task "ChangeLog" won't take tags as parameters, but the CVSTagDiff task will. But CVSTagDiff doesn't appear to include check-in comments in it's xml output. So, I suppose this is an enhancement if you were to add "CVSTagDiff" for builds that were based on tags. Minimally (if running CVSTagDIff doesn't work for some reason), Hudson shouldn't falsely display "no changes" if a build was based on a tag.

          jackgene added a comment -

          Hi,
          This affects us too, in fact in a bigger way, since we tag everything to be
          built. I was looking into this over the weekend, and I believe the problem was
          due to the version of the Ant CVS ChangeLogTask being used (it may have been a
          bug, or it may have been intended, but either way, it's been resolved in Ant
          1.7.1).

          I was able to get the 1.235 Hudson source, and update it to use the latest Ant
          task, which has partially resolved this issue. Here's everything I had to do
          (I'll be updating this source shortly):
          1. Replace everything under hudson.org.apache.tools.ant.taskdefs (and sub-
          packages) with the latest Ant source.
          2. Made some changes to the Ant task (I tried to minimize this to simplify
          future updates to the task):
          a. Re-introduced the one change Kohsuke did related to timezone issues
          (ChangeLogTask.java:235-252).
          b. Re-introduced the cvsExe property to the task (AbstractCvsTask.java:151,160-
          162,767) (Ant 1.7.1 no longer allows you to specify the CVS binary to use, and
          instead assumes that "cvs" will be in your path, Hudson still allows you to
          specify the "cvs" location, so I thought this would be a good idea to add it).
          c. Added " * @version Ant 1.7.1 (Copied into Hudson)" to JavaDoc so that we can
          keep track of which version of the Ant task is being used.
          3. Modified hudson.scm.CVSSCM to account for changes in the Ant task:
          a. Made "changeLogFile" parameter final in calcChangeLog so that it can be
          accesssed from an inner class (CVSSCM:701).
          b. Modified to pass the changeLogFile location to the Ant task using setDestfile
          (File) instead of setDeststream(OutputStream) (CVSSCM:760, CVSSCM:796).
          c. Modified to pass branch to Ant task using setTag(String) instead of setBranch
          (String) (CVSSCM:761)
          d. Modified the way we pass changedFiles to the Ant task (CVSSCM:773-783)
          e. Modified the way modules/packages are passed to the Ant task (CVSSCM:789)
          (I'll be revisiting this).

          Everything up to now has simply been to get Hudson to work with the new Ant
          task. This caused some information to appear in the change log, when builds are
          triggered based on tags. However, because there are no historical information
          associated with tags, the change log only shows the revision of the file that
          was tagged (even when there may be multiple revisions to the file since the
          last build). To resolve this, I've modified the "task.setTag(String)" line as
          follows:

          task.setTag(isTag() ? ":" + branch : branch);
          (Passing ":rev" to CVS tells it to generate change log for the revision
          tagged "rev" and before, on the same branch, per CVSNT's "cvs log --help").

          There are still a few outstanding issues:
          1. Since tags are not versioned, it is possible for a file to be committed
          before the previous build, but tagged after the build. This will cause a new
          build to be triggered. However, the change log will not include information
          about this file, since as far as CVS is concerned, the change occurred before
          the last build.
          2. Tags can be moved backwards to an older revision, or across branches, which
          will probably cause some problems.

          I'll continue to work on these issues.

          jackgene added a comment - Hi, This affects us too, in fact in a bigger way, since we tag everything to be built. I was looking into this over the weekend, and I believe the problem was due to the version of the Ant CVS ChangeLogTask being used (it may have been a bug, or it may have been intended, but either way, it's been resolved in Ant 1.7.1). I was able to get the 1.235 Hudson source, and update it to use the latest Ant task, which has partially resolved this issue. Here's everything I had to do (I'll be updating this source shortly): 1. Replace everything under hudson.org.apache.tools.ant.taskdefs (and sub- packages) with the latest Ant source. 2. Made some changes to the Ant task (I tried to minimize this to simplify future updates to the task): a. Re-introduced the one change Kohsuke did related to timezone issues (ChangeLogTask.java:235-252). b. Re-introduced the cvsExe property to the task (AbstractCvsTask.java:151,160- 162,767) (Ant 1.7.1 no longer allows you to specify the CVS binary to use, and instead assumes that "cvs" will be in your path, Hudson still allows you to specify the "cvs" location, so I thought this would be a good idea to add it). c. Added " * @version Ant 1.7.1 (Copied into Hudson)" to JavaDoc so that we can keep track of which version of the Ant task is being used. 3. Modified hudson.scm.CVSSCM to account for changes in the Ant task: a. Made "changeLogFile" parameter final in calcChangeLog so that it can be accesssed from an inner class (CVSSCM:701). b. Modified to pass the changeLogFile location to the Ant task using setDestfile (File) instead of setDeststream(OutputStream) (CVSSCM:760, CVSSCM:796). c. Modified to pass branch to Ant task using setTag(String) instead of setBranch (String) (CVSSCM:761) d. Modified the way we pass changedFiles to the Ant task (CVSSCM:773-783) e. Modified the way modules/packages are passed to the Ant task (CVSSCM:789) (I'll be revisiting this). Everything up to now has simply been to get Hudson to work with the new Ant task. This caused some information to appear in the change log, when builds are triggered based on tags. However, because there are no historical information associated with tags, the change log only shows the revision of the file that was tagged (even when there may be multiple revisions to the file since the last build). To resolve this, I've modified the "task.setTag(String)" line as follows: task.setTag(isTag() ? ":" + branch : branch); (Passing ":rev" to CVS tells it to generate change log for the revision tagged "rev" and before, on the same branch, per CVSNT's "cvs log --help"). There are still a few outstanding issues: 1. Since tags are not versioned, it is possible for a file to be committed before the previous build, but tagged after the build. This will cause a new build to be triggered. However, the change log will not include information about this file, since as far as CVS is concerned, the change occurred before the last build. 2. Tags can be moved backwards to an older revision, or across branches, which will probably cause some problems. I'll continue to work on these issues.
          jackgene made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

          jackgene added a comment -

          Created an attachment (id=329)
          Files mentioned in my last comment in this issue.

          jackgene added a comment - Created an attachment (id=329) Files mentioned in my last comment in this issue.

          ybubnov added a comment -

          Created an attachment (id=839)
          small patch to fix just the problem

          ybubnov added a comment - Created an attachment (id=839) small patch to fix just the problem

          ybubnov added a comment -

          I think jackgene's patch is somewhat overreacted for the problem in hand. We
          need just to specify branch or tag during 'cvs log' command.

          ybubnov added a comment - I think jackgene's patch is somewhat overreacted for the problem in hand. We need just to specify branch or tag during 'cvs log' command.

          Code changed in hudson
          User: : kohsuke
          Path:
          trunk/hudson/main/core/src/main/java/hudson/scm/CVSSCM.java
          trunk/www/changelog.html
          http://fisheye4.cenqua.com/changelog/hudson/?cs=20679
          Log:
          [FIXED JENKINS-1816] In 1.321. Applied a patch from Yury Bubnov.

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : kohsuke Path: trunk/hudson/main/core/src/main/java/hudson/scm/CVSSCM.java trunk/www/changelog.html http://fisheye4.cenqua.com/changelog/hudson/?cs=20679 Log: [FIXED JENKINS-1816] In 1.321. Applied a patch from Yury Bubnov.
          SCM/JIRA link daemon made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Resolved [ 5 ]

          liyatikal added a comment -

          still doesn't work with the latest 1.323 for the cvs branch (not tag)

          liyatikal added a comment - still doesn't work with the latest 1.323 for the cvs branch (not tag)
          liyatikal made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]

            Unassigned Unassigned
            jferr jferr
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: