public void execute() throws Exception {
    String site1 = getSecureBaseUrl(sites.get(0));
    String site2 = getSecureBaseUrl(sites.get(1));
    if(site1.equalsIgnoreCase(site2)) {
      System.err.println("Cannot clone a site into itself.");
      System.exit(1);
    }
    
    try{
      System.out.println("Getting status of ["+site1+"]");
      Status site1Status = StatusCommand.getSiteStatus(site1, token);
      
      System.out.println("Getting status of ["+site2+"]");
      Status site2Status = StatusCommand.getSiteStatus(site2, token);
      if(site1Status != null && site2Status != null) {
        
        String repo = site1Status.getRepo();
        String revision = site1Status.getRevision();
        String branch = site1Status.getBranch();
        
        if(site2Status.getRepo().equals(repo) && site2Status.getBranch().equals(branch) && site2Status.getRevision().equals(revision)) {
          System.err.println("Source [" + site1 + "] is on the same content repo, branch, and revision as the target [" + site2 + "].");
          checkSendUpdateConfigMessage(site1, site2, site1Status, site2Status);
          System.exit(1);
        }
        
        System.out.println("Sending update message to ["+site2+"]");
        UpdateCommand.sendUpdateMessage(site2, repo, branch, revision, "Cloned from ["+site1+"]: " + comment, token);
        checkSendUpdateConfigMessage(site1, site2, site1Status, site2Status);
      } else {
        System.err.println("Failed to get status from source and/or target.");
        System.exit(1);
      }
    } catch(Exception e) {
      e.printStackTrace();
      System.err.println("Failed to clone ["+site1+"] to ["+site2+"]: "+e.getMessage());
    }
  }
public void execute ( ) throws Exception { String site1 = getSecureBaseUrl ( sites . get ( 0 ) ) ; String site2 = getSecureBaseUrl ( sites . get ( 1 ) ) ; if ( site1 . equalsIgnoreCase ( site2 ) ) { System . err . println ( "Cannot clone a site into itself." ) ; System . exit ( 1 ) ; } try { System . out . println ( "Getting status of [" + site1 + "]" ) ; Status site1Status = StatusCommand . getSiteStatus ( site1 , token ) ; System . out . println ( "Getting status of [" + site2 + "]" ) ; Status site2Status = StatusCommand . getSiteStatus ( site2 , token ) ; if ( site1Status != null && site2Status != null ) { String repo = site1Status . getRepo ( ) ; String revision = site1Status . getRevision ( ) ; String branch = site1Status . getBranch ( ) ; if ( site2Status . getRepo ( ) . equals ( repo ) && site2Status . getBranch ( ) . equals ( branch ) && site2Status . getRevision ( ) . equals ( revision ) ) { System . err . println ( "Source [" + site1 + "] is on the same content repo, branch, and revision as the target [" + site2 + "]." ) ; checkSendUpdateConfigMessage ( site1 , site2 , site1Status , site2Status ) ; System . exit ( 1 ) ; } System . out . println ( "Sending update message to [" + site2 + "]" ) ; UpdateCommand . sendUpdateMessage ( site2 , repo , branch , revision , "Cloned from [" + site1 + "]: " + comment , token ) ; checkSendUpdateConfigMessage ( site1 , site2 , site1Status , site2Status ) ; } else { System . err . println ( "Failed to get status from source and/or target." ) ; System . exit ( 1 ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; System . err . println ( "Failed to clone [" + site1 + "] to [" + site2 + "]: " + e . getMessage ( ) ) ; } }
Called to execute this command.