ClearCase Base snapshot update is executed two times

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major
    • Component/s: clearcase-plugin
    • None
    • Environment:
      Windows XP, Hudson 1.395, CC Plugin 1.3.5

      *DUPLICATE: http://issues.hudson-ci.org/browse/HUDSON-8674*

      Snapshot checkout action executes two updates, it tooks to long:

      1. setcs is executed with new config spec

      ...
      Added load rule : \vob2\source2\info.txt
      Added load rule : \vob2\source3
      [hudson.min.10] $ cleartool setcs D:\Views\configspec6792665585734196290.txt
      Loading "\vob2\source2\info.txt" (5497 bytes).
      Done loading "\vob2\source2\info.txt" (1 objects, copied 5 KB).
      ...

      2. setcs -current is executed with no effect, but it tooks time

      ...
      [hudson.min.10] $ cleartool setcs -current
      .
      Done loading "\vob2\source2\info.txt" (1 objects, copied 0 KB).
      Processing dir "\vob2\source3".
      ...

      The problem is inside file "..\src\main\java\hudson\plugins\clearcase\action\SnapshotCheckoutAction.java", method "checkout":

      SnapshotCheckoutAction.java
      if (needSetCs) {
          try {
              cleartool.setcs(viewPath, SetcsOption.CONFIGSPEC, configSpec.setLoadRules(loadRules).getRaw());
          } catch (IOException e) {
              launcher.getListener().fatalError(e.toString());
              return false;
          }
      } else {
          String[] addedLoadRules = loadRulesDelta.getAdded();
          if (!ArrayUtils.isEmpty(addedLoadRules)) {
              // Config spec haven't changed, but there are new load rules
              try {
                  cleartool.update(viewPath, addedLoadRules);
              } catch (IOException e) {
                  launcher.getListener().fatalError(e.toString());
                  return false;
              }
          }
      }
      // Perform a full update of the view. to reevaluate config spec
      if (!viewCreated) {
          try {
              cleartool.setcs(viewPath, SetcsOption.CURRENT, null);
          } catch (IOException e) {
              launcher.getListener().fatalError(e.toString());
              return false;
          }
      }
      

      The logic is strange. If "needSetCs" is true then it's waste to execute "setcs -current". If it's false then "update" with new load rules is executed and there is no need to execute "setcs -current"!

      One can use "setcs -current" instead of "update", because:

      • In a snapshot view, setcs initiates an update -noverwrite operation for the current view and generates an update logfile with the default name and location.
      • For one or more loaded elements, the update command does the following: Reevaluates the config spec to select versions of loaded elements in the VOB and loads them if they differ from the currently loaded versions.

            Assignee:
            Vincent Latombe
            Reporter:
            anb0s
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: