public String getPropertyTime(String name) { String path = getThisDirName().equals(name) ? "dir-props" : "props/" + name + ".svn-work"; File file = getAdminFile(path); return SVNDate.formatDate(new Date(file.lastModified())); }
private Date getJavaDate() { if (javaDate == null) { javaDate = dateString == null ? null : SVNDate.parseDate(dateString); } return javaDate; }
public String getTextTime() { return textTime != null ? textTime.format() : null; }
private static long getLongDate(Date date) { SVNDate svnDate = SVNDate.fromDate(date); return svnDate.getTimeInMicros(); }
private SVNProperties createRevisionProperties(String author, Date date) { if (author == null && date == null) { return null; } SVNProperties properties = new SVNProperties(); if (author != null) { properties.put(SVNRevisionProperty.AUTHOR, author); } if (date != null) { properties.put(SVNRevisionProperty.DATE, SVNDate.fromDate(date).format()); } return properties; }
public void restoreFile(String name) throws SVNException { SVNVersionedProperties props = getProperties(name); SVNEntry entry = getEntry(name, true); boolean special = props.getPropertyValue(SVNProperty.SPECIAL) != null; File src = getBaseFile(name, false); File dst = getFile(name); SVNTranslator.translate(this, name, SVNFileUtil.getBasePath(src), SVNFileUtil.getBasePath(dst), true); boolean executable = props.getPropertyValue(SVNProperty.EXECUTABLE) != null; boolean needsLock = props.getPropertyValue(SVNProperty.NEEDS_LOCK) != null; if (needsLock) { SVNFileUtil.setReadonly(dst, entry.getLockToken() == null); } if (executable) { SVNFileUtil.setExecutable(dst, true); } markResolved(name, true, false, SVNConflictChoice.MERGED); long tstamp; if (myWCAccess.getOptions().isUseCommitTimes() && !special) { entry.setTextTime(entry.getCommittedDate()); tstamp = SVNDate.parseDate(entry.getCommittedDate()).getTime(); dst.setLastModified(tstamp); } else { tstamp = System.currentTimeMillis(); dst.setLastModified(tstamp); entry.setTextTime(SVNDate.formatDate(new Date(tstamp))); } saveEntries(false); }
compare = true; } else { long textTimeAsLong = SVNFileUtil.roundTimeStamp(SVNDate.parseDateAsMilliseconds(textTime)); long tstamp = SVNFileUtil.roundTimeStamp(textFile.lastModified()); if (textTimeAsLong != tstamp ) { Map attributes = new SVNHashMap(); attributes.put(SVNProperty.WORKING_SIZE, Long.toString(textFile.length())); attributes.put(SVNProperty.TEXT_TIME, SVNDate.formatDate(new Date(textFile.lastModified()))); modifyEntry(name, attributes, true, false);
public void run() throws SVNException { SVNProperties props = getProperties(); SVNPropertyValue value = props.getSVNPropertyValue(SVNRevisionProperty.DATE); if (value != null && value.getString() != null) { SVNDate date = SVNDate.parseDate(value.getString()); getEnvironment().getOut().print(SVNDate.formatHumanDate(date, null)); } getEnvironment().getOut().println(); }
byte[] header = null; Date jDate = d == null ? null : SVNDate.parseDate(d); String token = tokens.nextToken(); if ("LastChangedDate".equalsIgnoreCase(token) || "Date".equalsIgnoreCase(token)) { date = expand && date == null ? SVNDate.formatHumanDate(jDate, options).getBytes("UTF-8") : date; map.put("LastChangedDate", date); map.put("Date", date); if (expand && header == null) { rev = rev == null ? r.getBytes("UTF-8") : rev; idDate = idDate == null ? SVNDate.formatShortDate(jDate).getBytes("UTF-8") : idDate; name = name == null ? SVNEncodingUtil.uriDecode(SVNPathUtil.tail(u)).getBytes("UTF-8") : name; author = author == null ? (a == null ? new byte[0] : a.getBytes("UTF-8")) : author; rev = rev == null ? r.getBytes("UTF-8") : rev; url = expand && url == null ? SVNEncodingUtil.uriDecode(u).getBytes("UTF-8") : url; idDate = idDate == null ? SVNDate.formatShortDate(jDate).getBytes("UTF-8") : idDate; author = author == null ? (a == null ? new byte[0] : a.getBytes("UTF-8")) : author; ByteArrayOutputStream bos = new ByteArrayOutputStream();
private void writeRevisionRecord(OutputStream dumpStream, FSFS fsfs, long revision) throws SVNException { SVNProperties revProps = fsfs.getRevisionProperties(revision); String revisionDate = revProps.getStringValue(SVNRevisionProperty.DATE); if (revisionDate != null) { SVNDate date = SVNDate.parseDate(revisionDate); revProps.put(SVNRevisionProperty.DATE, date.format()); } ByteArrayOutputStream encodedProps = new ByteArrayOutputStream(); SVNAdminHelper.writeProperties(revProps, null, encodedProps); writeDumpData(dumpStream, SVNAdminHelper.DUMPFILE_REVISION_NUMBER + ": " + revision + "\n"); String propContents = null; try { propContents = new String(encodedProps.toByteArray(), "UTF-8"); } catch (UnsupportedEncodingException uee) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, uee.getLocalizedMessage()); SVNErrorManager.error(err, uee, SVNLogType.FSFS); } writeDumpData(dumpStream, SVNAdminHelper.DUMPFILE_PROP_CONTENT_LENGTH + ": " + propContents.length() + "\n"); writeDumpData(dumpStream, SVNAdminHelper.DUMPFILE_CONTENT_LENGTH + ": " + propContents.length() + "\n\n"); writeDumpData(dumpStream, propContents); writeDumpData(dumpStream, "\n"); }
if (modified) { timestamp = SVNFileUtil.getFileLastModified(from); committedDate = new SVNDate(timestamp, 0); } else { Structure<NodeInfo> nodeInfo = getWcContext().getDb().readInfo(from, NodeInfo.changedDate); committedDate = nodeInfo.<SVNDate>get(NodeInfo.changedDate); timestamp = committedDate.getTime(); nodeInfo.release(); keywordsMap = SVNTranslator.computeKeywords(keywords, nodeUrl.toString(), reposRootUrl == null ? null : reposRootUrl.toString(), author, SVNDate.formatDate(committedDate), rev, getOperation().getOptions());
public static SVNSqlJetStatement bindf(SVNSqlJetStatement stmt, String format, Object... binds) throws SVNException { if (binds != null) { for (int i = 0; i < binds.length; i++) { if (binds[i] instanceof SVNWCDbStatus) { binds[i] = getPresenceText((SVNWCDbStatus) binds[i]); } else if (binds[i] instanceof SVNWCDbKind) { binds[i] = getKindText((SVNWCDbKind) binds[i]); } else if (binds[i] instanceof File) { binds[i] = SVNFileUtil.getFilePath((File) binds[i]); } else if (binds[i] instanceof SVNDate) { binds[i] = ((SVNDate) binds[i]).getTimeInMicros(); } else if (binds[i] instanceof SVNDepth) { binds[i] = binds[i].toString(); } } } stmt.bindf(format, binds); return stmt; }
myBuffer = openXMLTag("commit", SVNXMLUtil.XML_STYLE_NORMAL, "revision", Long.toString(revision), myBuffer); myBuffer = openCDataTag("author", author, myBuffer); myBuffer = openCDataTag("date", ((SVNDate) date).format(), myBuffer); myBuffer = closeXMLTag("commit", myBuffer); Long.toString(mergedRevision), myBuffer); myBuffer = openCDataTag("author", mergedAuthor, myBuffer); myBuffer = openCDataTag("date", ((SVNDate) mergedDate).format(), myBuffer); myBuffer = closeXMLTag("commit", myBuffer); myBuffer = closeXMLTag("merged", myBuffer); String dateStr = " -"; if (date != null) { dateStr = SVNDate.formatHumanDate(date, getSVNEnvironment().getClientManager().getOptions());
private byte[] getDate() throws UnsupportedEncodingException { if (date == null) { date = expand ? SVNDate.formatHumanDate(getJavaDate(), options).getBytes("UTF-8") : date; } return date; }
protected boolean writeTime(Writer writer, String val, int emptyFields) throws IOException { if (val != null && val.length() > 0) { long time = SVNDate.parseDateAsMilliseconds(val); if (time > 0) { for (int i = 0; i < emptyFields; i++) { writer.write('\n'); } writer.write(val); writer.write('\n'); return true; } } return false; }
long changedRev = entryProps.containsName(SVNProperty.COMMITTED_REVISION) ? Long.parseLong(entryProps.getStringValue(SVNProperty.COMMITTED_REVISION)) : - 1; String changedAuthor = entryProps.getStringValue(SVNProperty.LAST_AUTHOR); SVNDate changedDate = entryProps.containsName(SVNProperty.COMMITTED_REVISION) ? SVNDate.parseDate(entryProps.getStringValue(SVNProperty.COMMITTED_DATE)) : new SVNDate(0, 0);
if (d != null) { if (System.currentTimeMillis() - d.getTime() < 365 * 1000 * 86400 / 2) { timeStr = SVNDate.formatConsoleShortDate(d); } else { timeStr = SVNDate.formatConsoleLongDate(d);
public long getTimeInMicros() { return 1000 * getTime() + myMicroSeconds; } }
public String toString() { StringBuffer buf = new StringBuffer(); buf.append("\n----\nPath: " + path); buf.append("\nRevision: " + revision); buf.append("\nAuthor: " + author); buf.append("\nDate: " + SVNDate.formatConsoleShortDate(date)); buf.append("\nBlock start: " + blockStart); buf.append("\n"); return buf.toString(); } }