Hi Stefan,
This feature was mistakenly requested on the SVN dev list, but it is so
trivial to add that I thought I would put it in.
I have not got VC++ 2005 express sorted out yet, so I can't actually
build this to test it. That's why it's only a patch.
[[[
Add $WCNOW$ expansion keyword to SubWCRev.
This keyword expands to the current system date/time.
Allows insertion of actual build time along with version info.
]]]
Simon
--
___
oo // \\ "De Chelonian Mobile"
(_,\/ \_/ \ TortoiseSVN
\ \_/_\_/> The coolest Interface to (Sub)Version Control
/_/ \_\ http://tortoisesvn.tigris.org
Index: SubWCRev.cpp
===================================================================
--- SubWCRev.cpp (revision 5104)
+++ SubWCRev.cpp (working copy)
@@ -65,6 +65,7 @@
$WCDATE$ Date of highest committed revision\n\
$WCRANGE$ Update revision range\n\
$WCURL$ Repository URL of the working copy\n\
+$WCNOW$ Current system date & time\n\
\n\
Placeholders of the form \"$WCxxx?TrueText:FalseText$\" are replaced with\n\
TrueText if the tested condition is true, and FalseText if false.\n\
@@ -79,6 +80,7 @@
#define RANGEDEF "$WCRANGE$"
#define MIXEDDEF "$WCMIXED?"
#define URLDEF "$WCURL$"
+#define NOWDEF "$WCNOW$"
// Internal error codes
#define ERR_SYNTAX 1 // Syntax error
@@ -92,6 +94,10 @@
#define ERR_SVN_MIXED 8 // Mixed rev WC found (-m)
#define ERR_OUT_EXISTS 9 // Output file already exists (-d)
+// Value for apr_time_t to signify "now"
+#define USE_TIME_NOW -2 // 0 and -1 might already be significant.
+
+
char *AnsiToUtf8(const char * pszAnsi, apr_pool_t *pool)
{
// convert ANSI --> UTF16
@@ -177,7 +183,12 @@
return FALSE;
}
// Format the text to insert at the placeholder
- __time64_t ttime = date_svn/1000000L;
+ __time64_t ttime;
+ if (date_svn == USE_TIME_NOW)
+ _time64(&ttime);
+ else
+ ttime = date_svn/1000000L;
+
struct tm newtime;
if (_localtime64_s(&newtime, &ttime))
return FALSE;
@@ -510,6 +521,9 @@
while (InsertDate(DATEDEF, pBuf, index, filelength, maxlength, SubStat.CmtDate));
index = 0;
+ while (InsertDate(NOWDEF, pBuf, index, filelength, maxlength, USE_TIME_NOW));
+
+ index = 0;
while (InsertBoolean(MODDEF, pBuf, index, filelength, SubStat.HasMods));
index = 0;
Index: Test.tmpl
===================================================================
--- Test.tmpl (revision 5104)
+++ Test.tmpl (working copy)
@@ -3,6 +3,7 @@
char *Revision = "$WCREV$";
char *Modified = "$WCMODS?Modified:Not modified$";
char *Date = "$WCDATE$";
+char *TimeNow = "$WCNOW$";
char *RevRange = "$WCRANGE$";
char *Mixed = "$WCMIXED?Mixed revision WC:Not mixed$";
char *URL = "$WCURL$";
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Fri Dec 9 11:30:19 2005