Package org.evolizer.versioncontrol.cvs.model.entities

Examples of org.evolizer.versioncontrol.cvs.model.entities.Branch


                        return false;
                    }
                }

                if (isResume) {
                    Branch b = null;
                    for (String branchName : fModelMapper.getBranches().keySet()) {
                        if (firstLogEntryPath.getPath().contains(branchName)) {
                            b = fModelMapper.getBranches().get(branchName);
                            break;
                        }
                    }
                    if (b != null) {
                        return b.getCreationDate().compareTo(logEntry.getDate()) == 0;
                    } else {
                        return true;
                    }
                } else if (!isContainedInBranch(firstLogEntryPath.getPath())) { // I check that It's not just an add to
                    // an existing branch
View Full Code Here


                    return false;
                }
            }

            if (isResume) {
                Branch b = null;
                for (String branchName : fModelMapper.getBranches().keySet()) {
                    if (firstLogEntryPath.getPath().contains(branchName)) {
                        b = fModelMapper.getBranches().get(branchName);
                        break;
                    }
                }
                if (b != null) {
                    return b.getCreationDate().compareTo(logEntry.getDate()) == 0;
                } else {
                    return true;
                }
            } else if (!isContainedInBranch(firstLogEntryPath.getPath())) { // So I check that I'm not adding to an
                // already existing branch.
View Full Code Here

            String fromPath,
            long copyRevisionNum,
            long revisionNum) {

        // Create the Branch
        Branch branch = new Branch(tag);
        LOGGER.debug(NLS.bind(MapperMessages.SVNModelMapper_createdBranch, branch.getName()));
        branch.setCreationDate(creationTime);
        fBranches.put(tag, branch);
        fCurrBranches.add(branch);
        // Connect it to its related SVNRevisions
        connectRevisionToBranchOrRelease(
                creationTime,
                changeSet,
                message,
                author,
                branch,
                null,
                toPath,
                fromPath,
                copyRevisionNum,
                revisionNum);
        if (parentTag != null) {
            // If it's a sub branch, I link it to its parent and vice versa
            Branch parentBranch = fBranches.get(parentTag);
            parentBranch.addChild(branch);
            branch.setParent(parentBranch);
            LOGGER.debug(NLS.bind(MapperMessages.SVNModelMapper_isSubBranch, tag, parentBranch.getName()));
        }
        return branch;
    }
View Full Code Here

     *            The name of the branch.
     * @return the created branch
     */
    private Branch createSpecialBranch(Date creationTime, String tag) {
        // Create the Branch
        Branch branch = new Branch(tag);
        branch.setCreationDate(creationTime);
        fBranches.put(tag, branch);
        return branch;
    }
View Full Code Here

     */
    public void deleteBranch(long revNum, String author, String branchName) {
        fRevisionElemsCache.clear();
        fCurrBranches = new ArrayList<Branch>();

        Branch branch = fBranches.get(branchName);
        if (branch != null) {
            fPersistenceProvider.startTransaction();
            fPersistenceProvider.saveObject(branch);
            cleanUpCommitter(revNum, author);

            if (branch.getParent() != null) {
                Set<Branch> children = branch.getParent().getChildren();
                children.remove(branch);
                branch.getParent().setChildren(children);
                if (branch.getParent().getId() != null) {
                    fPersistenceProvider.update(branch.getParent());
                }
            }
            ((SVNRevision) branch.getRevisions().iterator().next()).getChangeSet().setInvolvedRevisions(null);

            for (Revision rev : branch.getRevisions()) {
                if (((SVNRevision) rev).getAncestor() != null) {
                    ((SVNVersionedFile) ((SVNRevision) rev).getAncestor().getFile()).setCopiedTo(null);
                }
                ((SVNRevision) rev).setAncestor(null);
                List<Revision> rvs = ((SVNVersionedFile) rev.getFile()).getRevisions();
                rvs.clear();
                ((SVNVersionedFile) rev.getFile()).setRevisions(rvs);
                if (((SVNVersionedFile) rev.getFile()).getCopiedFrom() != null) {
                    ((SVNVersionedFile) rev.getFile()).getCopiedFrom().setCopiedTo(null);
                    fPersistenceProvider.update(((SVNVersionedFile) rev.getFile()).getCopiedFrom());
                }
                if (rev.getFile().getId() != null) {
                    fPersistenceProvider.update(rev.getFile());
                }
                fFiles.remove(rev.getFile().getPath());
                rev.setReport(null);
            }
            fPersistenceProvider.delete(branch);
            fBranches.remove(branchName);
            fPersistenceProvider.endTransaction();
            fPersistenceProvider.flush();
            LOGGER.debug(NLS.bind(MapperMessages.SVNModelMapper_deletedBranch, branch.getName()));
        }
    }
