You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by mr...@apache.org on 2014/09/18 16:41:27 UTC
svn commit: r1625995 - /jackrabbit/oak/trunk/oak-run/src/main/js/oak-mongo.js
Author: mreutegg
Date: Thu Sep 18 14:41:26 2014
New Revision: 1625995
URL: http://svn.apache.org/r1625995
Log:
OAK-1990: Utility js methods to manage Oak data in Mongo
Add function to print revision with human readable date
Modified:
jackrabbit/oak/trunk/oak-run/src/main/js/oak-mongo.js
Modified: jackrabbit/oak/trunk/oak-run/src/main/js/oak-mongo.js
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/js/oak-mongo.js?rev=1625995&r1=1625994&r2=1625995&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/js/oak-mongo.js (original)
+++ jackrabbit/oak/trunk/oak-run/src/main/js/oak-mongo.js Thu Sep 18 14:41:26 2014
@@ -164,6 +164,14 @@ var oak = (function(global){
return result;
}
+ /**
+ * Converts the given Revision String into a more human readable version,
+ * which also prints the date.
+ */
+ api.formatRevision = function(rev) {
+ return new Revision(rev).toReadableString();
+ }
+
//~--------------------------------------------------< internal >
var checkOrFixLastRevs = function(path, clusterId, dryRun) {
@@ -235,6 +243,10 @@ var oak = (function(global){
}
}
+ Revision.prototype.toReadableString = function () {
+ return this.rev + " (" + new Date(this.timestamp).toString() + ")"
+ }
+
var pathDepth = function(path){
if(path === '/'){
return 0;