Usages of

com.microsoft.tfs.core.clients.versioncontrol.soapextensions.Item.getContentHashValue()
@Override public void updateFrom(final Item item) { Check.isTrue(0 != versionLocal, "Attempted to update a ClientLocalVersionUpdate for an uncommitted item"); //$NON-NLS-1$ encoding = item.getEncoding().getCodePage(); if (VersionControlConstants.ENCODING_FOLDER != encoding) { baselineFileLength = item.getContentLength(); baselineHashValue = item.getContentHashValue(); versionLocalDate = DotNETDate.MIN_CALENDAR.equals(item.getCheckinDate()) ? -1 : DotNETDate.toWindowsFileTimeUTC(item.getCheckinDate()); } }
/** * Compare two tfs item based on MD5 hash * * @param node1 * @param node2 * @param monitor * @return */ private ContentComparisonResult tfsItemNodesCompare( final TFSItemNode node1, final TFSItemNode node2, final IProgressMonitor monitor) { final Item item1 = node1.getItem(); final Item item2 = node2.getItem(); if (item1.getItemType() == ItemType.FOLDER || item2.getItemType() == ItemType.FOLDER) { return ContentComparisonResult.EQUAL; } final byte[] hash1 = item1.getContentHashValue(); final byte[] hash2 = item2.getContentHashValue(); return compareByHash(hash1, hash2); }
private void downloadMissingBaselines(final IPopulatableLocalVersionUpdate[] updates) { if (null == updates || 0 == updates.length) { return; } Check.isTrue( options.contains(UpdateLocalVersionQueueOptions.UPDATE_SERVER), "Making a server call to fetch a missing baseline during an offline operation"); //$NON-NLS-1$ final List<BaselineRequest> baselineRequests = new ArrayList<BaselineRequest>(updates.length); for (final IPopulatableLocalVersionUpdate update : updates) { if (null != update.getDownloadURL()) { // We already fetched this download URL in // EnsureUpdatesFullyPopulated. final BaselineRequest request = BaselineRequest.fromDownloadUrl( update.getBaselineFileGUID(), update.getTargetLocalItem(), update.getDownloadURL(), update.getBaselineHashValue()); baselineRequests.add(request); } else { // We need to fetch this download URL from the server with a // QueryItems call. final GetItemsOptions options = GetItemsOptions.INCLUDE_SOURCE_RENAMES.combine(GetItemsOptions.UNSORTED).combine( GetItemsOptions.DOWNLOAD); final ItemSet[] items = workspace.getClient().getItems(new ItemSpec[] { new ItemSpec(update.getSourceServerItem(), RecursionType.NONE) }, new ChangesetVersionSpec(update.getVersionLocal()), DeletedState.ANY, ItemType.ANY, options); if (items[0].getItems().length != 1) { log.warn("DownloadMissingBaselines: Result missing"); //$NON-NLS-1$ } for (final Item item : items[0].getItems()) { final BaselineRequest request = BaselineRequest.fromDownloadUrl( update.getBaselineFileGUID(), update.getTargetLocalItem(), item.getDownloadURL(), item.getContentHashValue()); baselineRequests.add(request); break; } } } // Now we're going to go fetch the new baselines. If we need to create // our own master lock, do so. final WorkspaceLock workspaceLock = wLock == null ? workspace.lock() : wLock; try { // If we created our own master lock, then put a // BaselineFolderCollection on it. if (null == wLock) { final LocalWorkspaceTransaction transaction = new LocalWorkspaceTransaction(workspace); try { transaction.execute(new WorkspacePropertiesTransaction() { @Override public void invoke(final LocalWorkspaceProperties wp) { workspaceLock.setBaselineFolders( new BaselineFolderCollection(workspace, wp.getBaselineFolders())); } }); } finally { try { transaction.close(); } catch (final IOException e) { throw new VersionControlException(e); } } } workspaceLock.getBaselineFolders().processBaselineRequests(workspace, baselineRequests); } finally { // If we created our own master lock, release it. if (null == wLock) { workspaceLock.close(); } } }
@Override protected void populate(final PropertyHolder propertyHolder) { final Item item = change.getItem(); propertyHolder.addProperty( Messages.getString("ChangePropertySource.ChangeTypesPropertyName"), //$NON-NLS-1$ Messages.getString("ChangePropertySource.ChangeTypesPropertyDescription"), //$NON-NLS-1$ change.getChangeType().toUIString(true, item)); propertyHolder.addProperty( Messages.getString("ChangePropertySource.ChangesetIdPropertyName"), //$NON-NLS-1$ String.valueOf(item.getChangeSetID())); final Calendar c = item.getCheckinDate(); Object value = (c != null ? dateFormat.format(c.getTime()) : null); propertyHolder.addProperty( Messages.getString("ChangePropertySource.CheckinDatePropertyName"), //$NON-NLS-1$ Messages.getString("ChangePropertySource.CheckinDatePropertyDescription"), //$NON-NLS-1$ value); propertyHolder.addProperty( Messages.getString("ChangePropertySource.DeletionIdPropertyName"), //$NON-NLS-1$ String.valueOf(item.getDeletionID())); propertyHolder.addProperty( Messages.getString("ChangePropertySource.EncodingPropertyName"), //$NON-NLS-1$ String.valueOf(item.getEncoding())); final ItemType itemType = item.getItemType(); value = (itemType != null ? itemType.toString() : null); propertyHolder.addProperty( Messages.getString("ChangePropertySource.ItemTypePropertyName"), //$NON-NLS-1$ Messages.getString("ChangePropertySource.ItemTypePropertyDescription"), //$NON-NLS-1$ value); propertyHolder.addProperty( Messages.getString("ChangePropertySource.ItemIdPropertyName"), //$NON-NLS-1$ String.valueOf(item.getItemID())); propertyHolder.addProperty( Messages.getString("ChangePropertySource.ServerItemPropertyName"), //$NON-NLS-1$ Messages.getString("ChangePropertySource.ServerItemPropertyDescription"), //$NON-NLS-1$ item.getServerItem()); propertyHolder.addProperty(Messages.getString("ChangePropertySource.TimeZonePropertyName"), item.getTimeZone()); //$NON-NLS-1$ propertyHolder.addProperty( Messages.getString("ChangePropertySource.TimeZoneOffsetPropertyName"), //$NON-NLS-1$ item.getTimeZoneO()); final byte[] hash = item.getContentHashValue(); value = (hash != null ? ArrayUtils.byteArrayToHexString(hash) : null); propertyHolder.addProperty(Messages.getString("ChangePropertySource.HashValuePropertyName"), value); //$NON-NLS-1$ propertyHolder.addProperty( Messages.getString("ChangePropertySource.ContentLengthPropertyName"), //$NON-NLS-1$ String.valueOf(item.getContentLength())); propertyHolder.addProperty( Messages.getString("ChangePropertySource.DownloadUrlPropertyName"), //$NON-NLS-1$ item.getDownloadURL()); }
Usage snippet has been bookmarked! Review your bookmarks
Thank you! Review your likes