Refine search
public void handleStatus(SVNStatus status) { if (absPath.equals(status.getFile())) { if (result[0] != null && result[0].getContentsStatus() == SVNStatusType.STATUS_EXTERNAL && absPath.isDirectory()) { result[0] = status; result[0].markExternal(); } else if (result[0] == null) { result[0] = status; } } } };
private String update(SvnOperationFactory svnOperationFactory, String label) throws SVNException { logger.debug("Repo already checked out - updating instead."); try { final SvnUpdate update = svnOperationFactory.createUpdate(); update.setSingleTarget(SvnTarget.fromFile(getWorkingDirectory())); long[] ids = update.run(); StringBuilder version = new StringBuilder(); for (long id : ids) { if (version.length() > 0) { version.append(","); } version.append(id); } return version.toString(); } catch (Exception e) { String message = "Could not update remote for " + label + " (current local=" + getWorkingDirectory().getPath() + "), remote: " + this.getUri() + ")"; if (logger.isDebugEnabled()) { logger.debug(message, e); } else if (logger.isWarnEnabled()) { logger.warn(message); } } final SVNStatus status = SVNClientManager.newInstance().getStatusClient() .doStatus(getWorkingDirectory(), false); return status != null ? status.getRevision().toString() : null; }
public static String getLastModifiedBy(File localPath) throws SVNException { final SVNStatus status = SVNClientManager.newInstance().getStatusClient().doStatus(localPath, false); return status != null ? status.getAuthor() : null; }
public SVNStatusType getCombinedNodeAndContentsStatus() { int workingCopyFormat = getWorkingCopyFormat(); SVNStatusType nodeStatus = getNodeStatus(); SVNStatusType contentsStatus = getContentsStatus(); boolean versioned = isVersioned(); boolean conflicted = isConflicted(); return combineNodeAndContentsStatus(workingCopyFormat, nodeStatus, contentsStatus, versioned, conflicted); }
public SVNStatusType getCombinedRemoteNodeAndContentsStatus() { int workingCopyFormat = getWorkingCopyFormat(); SVNStatusType remoteNodeStatus = getRemoteNodeStatus(); SVNStatusType remoteContentsStatus = getRemoteContentsStatus(); return combineRemoteNodeAndContentsStatus(workingCopyFormat, remoteNodeStatus, remoteContentsStatus); }
private void countConflicts(SVNStatus status) throws SVNException { if (status.isConflicted()) { if (status.getPropRejectFile() != null) { propConflicts++; } if (status.getConflictWrkFile() != null || status.getConflictOldFile() != null || status.getConflictNewFile() != null) { textConflicts++; } if (status.getTreeConflict() != null) { treeConflicts++; } } }
String url = status.getURL() != null ? status.getURL().toString() : null; if (url == null && status.getEntryProperties() != null) { url = (String) status.getEntryProperties().get(SVNProperty.URL); if (url == null && status.getRemoteURL() != null) { url = status.getRemoteURL().toString(); int nodeKind = getNodeKind(status.getKind()); if (status.getContentsStatus() == SVNStatusType.STATUS_IGNORED) { nodeKind = NodeKind.unknown; long revision = status.getRevision().getNumber(); long lastChangedRevision = -1; if(status.getCommittedRevision() != null){ lastChangedRevision = status.getCommittedRevision().getNumber(); Date d = status.getCommittedDate(); long lastChangedDate = -1; if(d != null){ lastChangedDate = d.getTime() * 1000; String lastCommitAuthor = status.getAuthor(); int textStatus = getStatusValue(status.getContentsStatus()); int propStatus = getStatusValue(status.getPropertiesStatus()); int repositoryTextStatus = getStatusValue(status.getRemoteContentsStatus()); int repositoryPropStatus = getStatusValue(status.getRemotePropertiesStatus()); boolean locked = status.isLocked(); boolean copied = status.isCopied(); boolean switched = status.isSwitched();
private void sendToHandler(SVNStatus status) throws SAXException { addAttribute(PATH_ATTR, getRelativePath(status.getFile())); openTag(ENTRY_TAG); addAttribute(PROPS_ATTR, status.getPropertiesStatus().toString()); addAttribute(ITEM_ATTR, status.getContentsStatus().toString()); if (status.isLocked()) { addAttribute(WC_LOCKED_ATTR, TRUE); if (status.isCopied()) { addAttribute(COPIED_ATTR, TRUE); if (status.isSwitched()) { addAttribute(SWITCHED_ATTR, TRUE); if (!status.isCopied() && status.getRevision() != null && status.getRevision().getNumber() >= 0) { addAttribute(REVISION_ATTR, status.getRevision().toString()); if (status.getCommittedRevision() != null && status.getCommittedRevision().getNumber() >= 0) { addAttribute(REVISION_ATTR, status.getCommittedRevision().toString()); openTag(COMMIT_TAG); addTag(AUTHOR_TAG, status.getAuthor()); if (status.getCommittedDate() != null) { addTag(DATE_TAG, SVNTimeUtil.formatDate(status.getCommittedDate())); if (status.getLocalLock() != null) { openTag(LOCK_TAG); addTag(TOKEN_TAG, status.getLocalLock().getID()); addTag(OWNER_TAG, status.getLocalLock().getOwner()); addTag(COMMENT_TAG, status.getLocalLock().getComment()); addTag(CREATED_TAG, SVNTimeUtil.formatDate(status.getLocalLock().getCreationDate()));
result.setPath(status.getFile()); result.setChangedAuthor(status.getAuthor()); result.setChangedDate(SVNDate.fromDate(status.getCommittedDate())); result.setChangedRevision(revisionNumber(status.getCommittedRevision())); result.setChangelist(status.getChangelistName()); result.setConflicted(status.isConflicted()); result.setCopied(status.isCopied()); result.setDepth(status.getDepth()); result.setFileExternal(status.isFileExternal()); result.setKind(status.getKind()); result.setLock(status.getLocalLock()); result.setNodeStatus(status.getNodeStatus()); result.setTextStatus(status.getContentsStatus()); result.setPropertiesStatus(status.getPropertiesStatus()); result.setRepositoryChangedAuthor(status.getRemoteAuthor()); result.setRepositoryChangedDate(SVNDate.fromDate(status.getRemoteDate())); result.setRepositoryChangedRevision(revisionNumber(status.getRemoteRevision())); result.setRepositoryKind(status.getRemoteKind()); result.setRepositoryLock(status.getRemoteLock()); result.setRepositoryNodeStatus(status.getRemoteNodeStatus()); result.setRepositoryTextStatus(status.getRemoteContentsStatus()); result.setRepositoryPropertiesStatus(status.getRemotePropertiesStatus()); result.setRepositoryRelativePath(status.getRepositoryRelativePath()); result.setRepositoryRootUrl(status.getRepositoryRootURL());
public void printStatus(String path, SVNStatus status, boolean detailed, boolean showLastCommitted, boolean skipUnrecognized, boolean showReposLocks) throws SVNException { if (status == null || (skipUnrecognized && !(status.isVersioned() || status.getTreeConflict() != null || status.getNodeStatus() == SVNStatusType.STATUS_EXTERNAL)) || (combineStatus(status) == SVNStatusType.STATUS_NONE && status.getRemoteContentsStatus() == SVNStatusType.STATUS_NONE)) { return; if (status.getTreeConflict() != null) { String description = SVNTreeConflictUtil.getHumanReadableConflictDescription(status.getTreeConflict()); treeStatusCode = 'C'; treeDescriptionLine = "\n > " + description; if (status.getMovedFromPath() != null && status.getMovedToPath() != null && status.getMovedFromPath().equals(status.getMovedToPath())) { movedFromLine = String.format("\n > swapped places with %s", getRelativePath(status.getMovedFromPath())); } else if (status.getMovedFromPath() != null || status.getMovedToPath() != null) { if (status.getMovedFromPath() != null) { movedFromLine = String.format("\n > moved from %s", getRelativePath(status.getMovedFromPath())); if (status.getMovedToPath() != null) { movedToLine = String.format("\n > moved to %s", getRelativePath(status.getMovedToPath())); String wcRevision; char remoteStatus; if (!status.isVersioned()) { wcRevision = ""; } else if (status.isCopied()) { wcRevision = "-"; } else if (!status.getRevision().isValid()) { if(status.getWorkingCopyFormat() >= ISVNWCDb.WC_FORMAT_17) {
protected StringBuffer printXMLStatus(SVNStatus status, String path) { StringBuffer xmlBuffer = openXMLTag("entry", SVNXMLUtil.XML_STYLE_NORMAL, "path", path, null); Map xmlMap = new LinkedHashMap(); xmlMap.put("props", status.getNodeStatus() != SVNStatusType.STATUS_DELETED ? status.getPropertiesStatus().toString() : SVNStatusType.STATUS_NONE.toString()); xmlMap.put("item", status.getCombinedNodeAndContentsStatus().toString()); if (status.isLocked()) { xmlMap.put("wc-locked", "true"); if (status.isCopied()) { xmlMap.put("copied", "true"); if (status.isSwitched()) { xmlMap.put("switched", "true"); if (status.isFileExternal()) { xmlMap.put("file-external", "true"); if (status.isVersioned() && !status.isCopied()) { xmlMap.put("revision", status.getRevision().toString()); if (status.getTreeConflict() != null) { xmlMap.put("tree-conflicted", "true"); if (status.isVersioned() && status.getCommittedRevision().isValid()) { xmlBuffer = openXMLTag("commit", SVNXMLUtil.XML_STYLE_NORMAL, "revision", status.getCommittedRevision().toString(), xmlBuffer); xmlBuffer = openCDataTag("author", status.getAuthor(), xmlBuffer); if (status.getCommittedDate() != null) { xmlBuffer = openCDataTag("date", SVNDate.formatDate(status.getCommittedDate()), xmlBuffer);
public void handleStatus(SVNStatus status) { if (status.getEntryProperties() == null || status.getEntryProperties().isEmpty()) { return; } if (status.getContentsStatus() != SVNStatusType.STATUS_ADDED) { SVNRevision revision = committed ? status.getCommittedRevision() : status.getRevision(); if (revision != null) { if (minRevision[0] < 0 || minRevision[0] > revision.getNumber()) { minRevision[0] = revision.getNumber(); } maxRevision[0] = Math.max(maxRevision[0], revision.getNumber()); } } switched[0] |= status.isSwitched(); switched[1] |= status.getContentsStatus() != SVNStatusType.STATUS_NORMAL; switched[1] |= status.getPropertiesStatus() != SVNStatusType.STATUS_NORMAL && status.getPropertiesStatus() != SVNStatusType.STATUS_NONE; switched[2] |= status.getEntry() != null && status.getEntry().getDepth() != SVNDepth.INFINITY; if (wcURL[0] == null && status.getFile() != null && status.getFile().equals(path) && status.getURL() != null) { wcURL[0] = status.getURL().toString(); } } }, null);
if (status.getRemoteContentsStatus() != SVNStatusType.STATUS_NONE) { return true; if (status.getRemotePropertiesStatus() != SVNStatusType.STATUS_NONE) { return true; if (status.getRemoteLock() != null) { return true; if (status.getContentsStatus() == SVNStatusType.STATUS_IGNORED && !isNoIgnore()) { return false; if (status.getContentsStatus() == SVNStatusType.STATUS_UNVERSIONED) { return true; if (status.getContentsStatus() != SVNStatusType.STATUS_NONE && status.getContentsStatus() != SVNStatusType.STATUS_NORMAL) { return true; if (status.getPropertiesStatus() != SVNStatusType.STATUS_NONE && status.getPropertiesStatus() != SVNStatusType.STATUS_NORMAL) { return true; if (status.getTreeConflict() != null) { return true; return status.isLocked() || status.isSwitched() || status.getLocalLock() != null || status.getChangelistName() != null || status.isFileExternal();
public void handleStatus(SVNStatus status) throws SVNException { SVNEntry entry = status.getEntry(); if (entry == null) { return; } if (status.getContentsStatus() != SVNStatusType.STATUS_ADDED) { long itemRev = committed ? entry.getCommittedRevision() : entry.getRevision(); if (!SVNRevision.isValidRevisionNumber(minRev[0]) || itemRev < minRev[0]) { minRev[0] = itemRev; } if (!SVNRevision.isValidRevisionNumber(maxRev[0]) || itemRev > maxRev[0]) { maxRev[0] = itemRev; } } isSwitched[0] |= status.isSwitched(); isModified[0] |= status.getContentsStatus() != SVNStatusType.STATUS_NORMAL; isModified[0] |= status.getPropertiesStatus() != SVNStatusType.STATUS_NORMAL && status.getPropertiesStatus() != SVNStatusType.STATUS_NONE; isSparseCheckOut[0] |= entry.getDepth() != SVNDepth.INFINITY; if (wcPath != null && wcURL[0] == null && wcPath.equals(status.getFile())) { wcURL[0] = entry.getSVNURL(); } } });
public void handleStatus(SVNStatus status) throws SVNException { if (status.getContentsStatus() == SVNStatusType.STATUS_OBSTRUCTED) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.NODE_UNEXPECTED_KIND, "''{0}'' is in the way of the resource actually under version control", status.getFile()); SVNErrorManager.error(err, SVNLogType.WC); } else if (status.getEntry() == null) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNVERSIONED_RESOURCE, "''{0}'' is not under version control", status.getFile()); SVNErrorManager.error(err, SVNLogType.WC); } else if ((status.getContentsStatus() != SVNStatusType.STATUS_NORMAL && status.getContentsStatus() != SVNStatusType.STATUS_DELETED && status.getContentsStatus() != SVNStatusType.STATUS_MISSING) || (status.getPropertiesStatus() != SVNStatusType.STATUS_NONE && status.getPropertiesStatus() != SVNStatusType.STATUS_NORMAL)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_MODIFIED, "''{0}'' has local modifications", status.getFile()); SVNErrorManager.error(err, SVNLogType.WC); } } }, null);
return false; if (status.getRemoteContentsStatus() != SVNStatusType.STATUS_NONE) { return true; if (status.getRemotePropertiesStatus() != SVNStatusType.STATUS_NONE) { return true; if (status.getRemoteLock() != null) { return true; if (status.getContentsStatus() == SVNStatusType.STATUS_IGNORED && !isNoIgnore()) { return false; return true; if (status.getContentsStatus() == SVNStatusType.STATUS_UNVERSIONED) { return true; if (status.getContentsStatus() != SVNStatusType.STATUS_NONE && status.getContentsStatus() != SVNStatusType.STATUS_NORMAL) { return true; if (status.getPropertiesStatus() != SVNStatusType.STATUS_NONE && status.getPropertiesStatus() != SVNStatusType.STATUS_NORMAL) { return true; return status.isLocked() || status.isSwitched() || status.getLocalLock() != null;
/** * Returns the last modified local time of the file item. * Irrelevant for directories (for directories returns <code>Date(0)</code>). * * @return last modified time of the file */ public Date getWorkingContentsDate() { if (myLocalContentsDate == null) { if (getFile() != null && getKind() == SVNNodeKind.FILE) { myLocalContentsDate = new Date(getFile().lastModified()); } else { myLocalContentsDate = new Date(0); } } return myLocalContentsDate; }
final SVNStatusClient statusClient = userClientManager.getStatusClient(); final SVNStatus status = statusClient.doStatus(userDir, false); final SVNStatusType contentStatus = status.getContentsStatus(); logger.info("(svn) status for " + userDir + " is " + contentStatus); if (contentStatus == SVNStatusType.STATUS_NORMAL) { long elapsed = -System.currentTimeMillis(); if (logger.isDebugEnabled()) { logger.debug("(svn) current r" + status.getRevision().getNumber() + " svn update " + svnUrl + " into " + userDir);
public static List<File> listModifiedFiles(File path, SVNRevision revision) throws SVNException { SVNClientManager svnClientManager = SVNClientManager.newInstance(); final List<File> fileList = new ArrayList<File>(); svnClientManager.getStatusClient().doStatus(path, revision, SVNDepth.INFINITY, false, false, false, false, new ISVNStatusHandler() { @Override public void handleStatus(SVNStatus status) throws SVNException { SVNStatusType statusType = status.getContentsStatus(); if (statusType != SVNStatusType.STATUS_NONE && statusType != SVNStatusType.STATUS_NORMAL && statusType != SVNStatusType.STATUS_IGNORED) { fileList.add(status.getFile()); } } }, null); return fileList; }
client.getUpdateClient().doUpdate(server.getTempDirectory(), SVNRevision.create(commit.getNewRevision()), SVNDepth.INFINITY, false, false); Assert.assertNull(status.getTreeConflict(), status.getFile().toString()); Assert.assertNull(status.getConflictNewFile(), status.getFile().toString()); }, changeLists); Assert.assertTrue(changeLists.isEmpty());