Usages of

com.microsoft.tfs.core.clients.versioncontrol.soapextensions.Item.getCheckinDate()
public DiffItem( final Item item, final String localPath, final String tempFile, final DiffItem rootItem, final VersionSpec version) { this( item.getServerItem(), localPath, tempFile, item.getEncoding().getCodePage(), rootItem, item.getItemType(), item.getCheckinDate().getTimeInMillis(), true, version); Check.notNull(item, "item"); //$NON-NLS-1$ this.item = item; changesetVersion = item.getChangeSetID(); }
@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()); } }
/* (non-Javadoc) * @see com.rabit.scm.SCM#getRepositoryFilesList(org.tmatesoft.svn.core.io.SVNRepository, java.lang.String, java.util.HashMap) */ @Override public HashMap<String, String> getRepositoryFilesList(SCMOptions options, HashMap<String, String> filesMap) { TFSTeamProjectCollection tpc = connectToTFS(); VersionControlClient vcc = tpc.getVersionControlClient(); ItemSet itemSet = vcc.getItems(options.getBranchName(), LatestVersionSpec.INSTANCE, RecursionType.FULL); Item[] items = itemSet.getItems(); String filepath = ""; for (Item item : items) { filepath = item.getServerItem(); if(filepath.startsWith(options.getBranchName())){ filepath = filepath.substring(options.getBranchName().length() + 1); } filesMap.put(filepath, DateUtil.getUTCDate(item.getCheckinDate().getTime().toLocaleString())); } return filesMap; }
private void createBlob( final ObjectInserter repositoryInserter, final Map<CommitTreePath, Map<CommitTreePath, CommitTreeEntry>> treeHierarchy, final ChangesetCommitItemReader previousChangesetCommitReader, final Item item, final TaskProgressMonitor progressMonitor) throws Exception { Check.notNull(repositoryInserter, "repositoryInserter"); //$NON-NLS-1$ Check.notNull(treeHierarchy, "treeHierarchy"); //$NON-NLS-1$ Check.notNull(previousChangesetCommitReader, "previousChangesetCommitReader"); //$NON-NLS-1$ Check.notNull(item, "item"); //$NON-NLS-1$ Check.notNull(progressMonitor, "progressMonitor"); //$NON-NLS-1$ if (item.getItemType() == ItemType.FOLDER) { return; } File tempFile = null; InputStream tempInputStream = null; ObjectId blobID = null; try { blobID = previousChangesetCommitReader.getFileObjectId(item.getServerItem(), item.getChangeSetID()); if (blobID == null || ObjectId.equals(blobID, ObjectId.zeroId())) { tempFile = File.createTempFile(GitTFConstants.GIT_TF_NAME, null, tempDir); try { versionControlService.downloadFile(item, tempFile.getAbsolutePath()); } catch (VersionControlException e) { // if the user is denied read permissions on the file an // exception will be thrown here. final String itemName = item.getServerItem() == null ? "" : item.getServerItem(); //$NON-NLS-1$ progressMonitor.displayWarning( Messages.formatString( "CreateCommitForChangesetVersionSpecTask.NoContentDueToPermissionOrDestroyFormat", //$NON-NLS-1$ itemName)); log.error(e); return; } catch (Throwable e) { /* * A workaround for unexpected TFS server errors. Aged * servers with long history might have some items corrupted * in some change sets and return incorrect HTTP response to * the download request. In this case we'd better suppress * the error and assume that the file does not exist. The * next change set that contains this file will commit it * into the repository. It seems to better to miss something * in the file's history log rather than to fail cloning the * repository entirely. */ // TODO: We should make this behavior optional since it's a // bit dangerous. If the file download fails in its last // change set the file will be marked as deleted in the // repository. if (e instanceof IOException) { throw (Exception) e; } else { final String itemName = item.getServerItem() == null ? "???" : item.getServerItem(); //$NON-NLS-1$ final String changeSetID = item.getChangeSetID() == 0 ? "???" //$NON-NLS-1$ : Integer.toString(item.getChangeSetID()); final String checkinDate = item.getCheckinDate() == null ? "???" //$NON-NLS-1$ : item.getCheckinDate().toString(); final String message = Messages.formatString( "CreateCommitForChangesetVersionSpecTask.UnexpectedErrorFormat", //$NON-NLS-1$ itemName, changeSetID, checkinDate); progressMonitor.displayWarning(message); progressMonitor.displayWarning(e.getMessage()); progressMonitor.displayWarning( Messages.getString("CreateCommitForChangesetVersionSpecTask.SeeLog")); //$NON-NLS-1$ log.warn(message); log.error(e); } } if (tempFile.exists()) { tempInputStream = new FileInputStream(tempFile); blobID = repositoryInserter.insert(OBJ_BLOB, tempFile.length(), tempInputStream); } else { blobID = ObjectId.zeroId(); } } FileMode fileMode = FileMode.REGULAR_FILE; /* handle executable files */ if (item.getPropertyValues() != null) { if (PropertyConstants.EXECUTABLE_ENABLED_VALUE.equals( PropertyUtils.selectMatching(item.getPropertyValues(), PropertyConstants.EXECUTABLE_KEY))) { fileMode = FileMode.EXECUTABLE_FILE; } } createBlob(repositoryInserter, treeHierarchy, item.getServerItem(), blobID, fileMode, progressMonitor); } finally { if (tempInputStream != null) { tempInputStream.close(); } if (tempFile != null) { tempFile.delete(); } } }
public void setItem(final Item item) { if (item != null) { itemType = item.getItemType(); itemTypeServerString = item.getItemType().toUIString(); serverItemServer = item.getServerItem(); versionServer = item.getChangeSetID(); deletionID = item.getDeletionID(); /* * TODO Get the server's time zone and convert from it to local * time. */ checkinDateString = FORMATTER.format(item.getCheckinDate().getTime()); if (item.getItemType() == ItemType.FILE && item.getEncoding().equals( new FileEncoding(VersionControlConstants.ENCODING_UNCHANGED)) == false) { encodingString = item.getEncoding().getName(); } fileLength = item.getContentLength(); } }
private void diffPendingChanges( final PendingChange[] pendingChanges, final VersionSpec sourceVersion, final boolean recursive) { Arrays.sort(pendingChanges, new PendingChangeComparator(PendingChangeComparatorType.SERVER_ITEM)); final boolean doneAtLeastOne = false; for (int i = 0; i < pendingChanges.length; i++) { final PendingChange change = pendingChanges[i]; getDisplay().printLine(MessageFormat.format( Messages.getString("CommandDifference.AColonBFormat"), //$NON-NLS-1$ change.getChangeType().toUIString(false, change), change.getLocalItem())); /* * Show contents for edits or deletes. Continue on failure. */ if (change.getChangeType().contains(ChangeType.EDIT) || change.getChangeType().contains(ChangeType.DELETE)) { try { /* * Setup the source item to be nothing (for adds), a pending * change item, or the base version. */ DiffLaunchItem sourceLaunchItem; if (change.getChangeType().contains(ChangeType.ADD)) { sourceLaunchItem = new LocalFileDiffLaunchItem( null, change.getEncoding(), change.getCreationDate().getTimeInMillis(), true); sourceLaunchItem.setLabel(Messages.getString("CommandDifference.NoSourceFile")); //$NON-NLS-1$ } else if (sourceVersion == null) { sourceLaunchItem = new PendingChangeDiffLaunchItem(change, client); } else { final Item baseItem = client.getItem(change.getServerItem(), sourceVersion, DeletedState.NON_DELETED, true); sourceLaunchItem = new VersionedFileDiffLaunchItem(client, baseItem, sourceVersion); final String relativePath = LocalPath.makeRelative(change.getLocalItem(), LocalPath.getCurrentWorkingDirectory()); final String messageFormat = Messages.getString("CommandDifference.ServerLabelFormat"); //$NON-NLS-1$ final String message = MessageFormat.format( messageFormat, relativePath, sourceVersion.toString(), DiffLaunchItem.SHORT_DATE_TIME_FORMATTER.format(baseItem.getCheckinDate().getTime())); sourceLaunchItem.setLabel(message); } /* * Setup the target item, which just points to the local * item. */ final DiffLaunchItem targetLaunchItem = new LocalFileDiffLaunchItem( change.getLocalItem(), change.getEncoding(), change.getCreationDate().getTimeInMillis(), false); if (change.getLocalItem() != null && new File(change.getLocalItem()).exists() == false) { targetLaunchItem.setLabel(Messages.getString("CommandDifference.NoTargetFile")); //$NON-NLS-1$ } launcher.launchDiff(sourceLaunchItem, targetLaunchItem); } catch (final ExternalToolException e) { /* * Rethrow this, because it's fatal. */ throw e; } catch (final Throwable t) { /* * Don't rethrow, because we have more changes to process. */ setExitCode(ExitCode.FAILURE); final String messageFormat = Messages.getString("CommandDifference.ErrorDiffingPendingChangeFormat"); //$NON-NLS-1$ final String message = MessageFormat.format(messageFormat, change.getLocalItem(), t.toString()); log.warn(message, t); getDisplay().printErrorLine(message); } } } if (doneAtLeastOne && getExitCode() == ExitCode.FAILURE) { setExitCode(ExitCode.PARTIAL_SUCCESS); } }
@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