View Full Code Here

        fRevisionElemsCache.clear();
        cleanUpCommitter(revNum, author);
        List<SVNRevision> revisions =
                fPersistenceProvider.query("from SVNRevision as fv where fv.number = " + revNum, SVNRevision.class);

        Branch branch = null;
        if (branchPath != null) {
            Set<String> keys = fBranches.keySet();
            for (String k : keys) {
                if (branchPath.contains(k)) {
                    branch = fBranches.get(k);
                }
            }
        }
        fPersistenceProvider.startTransaction();
        for (SVNRevision fv : revisions) {

            if (fv.getPreviousRevision() != null) {
                fv.getPreviousRevision().setNextRevision(null);
                fPersistenceProvider.update(fv.getPreviousRevision());
            }
            SVNVersionedFile f = (SVNVersionedFile) fv.getFile();
            if (f.getCopiedFrom() != null) {
                ((SVNVersionedFile) f.getCopiedFrom()).setCopiedTo(null);
                fPersistenceProvider.update((SVNVersionedFile) f.getCopiedFrom());
            }
            Revision rev = f.getLatestRevision();
            if (Long.parseLong(rev.getNumber()) == revNum) {
                List<Revision> revs = f.getRevisions();
                revs.remove(f.getLatestRevision());
                f.setRevisions(revs);
                fPersistenceProvider.update(f);
            }
            if (branch != null) {
                Set<Revision> rs = branch.getRevisions();
                rs.remove(fv);
                branch.setRevisions(rs);
            }
            if (fv.getPreviousRevision() != null) {
                fv.getPreviousRevision().setNextRevision(null);
            }
            fv.setReport(null);
View Full Code Here

            }
        }
        // If branchName is not null, it means that the SVNRevision I'm creating is being committed to a branch, which
        // thus I'll attach this to it right away.
        if (branchName != null) {
            Branch branch = fBranches.get(branchName);

            if (branch == null) {
                /*
                 * If no branch exists, it is probably due to the fact that the whole
                 * project was moved into its current repository somewhere in time.
                 * E.g. The apache incubation policy.
                 * So i create the branch the first time I encounter it.
                 */
                branch = createSpecialBranch(report.getCreationTime(), branchName);
                LOGGER.warn(NLS.bind(MapperMessages.SVNModelMapper_revisionDoesNotBelong, branchName));
            } else {
                // A branch, as a release, has only the latest revision directly attached to it,
                // I need to replace the old one with the new one I found now (if it exists).
                if (newRevision.getPreviousRevision() != null) {
                    branch.getRevisions().remove(newRevision.getPreviousRevision());
                }
                LOGGER.debug(NLS.bind(MapperMessages.SVNModelMapper_createdBranchRevision, new String[]{
                        newRevision.getFile().getPath(),
                        newRevision.getNumber(),
                        branch.getName()}));
            }
            // Attaching the newRevision to the branch, so matter what kind of a branch i'm dealing with
            branch.addRevision(newRevision);
            fCurrBranches.add(branch);
        }
        if (!deleted && contents != null && !contents.equals("")) {
            newRevision.setSource(contents);
        }
View Full Code Here

    public void convertReleaseToBranch(String releaseName) {
        SVNRelease release =
                fPersistenceProvider.uniqueResult(
                        "from SVNRelease as r where r.name = '" + releaseName + "'",
                        SVNRelease.class);
        Branch branch = new Branch(releaseName);

        // Remove the release reference from all the existing revisions
        for (Revision version : release.getRevisions()) {
            version.getReleases().remove(release);
        }
        for (Revision version : release.getReleaseRevisions()) {
            version.getReleases().remove(release);
            branch.addRevision(version);
        }
        branch.setCreationDate(release.getTimeStamp());
        fBranches.put(releaseName, branch);
        release.setReleaseRevisions(null);
        release.setRevisions(null);
        fPersistenceProvider.delete(release);
        fPersistenceProvider.flush();
View Full Code Here

TOP

Related Classes of org.evolizer.versioncontrol.cvs.model.entities.Branch

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.