}else{ int stateFlag = 0; if (sc.isDeleted()) { stateFlag += CommitItemStateFlags.Delete; } else if (sc.isAdded()) { stateFlag += CommitItemStateFlags.Add; } else if (sc.isContentsModified()) { stateFlag += CommitItemStateFlags.TextMods; if (sc.isPropertiesModified()) { stateFlag += CommitItemStateFlags.PropMods; if(sc.isCopied()){ stateFlag += CommitItemStateFlags.IsCopy; items[i] = new CommitItem(sc.getPath(), getNodeKind(sc.getKind()), stateFlag, sc.getURL() != null ? sc.getURL().toString() : null, sc.getCopyFromURL() != null ? sc.getCopyFromURL().toString() : null, sc.getRevision().getNumber());
public boolean handleCommitPath(String commitPath, ISVNEditor commitEditor) throws SVNException { SVNCommitItem item = (SVNCommitItem) myCommitItems.get(commitPath); SVNWCAccess wcAccess = item.getWCAccess(); wcAccess.checkCancelled(); if (item.isCopied()) { if (item.getCopyFromURL() == null) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.BAD_URL, "Commit item ''{0}'' has copy flag but no copyfrom URL", item.getFile()); SVNErrorManager.error(err); } else if (item.getRevision().getNumber() < 0) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_BAD_REVISION, "Commit item ''{0}'' has copy flag but an invalid revision", item.getFile()); SVNErrorManager.error(err); if (item.isAdded() && item.isDeleted()) { event = SVNEventFactory.createCommitEvent(wcAccess.getAnchor(), item.getFile(), SVNEventAction.COMMIT_REPLACED, item.getKind(), null); } else if (item.isAdded()) { String mimeType = null; if (item.getKind() == SVNNodeKind.FILE) { SVNAdminArea dir = item.getWCAccess().retrieve(item.getFile().getParentFile()); mimeType = dir.getProperties(item.getFile().getName()).getPropertyValue(SVNProperty.MIME_TYPE); event = SVNEventFactory.createCommitEvent(wcAccess.getAnchor(), item.getFile(), SVNEventAction.COMMIT_ADDED, item.getKind(), mimeType); } else if (item.isDeleted()) { event = SVNEventFactory.createCommitEvent(wcAccess.getAnchor(), item.getFile(), SVNEventAction.COMMIT_DELETED, item.getKind(), null); } else if (item.isContentsModified() || item.isPropertiesModified()) { event = SVNEventFactory.createCommitEvent(wcAccess.getAnchor(), item.getFile(), SVNEventAction.COMMIT_MODIFIED, item.getKind()); event.setPath(item.getPath()); wcAccess.handleEvent(event, ISVNEventHandler.UNKNOWN); long rev = item.getRevision().getNumber();
SVNCommitItem commitItem = myCommitItems[i]; result.append("\n"); if (commitItem.isAdded()) { result.append("A"); } else if (commitItem.isDeleted()) { result.append("D"); } else if (commitItem.isContentsModified()) { result.append("M"); } else { result.append("_"); if (commitItem.isPropertiesModified()) { result.append("M"); } else { if (commitItem.getPath() != null) { result.append(commitItem.getPath()); result.append(" "); result.append(commitItem.getFile().getAbsolutePath()); result.append("\n"); result.append(commitItem.getRevision()); result.append(" "); result.append(commitItem.getURL()); if (commitItem.isCopied()) { result.append("\n"); result.append("+"); result.append(commitItem.getCopyFromURL());
public String getWorkspaceProperty(String path, String name) throws SVNException { SVNCommitItem item = (SVNCommitItem) myCommitItems.get(path); if (item == null) { return null; } SVNAdminArea dir; String target; SVNWCAccess wcAccess = item.getWCAccess(); if (item.getKind() == SVNNodeKind.DIR) { dir = wcAccess.retrieve(item.getFile()); target = ""; } else { dir = wcAccess.retrieve(item.getFile().getParentFile()); target = SVNPathUtil.tail(item.getPath()); } SVNVersionedProperties wcProps = dir.getWCProperties(target); return wcProps.getPropertyValue(name); }
for (int i = 0; commitItems != null && i < commitItems.length; i++) { SVNCommitItem commitItem = commitItems[i]; if (commitItem.isAdded() || commitItem.isDeleted() || commitItem.isContentsModified() || commitItem.isPropertiesModified() || commitItem.isCopied()) { hasModifications = true; break;
Map lockTokens = SVNCommitUtil.translateLockTokens(commitPacket.getLockTokens(), baseURL.toString()); SVNCommitItem firstItem = commitPacket.getCommitItems()[0]; SVNRepository repository = createRepository(baseURL, firstItem.getFile(), firstItem.getWCAccess(), true); SVNCommitMediator mediator = new SVNCommitMediator(commitables); tmpFiles = mediator.getTmpFiles(); commitEditor = repository.getCommitEditor(commitMessage, lockTokens, keepLocks, revisionProperties, mediator); for (int i = 0; i < commitPacket.getCommitItems().length; i++) { commitPacket.getCommitItems()[i].getWCAccess().setEventHandler(getEventDispatcher()); String url = (String) urls.next(); SVNCommitItem item = (SVNCommitItem) commitables.get(url); explicitCommitPaths.add(item.getPath()); SVNWCAccess wcAccess = item.getWCAccess(); String path = item.getPath(); SVNAdminArea dir = null; String target = null; try { if (item.getKind() == SVNNodeKind.DIR) { target = ""; dir = wcAccess.retrieve(item.getFile()); } else { target = SVNPathUtil.tail(path); dir = wcAccess.retrieve(item.getFile().getParentFile()); if (item.isDeleted() && item.getKind() == SVNNodeKind.DIR) { File parentPath = "".equals(path) ? null : item.getFile().getParentFile(); String nameInParent = "".equals(path) ? null : SVNPathUtil.tail(path);
for (int i = 0; i < items.length; i++) { SVNCommitItem item = items[i]; if (itemsMap.containsKey(item.getURL().toString())) { SVNCommitItem oldItem = (SVNCommitItem) itemsMap.get(item.getURL().toString()); SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_DUPLICATE_COMMIT_URL, "Cannot commit both ''{0}'' and ''{1}'' as they refer to the same URL", new Object[] {item.getFile(), oldItem.getFile()}); SVNErrorManager.error(err); itemsMap.put(item.getURL().toString(), item); if (root.getKind() != SVNNodeKind.DIR) { baseURL = SVNPathUtil.removeTail(baseURL); } else if (root.getKind() == SVNNodeKind.DIR && (root.isAdded() || root.isDeleted() || root.isCopied() || root .isLocked())) { baseURL = SVNPathUtil.removeTail(baseURL);
baseAccess.checkCancelled(); SVNCommitItem item = (SVNCommitItem) items.next(); if (item.isDeleted()) { File file = item.getFile(); if (item.getKind() == SVNNodeKind.DIR) { if (!file.exists()) { continue; String name = SVNPathUtil.tail(item.getPath()); SVNAdminArea dir = baseAccess.retrieve(item.getFile().getParentFile()); if (!dir.getBaseFile(name, false).exists()) { continue; if (item.isContentsModified() || item.isDeleted() || item.isPropertiesModified()) { String itemPath = item.getPath(); if (!paths.contains(itemPath)) { items.remove();
for (int i = 0; i < items.length; i++) { SVNCommitItem item = items[i]; String path = item.getPath() != null ? item.getPath() : item.getURL().toString(); if ("".equals(path) || path == null) { path = "."; if (item.isDeleted() && item.isAdded()) { buffer.append('R'); } else if (item.isDeleted()) { buffer.append('D'); } else if (item.isAdded()) { buffer.append('A'); } else if (item.isContentsModified()) { buffer.append('M'); } else { buffer.append('_'); if (item.isPropertiesModified()) { buffer.append('M'); } else { buffer.append(' '); if (!myIsNoUnlock && item.isLocked()) { buffer.append('L'); } else { buffer.append(' '); if (item.isCopied()) { buffer.append("+ ");
String newDirURL = (String) newDirs.get(i); SVNURL url = SVNURL.parseURIEncoded(newDirURL); SVNCommitItem item = new SVNCommitItem(null, url, null, SVNNodeKind.NONE, null, null, true, false, false, false, false, false); commitItems.add(item); CopyPair pair = (CopyPair) copyPairs.get(i); SVNURL url = SVNURL.parseURIEncoded(pair.myDst); SVNCommitItem item = new SVNCommitItem(null, url, null, SVNNodeKind.NONE, null, null, true, false, false, false, false, false); commitItems.add(item); String itemURL = SVNPathUtil.append(source.myDst, SVNEncodingUtil.uriEncode(relativePath)); itemWithExternalsChanges = new SVNCommitItem(localPath, SVNURL.parseURIEncoded(itemURL), null, SVNNodeKind.DIR, null, null, false, false, true, false, false, false); for(int i = 0 ; i < commitItems.size(); i++) { SVNCommitItem item = (SVNCommitItem) commitItems.get(i); if (item.isDeleted()) { if (item.isAdded()) { if (!item.isCopied()) { SVNURL copyFromURL = item.getCopyFromURL(); if (copyFromURL == null) { SVNEntry entry = wcAccess.getEntry(item.getFile(), false); if (entry == null) {
String path = (String) paths.next(); SVNCommitItem item = (SVNCommitItem) myModifiedFiles.get(path); SVNWCAccess wcAccess = item.getWCAccess(); wcAccess.checkCancelled(); SVNEvent event = SVNEventFactory.createCommitEvent(wcAccess.getAnchor(), item.getFile(), SVNEventAction.COMMIT_DELTA_SENT, SVNNodeKind.FILE, null); wcAccess.handleEvent(event, ISVNEventHandler.UNKNOWN); SVNAdminArea dir = wcAccess.retrieve(item.getFile().getParentFile()); String name = SVNPathUtil.tail(item.getPath()); SVNEntry entry = dir.getEntry(name, false); if (!item.isAdded()) { checksum = SVNFileUtil.computeChecksum(dir.getBaseFile(name, false)); String realChecksum = entry.getChecksum(); String newChecksum = null; try { sourceIS = !item.isAdded() && baseFile.exists() ? SVNFileUtil.openFileForReading(baseFile) : SVNFileUtil.DUMMY_IN; targetIS = tmpFile.exists() ? SVNFileUtil.openFileForReading(tmpFile) : SVNFileUtil.DUMMY_IN; newChecksum = myDeltaGenerator.sendDelta(path, sourceIS, 0, targetIS, editor, true);
public static void filterOutFileExternals(Collection explicitPaths, Map commitables, SVNWCAccess baseAccess) throws SVNException { for (Iterator items = commitables.values().iterator(); items.hasNext();) { baseAccess.checkCancelled(); SVNCommitItem item = (SVNCommitItem) items.next(); SVNEntry entry = baseAccess.getEntry(item.getFile(), false); if (entry != null && entry.isFile() && entry.getExternalFilePath() != null) { if (!explicitPaths.contains(item.getPath())) { items.remove(); } } } }
protected SVNCommitItem[] filterSkippedItemsAndLockTokens(Collection<SVNCommitItem> items, Map<String, ?> lockTokens) { for (int i = 0; myCommitItems != null && i < myCommitItems.length; i++) { SVNCommitItem commitItem = myCommitItems[i]; if (!myIsSkipped[i]) { items.add(commitItem); } else if (lockTokens != null) { lockTokens.remove(commitItem.getURL().toString()); } } return (SVNCommitItem[]) items.toArray(new SVNCommitItem[items.size()]); }
public String getCommitMessage( String message, SVNCommitItem[] commitItems ) throws SVNException { if ( commitItems != null ) { { for ( SVNCommitItem commitItem : commitItems ) { if ( commitItem.getFile().isFile() ) { String path = StringUtils.removeStartIgnoreCase( commitItem.getFile().getPath(), baseDirectory ); files.add( path ); } } } } return message; }
SVNCommitItem commitItem = myCommitItems[i]; result.append("\n"); if (commitItem.isAdded()) { result.append("A"); } else if (commitItem.isDeleted()) { result.append("D"); } else if (commitItem.isContentsModified()) { result.append("M"); } else { result.append("_"); if (commitItem.isPropertiesModified()) { result.append("M"); } else { if (commitItem.getPath() != null) { result.append(commitItem.getPath()); result.append(" "); result.append(commitItem.getFile().getAbsolutePath()); result.append("\n"); result.append(commitItem.getRevision()); result.append(" "); result.append(commitItem.getURL()); if (commitItem.isCopied()) { result.append("\n"); result.append("+"); result.append(commitItem.getCopyFromURL());
for (int i = 0; commitItems != null && i < commitItems.length; i++) { SVNCommitItem commitItem = commitItems[i]; if (commitItem.isAdded() || commitItem.isDeleted() || commitItem.isContentsModified() || commitItem.isPropertiesModified() || commitItem.isCopied()) { hasModifications = true; break;
SVNRepository repository = createRepository(baseURL, firstItem.getFile(), firstItem.getWCAccess(), true); SVNCommitMediator mediator = new SVNCommitMediator(commitables); commitPacket.getCommitItems()[i].getWCAccess().setEventHandler(getEventDispatcher()); String url = (String) urls.next(); SVNCommitItem item = (SVNCommitItem) commitables.get(url); explicitCommitPaths.add(item.getPath()); SVNWCAccess wcAccess = item.getWCAccess(); String path = item.getPath(); SVNAdminArea dir = null; String target = null; if (item.getKind() == SVNNodeKind.DIR) { target = ""; dir = wcAccess.retrieve(item.getFile()); } else { target = SVNPathUtil.tail(path); dir = wcAccess.retrieve(item.getFile().getParentFile()); if (item.isDeleted() && item.getKind() == SVNNodeKind.DIR) { File parentPath = "".equals(path) ? null : item.getFile().getParentFile(); String nameInParent = "".equals(path) ? null : SVNPathUtil.tail(path); if (parentPath != null) { if (item.isAdded() && item.getCopyFromURL() != null && item.getKind() == SVNNodeKind.DIR) { recurse = true;
for (int i = 0; i < items.length; i++) { SVNCommitItem item = items[i]; if (itemsMap.containsKey(item.getURL())) { SVNCommitItem oldItem = (SVNCommitItem) itemsMap.get(item.getURL()); SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_DUPLICATE_COMMIT_URL, "Cannot commit both ''{0}'' and ''{1}'' as they refer to the same URL", new Object[] {item.getFile(), oldItem.getFile()}); SVNErrorManager.error(err, SVNLogType.WC); itemsMap.put(item.getURL(), item); if (root.getKind() != SVNNodeKind.DIR) { baseURL = baseURL.removePathTail(); } else if (root.getKind() == SVNNodeKind.DIR && (root.isAdded() || root.isDeleted() || root.isCopied() || root.isLocked())) { baseURL = baseURL.removePathTail();
baseAccess.checkCancelled(); SVNCommitItem item = (SVNCommitItem) items.next(); if (item.isDeleted()) { File file = item.getFile(); if (item.getKind() == SVNNodeKind.DIR) { if (!file.exists()) { continue; String name = SVNPathUtil.tail(item.getPath()); SVNAdminArea dir = baseAccess.retrieve(item.getFile().getParentFile()); if (!dir.getBaseFile(name, false).exists()) { continue; if (item.isContentsModified() || item.isDeleted() || item.isPropertiesModified()) { String itemPath = item.getPath(); if (!paths.contains(itemPath)) { items.remove();