Package hudson.plugins.scm_sync_configuration.exceptions

Examples of hudson.plugins.scm_sync_configuration.exceptions.LoggableException


        // Once done, we should delete path in scm if it is a directory
        if(hierarchyPath.isDirectory()){
            try {
                FileUtils.deleteDirectory(rootHierarchyTranslatedInScm);
            } catch (IOException e) {
                throw new LoggableException("Failed to recursively delete scm directory "+rootHierarchyTranslatedInScm.getAbsolutePath(), FileUtils.class, "deleteDirectory", e);
            }
        }


        signal("Delete " + hierarchyPath, filesToCommit != null);
View Full Code Here


                            try {
                                FileUtils.copyDirectory(JenkinsFilesHelper.buildFileFromPathRelativeToHudsonRoot(pathRelativeToJenkinsRoot.getPath()),
                                        fileTranslatedInScm);
                            } catch (IOException e) {
                                throw new LoggableException("Error while copying file hierarchy to SCM checkouted directory", FileUtils.class, "copyDirectory", e);
                            }
                            updatedFiles.addAll(scmManipulator.addFile(scmRoot, firstNonExistingParentScmPath));
                        }
                    } else {
                        // We should remember if file in scm existed or not before any manipulation,
                        // especially writing content
                        boolean fileTranslatedInScmInitiallyExists = fileTranslatedInScm.exists();

                        boolean fileContentModified = writeScmContentOnlyIfItDiffers(pathRelativeToJenkinsRoot, content, fileTranslatedInScm);
                        if(fileTranslatedInScmInitiallyExists){
                            if(fileContentModified){
                                // No need to call scmManipulator.addFile() if fileTranslatedInScm already existed
                                updatedFiles.add(fileTranslatedInScm);
                            }
                        } else {
                            updatedFiles.addAll(scmManipulator.addFile(scmRoot, pathRelativeToJenkinsRoot.getPath()));
                        }
                    }
                }
                for(Path path : commit.getChangeset().getPathsToDelete()){
                    List<File> deletedFiles = deleteHierarchy(commit.getScmContext(), path);
                    updatedFiles.addAll(deletedFiles);
                }

                if(updatedFiles.isEmpty()){
                    LOGGER.finest("Empty changeset to commit (no changes found on files) => commit skipped !");
                    checkedInCommits.add(commit);
                } else {
                    // Commiting files...
                    boolean result = scmManipulator.checkinFiles(scmRoot, commit.getMessage());

                    if(result){
                        LOGGER.finest("Commit "+commit.toString()+" pushed to SCM !");
                        checkedInCommits.add(commit);
                    } else {
                        throw new LoggableException("Error while checking in file to scm repository", SCMManipulator.class, "checkinFiles");
                    }

                    signal(logMessage, true);
                }
            }
View Full Code Here

        boolean scmContentUpdated = false;
        boolean contentDiffer = false;
        try {
            contentDiffer = !Checksums.fileAndByteArrayContentAreEqual(fileTranslatedInScm, content);
        } catch (IOException e) {
            throw new LoggableException("Error while checking content checksum", Checksums.class, "fileAndByteArrayContentAreEqual", e);
        }

        if(contentDiffer){
            createScmContent(pathRelativeToJenkinsRoot, content, fileTranslatedInScm);
            scmContentUpdated = true;
View Full Code Here

            directory = directory.getParentFile();
        }
        while(!directoriesToCreate.empty()){
            directory = directoriesToCreate.pop();
            if(!directory.mkdir()){
                throw new LoggableException("Error while creating directory "+directory.getAbsolutePath(), File.class, "mkdir");
            }
        }

        try {
            // Copying content if pathRelativeToJenkinsRoot is a file, or creating the directory if it is a directory
            if(pathRelativeToJenkinsRoot.isDirectory()){
                if(!fileTranslatedInScm.mkdir()){
                    throw new LoggableException("Error while creating directory "+fileTranslatedInScm.getAbsolutePath(), File.class, "mkdir");
                }
            } else {
                Files.write(content, fileTranslatedInScm);
            }
        } catch (IOException e) {
            throw new LoggableException("Error while creating file in checkouted directory", Files.class, "write", e);
        }
    }
View Full Code Here

            // look at checksums
            if(pathContents.containsKey(pathToRegister)){
                try {
                    contentAlreadyRegistered = Checksums.fileAndByteArrayContentAreEqual(pathToRegister.getHudsonFile(), pathContents.get(pathToRegister));
                } catch (IOException e) {
                    throw new LoggableException("Changeset path <"+path+"> registration failed", Checksums.class, "fileAndByteArrayContentAreEqual", e);
                }
            }

            if(!contentAlreadyRegistered){
                try {
                    pathContents.put(pathToRegister, Files.toByteArray(pathToRegister.getHudsonFile()));
                } catch (IOException e) {
                    throw new LoggableException("Changeset path <"+path+"> registration failed", Files.class, "toByteArray", e);
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of hudson.plugins.scm_sync_configuration.exceptions.LoggableException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.