Package org.tmatesoft.svn.core

Examples of org.tmatesoft.svn.core.SVNLock


    static SVNInfo createInfo(File file, SVNEntry entry) throws SVNException {
        if (entry == null) {
            return null;
        }
        SVNLock lock = null;
        if (entry.getLockToken() != null) {
            lock = new SVNLock(null, entry.getLockToken(),
                    entry.getLockOwner(), entry.getLockComment(), SVNTimeUtil
                            .parseDate(entry.getLockCreationDate()), null);
        }
        return new SVNInfo(file, entry.getSVNURL(), entry.getRepositoryRootURL(),
                entry.getRevision(), entry.getKind(), entry.getUUID(), entry.getCommittedRevision(),
View Full Code Here


            if (path == null) {
                continue;
            }
            checkCancelled();
           
            SVNLock lock = null;
            try {
                lock = fsfs.getLockHelper(path, false);
                if (lock == null) {
                    if (myEventHandler != null) {
                        SVNAdminEvent event = new SVNAdminEvent(SVNAdminEventAction.NOT_LOCKED, lock, null, "Path '" + path + "' isn't locked.");
                        myEventHandler.handleAdminEvent(event, ISVNEventHandler.UNKNOWN);
                    }
                    continue;
                }
               
                fsfs.unlockPath(path, lock.getID(), null, true, false);
                if (myEventHandler != null) {
                    SVNAdminEvent event = new SVNAdminEvent(SVNAdminEventAction.UNLOCKED, lock, null, "Removed lock on '" + path + "'.");
                    myEventHandler.handleAdminEvent(event, ISVNEventHandler.UNKNOWN);
                }
            } catch (SVNException svne) {
View Full Code Here

            }
        }
        locks = locks == null ? new SVNLock[0] : locks;
        Map locksMap = new HashMap();
        for (int i = 0; i < locks.length; i++) {
            SVNLock lock = locks[i];
            locksMap.put(lock.getPath(), lock);
        }       
        // 2. add lock for this entry, only when it is 'related' to head (and is a file).
        if (rootEntry.getKind() == SVNNodeKind.FILE) {
            try {
                SVNRepositoryLocation[] locations = getLocations(url, null, null, revision, SVNRevision.HEAD, SVNRevision.UNDEFINED);
                if (locations != null && locations.length > 0) {
                    SVNURL headURL = locations[0].getURL();
                    if (headURL.equals(url)) {
                        // get lock for this item (@headURL).
                        try {
                            SVNLock lock = repos.getLock("");
                            if (lock != null) {
                                locksMap.put(lock.getPath(), lock);
                            }
                        } catch (SVNException e) {
                            if (!(e.getErrorMessage() != null && e.getErrorMessage().getErrorCode() == SVNErrorCode.RA_NOT_IMPLEMENTED)) {
                                throw e;
                            }
View Full Code Here

   
    private Map fetchLockTokens(SVNRepository repository, Map pathsTokensMap) throws SVNException {
        Map tokens = new HashMap();
        for (Iterator paths = pathsTokensMap.keySet().iterator(); paths.hasNext();) {
            String path = (String) paths.next();
            SVNLock lock = repository.getLock(path);
            if (lock == null || lock.getID() == null) {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_MISSING_LOCK_TOKEN, "''{0}'' is not locked", path);
                SVNErrorManager.error(err);
                continue;
            }
            tokens.put(path, lock.getID());
        }
        return tokens;
    }
View Full Code Here

            if (info.getPropConflictFile() != null) {
                print("Conflict Properties File: " + info.getPropConflictFile().getName(), myOut);
            }
        }
        if (info.getLock() != null) {
            SVNLock lock = info.getLock();
            print("Lock Token: " + lock.getID(), myOut);
            print("Lock Owner: " + lock.getOwner(), myOut);
            print("Lock Created: " + formatDate(lock.getCreationDate()), myOut);
            if (lock.getComment() != null) {
                myOut.print("Lock Comment ");
                int lineCount = getLinesCount(lock.getComment());
                if (lineCount == 1) {
                    myOut.print("(1 line)");
                } else {
                    myOut.print("(" + lineCount + " lines)");
                }
                myOut.print(":\n" + lock.getComment() + "\n");
            }
        }
        println(myOut);
    }
View Full Code Here

            }
            closeTag(CONFLICT_TAG);
        }
       
        if (info.getLock() != null) {
            SVNLock lock = info.getLock();
            openTag(LOCK_TAG);
            if (lock.getID() != null) {
                addTag(TOKEN_TAG, lock.getID());
            }
            if (lock.getOwner() != null) {
                addTag(OWNER_TAG, lock.getOwner());
            }
            if (lock.getComment() != null) {
                addTag(COMMENT_TAG, lock.getComment());
            }
            if (lock.getCreationDate() != null) {
                addTag(CREATED_TAG, SVNTimeUtil.formatDate(lock.getCreationDate()));
            }
            if (lock.getExpirationDate() != null) {
                addTag(EXPIRES_TAG, SVNTimeUtil.formatDate(lock.getExpirationDate()));
            }
            closeTag(LOCK_TAG);
        }
           
            
View Full Code Here

        } else if (event.getAction() == SVNEventAction.LOCKED) {
            String path = event.getPath();
            if (event.getFile() != null) {
                path = SVNFormatUtil.formatPath(event.getFile());
            }
            SVNLock lock = event.getLock();
            SVNCommand.println(myPrintStream, "'" + path + "' locked by user '" + lock.getOwner() + "'.");
        } else if (event.getAction() == SVNEventAction.UNLOCKED) {
            String path = event.getPath();
            if (event.getFile() != null) {
                path = SVNFormatUtil.formatPath(event.getFile());
            }
View Full Code Here

        run(out, err);
    }

    public void handleAdminEvent(SVNAdminEvent event, double progress) throws SVNException {
        if (event != null && event.getAction() == SVNAdminEventAction.LOCK_LISTED) {
            SVNLock lock = event.getLock();
            if (lock != null) {
                String creationDate = SVNTimeUtil.formatDate(lock.getCreationDate());
                String expirationDate = lock.getExpirationDate() != null ? SVNTimeUtil.formatDate(lock.getExpirationDate()) : ""
                
                int commentLines = 0;
                if (lock.getComment() != null) {
                    commentLines = getLinesCount(lock.getComment());
                }

                SVNCommand.println(myOut, "Path: " + lock.getPath());
                SVNCommand.println(myOut, "UUID Token: " + lock.getID());
                SVNCommand.println(myOut, "Owner: " + lock.getOwner());
                SVNCommand.println(myOut, "Created: " + creationDate);
                SVNCommand.println(myOut, "Expires: " + expirationDate);
                if (commentLines != 1) {
                    SVNCommand.println(myOut, "Comment (" + commentLines + " lines):");
                    SVNCommand.println(myOut, lock.getComment() != null ? lock.getComment() : "");
                } else {
                    SVNCommand.println(myOut, "Comment (" + commentLines + " line):");
                    SVNCommand.println(myOut, lock.getComment() != null ? lock.getComment() : "");
                }
                SVNCommand.println(myOut, "");
            }
        }
    }
