public static SVNCommitItem commitItem(SvnCommitItem item) { return new SVNCommitItem(item.getPath(), item.getUrl(), item.getCopyFromUrl(), item.getKind(), SVNRevision.create(item.getRevision()), SVNRevision.create(item.getCopyFromRevision()), item.hasFlag(SvnCommitItem.ADD), item.hasFlag(SvnCommitItem.DELETE), item.hasFlag(SvnCommitItem.PROPS_MODIFIED), item.hasFlag(SvnCommitItem.TEXT_MODIFIED), item.hasFlag(SvnCommitItem.COPY), item.hasFlag(SvnCommitItem.LOCK)); }
private CommitItem getSvnCommitItem(SvnCommitItem commitable) { if (commitable == null) { return null; } return JavaHLObjectFactory.createCommitItem(getFilePath(commitable.getPath()), getNodeKind(commitable.getKind()), commitable.getFlags(), getUrlString(commitable.getUrl()), getUrlString(commitable.getCopyFromUrl()), commitable.getCopyFromRevision(), getFilePath(commitable.getMovedFromAbsPath())); }
SvnCommitItem item = new SvnCommitItem(); item.setPath(path); item.setKind(kind); item.setUrl(url); item.setRevision(revision); if (copyFromUrl!= null) { item.setCopyFromUrl(copyFromUrl); item.setCopyFromRevision(copyFromRevision); } else { item.setCopyFromRevision(-1); item.setFlags(flags);
private void queuePropChangeCommitItems(File localAbsPath, SVNURL commitUrl, SvnCommitPacket packet, String propName, SVNPropertyValue externalsPropertyValue, SVNURL repositoryRoot) { SvnCommitItem item = null; Collection<SvnCommitItem> items = packet.getItems(repositoryRoot); for (SvnCommitItem existingItem : items) { if (existingItem.getUrl().equals(commitUrl)) { item = existingItem; break; } } if (item == null) { item = new SvnCommitItem(); item.setPath(localAbsPath); item.setUrl(commitUrl); item.setKind(SVNNodeKind.DIR); item.setFlags(SvnCommitItem.PROPS_MODIFIED); packet.addItem(item, repositoryRoot); } else { item.setFlags(item.getFlags() | SvnCommitItem.PROPS_MODIFIED); } item.addOutgoingProperty(propName, externalsPropertyValue); }
private String buildErrorMessageWithDebugInformation(SvnCommitPacket oldPacket) { StringBuilder stringBuilder = new StringBuilder("Unable to perform wc to remote copy without local modifications:").append('\n'); stringBuilder.append("Commit packet was:").append('\n'); final Collection<SVNURL> repositoryRoots = oldPacket.getRepositoryRoots(); for (SVNURL oldRoot : repositoryRoots) { stringBuilder.append(oldRoot).append(" :").append('\n'); Collection<SvnCommitItem> oldItems = oldPacket.getItems(oldRoot); if (oldItems != null) { for (SvnCommitItem oldItem : oldItems) { stringBuilder.append("path=").append(oldItem.getPath()).append('\n'); stringBuilder.append("kind=").append(oldItem.getKind()).append('\n'); stringBuilder.append("url=").append(oldItem.getUrl()).append('\n'); stringBuilder.append("revision=").append(oldItem.getRevision()).append('\n'); stringBuilder.append("copyUrl=").append(oldItem.getCopyFromUrl()).append('\n'); stringBuilder.append("copyRevision=").append(oldItem.getCopyFromRevision()).append('\n'); stringBuilder.append("flags=").append(oldItem.getFlags()).append('\n'); } } } return stringBuilder.toString(); }
private static void handleDescendants(SVNWCContext context, SvnCommitPacket packet, SVNURL rootUrl, Collection<SvnCommitItem> items, ISvnUrlKindCallback urlKindCallback, ISVNEventHandler eventHandler) throws SVNException { for (SvnCommitItem item : items) { if (!item.hasFlag(SvnCommitItem.ADD) || item.getCopyFromUrl() == null) { continue; eventHandler.checkCancelled(); Collection<File> notPresent = SvnWcDbReader.getNotPresentDescendants((SVNWCDb) context.getDb(), item.getPath()); for (File absent : notPresent) { boolean itemFound = false; File localAbsPath = SVNFileUtil.createFilePath(item.getPath(), absent); for (SvnCommitItem i : items) { if (i.getPath().equals(localAbsPath)) { itemFound = true; break; continue; SVNURL url = SVNWCUtils.join(item.getCopyFromUrl(), absent); SVNNodeKind kind = SVNNodeKind.UNKNOWN; if (urlKindCallback != null) { kind = urlKindCallback.getUrlKind(url, item.getCopyFromRevision()); if (kind == SVNNodeKind.NONE) { continue; packet.addItem(localAbsPath, rootUrl, kind, SVNWCUtils.join(item.getUrl(), absent), -1, null, -1, SvnCommitItem.DELETE);
for (SvnCommitItem item : items) { if (item.hasFlag(SvnCommitItem.DELETE)) { continue; if (item.hasFlag(SvnCommitItem.ADD)) { if (!item.hasFlag(SvnCommitItem.COPY)) { continue; final SVNURL copyFromUrl = item.getCopyFromUrl(); if (copyFromUrl == null) { continue; baseInfo = getWcContext().getDb().getBaseInfo(item.getPath(), ISVNWCDb.WCDbBaseInfo.BaseInfoField.reposRootUrl, ISVNWCDb.WCDbBaseInfo.BaseInfoField.reposRelPath); } catch (SVNException e) { if (e.getErrorMessage().getErrorCode() != SVNErrorCode.WC_PATH_NOT_FOUND) { item.setFlags(item.getFlags() & (~SvnCommitItem.TEXT_MODIFIED) & (~SvnCommitItem.PROPS_MODIFIED));
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.getPath(), oldItem.getPath()}); SVNErrorManager.error(err, SVNLogType.WC); itemsMap.put(item.getUrl(), item); if (rootItem.getKind() != SVNNodeKind.DIR) { baseURL = baseURL.removePathTail(); } else if (rootItem.getKind() == SVNNodeKind.DIR && (rootItem.hasFlag(SvnCommitItem.ADD) || rootItem.hasFlag(SvnCommitItem.DELETE) || rootItem.hasFlag(SvnCommitItem.COPY) || rootItem.hasFlag(SvnCommitItem.LOCK))) { baseURL = baseURL.removePathTail();
private void postProcessCommitItem(SvnCommittedQueue queue, SvnCommitItem item, boolean keepChangelists, boolean keepLocks, SvnChecksum sha1Checksum) throws SVNException { boolean removeLock = !keepLocks && item.hasFlag(SvnCommitItem.LOCK); Map<String, SVNPropertyValue> wcPropChanges = item.getIncomingProperties(); SVNProperties wcProps = null; if (wcPropChanges != null) { try { wcProps = getWcContext().getDb().getBaseDavCache(item.getPath()); } catch (SVNException e) { // missing properties. } if (wcProps == null) { wcProps = new SVNProperties(); } for (String name : wcPropChanges.keySet()) { SVNPropertyValue pv = wcPropChanges.get(name); if (pv == null) { wcProps.remove(name); } else { wcProps.put(name, pv); } } } final boolean unlockOnly = item.getFlags() == SvnCommitItem.LOCK && wcPropChanges == null; queueCommitted(queue, item.getPath(), false, wcProps, unlockOnly, removeLock, !keepChangelists, sha1Checksum); }
if (makeParents && parents != null) { for (SVNURL parent : parents) { SvnCommitItem parentItem = new SvnCommitItem(); parentItem.setUrl(parent); parentItem.setFlags(SvnCommitItem.ADD); parentItem.setKind(SVNNodeKind.DIR); items[index++] = parentItem; SvnCommitItem item = new SvnCommitItem(); item.setUrl(svnCopyPair.dst); item.setPath(svnCopyPair.source); item.setFlags(SvnCommitItem.ADD); item.setKind(SVNNodeKind.DIR); items[index++] = item; if (mergeInfo != null) { extendedMergeInfoValue = SVNMergeInfoUtil.formatMergeInfoToString(wcMergeInfo, null); item.addOutgoingProperty(SVNProperty.MERGE_INFO, SVNPropertyValue.create(extendedMergeInfoValue));
for (int i = 0; i < commitItems.length; i++) { String path = (String) paths.get(i); SvnCommitItem item = new SvnCommitItem(); item.setKind(SVNNodeKind.NONE); item.setUrl(rootURL.appendPath(path, true)); item.setFlags(SvnCommitItem.DELETE); commitItems[i] = item;
private String getItemKey(SvnCommitItem item, SVNURL rootURL, boolean combinePackets) throws SVNException { if (combinePackets) { return rootURL.toString(); } final File wcRoot = SvnOperationFactory.getWorkingCopyRoot(item.getKind() == SVNNodeKind.FILE ? item.getPath().getParentFile() : item.getPath(), true); return rootURL.toString() + ":" + wcRoot.getAbsolutePath(); }
/** * Adds commit item to the commit packet with the repository root URL. * @param item commit item * @param repositoryRoot repository root URL */ public void addItem(SvnCommitItem item, SVNURL repositoryRoot) { if (!items.containsKey(repositoryRoot)) { items.put(repositoryRoot, new HashSet<SvnCommitItem>()); } items.get(repositoryRoot).add(item); itemsByPath.put(item.getPath() != null ? SVNFileUtil.getFilePath(item.getPath()) : null, item); }
public void sendTextDeltas(ISVNEditor editor) throws SVNException { for (String path : myModifiedFiles.keySet()) { SvnCommitItem item = myModifiedFiles.get(path); myContext.checkCancelled(); File itemAbspath = item.getPath(); if (myContext.getEventHandler() != null) { SVNEvent event = SVNEventFactory.createSVNEvent(itemAbspath, SVNNodeKind.FILE, null, SVNRepository.INVALID_REVISION, SVNEventAction.COMMIT_DELTA_SENT, null, null, null); myContext.getEventHandler().handleEvent(event, ISVNEventHandler.UNKNOWN); } boolean fulltext = item.hasFlag(SvnCommitItem.ADD); TransmittedChecksums transmitTextDeltas = transmitTextDeltas(path, itemAbspath, fulltext, editor); SvnChecksum newTextBaseMd5Checksum = transmitTextDeltas.md5Checksum; SvnChecksum newTextBaseSha1Checksum = transmitTextDeltas.sha1Checksum; if (myMd5Checksums != null) { myMd5Checksums.put(itemAbspath, newTextBaseMd5Checksum); } if (mySha1Checksums != null) { mySha1Checksums.put(itemAbspath, newTextBaseSha1Checksum); } } }
/** * Checks whether commit item has the flag * @param flag the value of the flag * @return <code>true</code> if commit item flags contain the requested value, otherwise <code>false</code> */ public boolean hasFlag(int flag) { return (getFlags() & flag) != 0; }
lockTokens.put(item.getUrl(), lock.getID());
public void setWorkspaceProperty(String path, String name, SVNPropertyValue value) throws SVNException { if (name != null) { SvnCommitItem item = (SvnCommitItem) myCommitItems.get(path); if (item != null) { item.addIncomingProperty(name, value); } } }
SvnCommitItem.PROPS_MODIFIED); itemWithExternalsChanges.addOutgoingProperty(SVNProperty.EXTERNALS, SVNPropertyValue.create(newExternalsProp));
for (i = 0; i < commitItems.length; i++) { String path = (String) sortedPaths.get(i); SvnCommitItem item = new SvnCommitItem(); item.setKind(SVNNodeKind.DIR); item.setUrl(rootURL.appendPath(path, true)); item.setFlags(SvnCommitItem.ADD); commitItems[i] = item;