View Full Code Here

        addAttribute(REVISION_ATTR, entry.getRevision() + "");
        openTag(COMMIT_TAG);
        addTag(AUTHOR_TAG, entry.getAuthor());
        addTag(DATE_TAG, SVNTimeUtil.formatDate(entry.getDate()));       
        closeTag(COMMIT_TAG);
        SVNLock lock = entry.getLock();
        if (lock != null) {
            openTag(LOCK_TAG);
            addTag(TOKEN_TAG, lock.getID());
            addTag(OWNER_TAG, lock.getOwner());
            addTag(COMMENT_TAG, lock.getComment());
            addTag(CREATED_TAG, SVNTimeUtil.formatDate(lock.getCreationDate()));
            if (lock.getExpirationDate() != null && lock.getExpirationDate().getTime() > 0) {
                addTag(EXPIRES_TAG, SVNTimeUtil.formatDate(lock.getExpirationDate()));
            }
            closeTag(LOCK_TAG);
        }
        closeTag(ENTRY_TAG);
    }
View Full Code Here

        }
        File reposRoot = new File(getCommandLine().getPathAt(0))
        String path = SVNPathUtil.canonicalizeAbsPath(getCommandLine().getPathAt(1));

        SVNLookClient lookClient = getClientManager().getLookClient();
        SVNLock lock = lookClient.doGetLock(reposRoot, path);
        if (lock != null) {
            String creationTime = SVNLookDateCommand.formatDate(lock.getCreationDate());
            String expirationTime = lock.getExpirationDate() != null ? SVNLookDateCommand.formatDate(lock.getExpirationDate()) : "";
            int commentLines = 0;
            if (lock.getComment() != null) {
                commentLines = getLinesCount(lock.getComment());
            }
            SVNCommand.println(out, "UUID Token: " + lock.getID());
            SVNCommand.println(out, "Owner: " + lock.getOwner());
            SVNCommand.println(out, "Created: " + creationTime);
            SVNCommand.println(out, "Expires: " + expirationTime);
            if (commentLines != 1) {
                SVNCommand.println(out, "Comment (" + commentLines + " lines):");
                SVNCommand.println(out, lock.getComment() != null ? lock.getComment() : "");
            } else {
                SVNCommand.println(out, "Comment (" + commentLines + " line):");
                SVNCommand.println(out, lock.getComment() != null ? lock.getComment() : "");
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.tmatesoft.svn.core.SVNLock

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.