1. TortoiseHg
  2. TortoiseHg
  3. thg

Commits

Adrian Buehlmann  committed eabe6ec

shellext: include automatic parent id in string versions built

Note that we cannot put a mercurial changeset id into binary
file/product versions, since it contains non-digit characters
(e.g. "dc0395b8dab6").

Remark 1: Windows installer ignores the fourth level of binary
file/product versions. Leaving that at zero here (lots of applications
fill in a build number there).

Remark 2: Windows installer ignores string versions. So the parent
id added in this change has purely commentary function (see "Properties"
dialog of the built file THgShell.dll).

  • Participants
  • Parent commits 5fac8ff
  • Branches stable

Comments (0)

Files changed (5)

File .hgignore

View file
 glob:win32/*.reg
 glob:*~
 glob:tortoisehg/util/__version__.py
+glob:win32/shellext/parentid.h

File win32/shellext/Makefile.nmake

View file
 all: THgShell.dll
 
 clean:
-    del *.obj *.dll *.exe *.lib *.exp *.manifest *.res
+    del *.obj *.dll *.exe *.lib *.exp *.manifest *.res parentid.h
 
 THgShell.dll: $(OBJECTS_THGSGELL)
+    create-parentid-h.cmd
     rc shellext.rc
     link /OUT:$@ $(LDFLAGS_THGSHELL) $** shellext.res
     mt -nologo -manifest $@.manifest -outputresource:"$@;#2"

File win32/shellext/create-parentid-h.cmd

View file
+@echo off
+hg parents --template "#define THG_PARENT_ID {node|short}\n" > parentid.h

File win32/shellext/shellext.rc

View file
 #include "windows.h"
+#include "thgversion.h"
+#include "parentid.h"
+
+
+#define TOSTR(x)  #x
+#define TOSTR2(x) TOSTR(x)
+
+#define THG_VERSION_BINARY \
+  THG_VERSION_FIRST, THG_VERSION_SECOND, THG_VERSION_THIRD, 0
+
+#define THG_VERSION_STRING \
+  TOSTR2(THG_VERSION_FIRST) "." \
+  TOSTR2(THG_VERSION_SECOND) "." \
+  TOSTR2(THG_VERSION_THIRD) "-" \
+  TOSTR2(THG_PARENT_ID)
 
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,9,3,0
- PRODUCTVERSION 0,9,3,0
+ FILEVERSION THG_VERSION_BINARY
+ PRODUCTVERSION THG_VERSION_BINARY
  FILEFLAGSMASK 0x17L
 #ifdef _DEBUG
  FILEFLAGS 0x1L
             VALUE "Comments", "TortoiseHg Shell Extension"
             VALUE "CompanyName", "TortoiseHg Project"
             VALUE "FileDescription", "TortoiseHg Shell Extension Dynamic Link Library"
-            VALUE "FileVersion", "0, 9, 3, 0"
+            VALUE "FileVersion", THG_VERSION_STRING
             VALUE "InternalName", "shellext"
             VALUE "LegalCopyright", "Copyright (C) 2010"
             VALUE "OriginalFilename", "ThgShell.dll"
             VALUE "ProductName", "TortoiseHg Shell Extension Dynamic Link Library"
-            VALUE "ProductVersion", "0, 9, 3, 0"
+            VALUE "ProductVersion", THG_VERSION_STRING
         END
     END
     BLOCK "VarFileInfo"

File win32/shellext/thgversion.h

View file
+#define THG_VERSION_FIRST   0
+#define THG_VERSION_SECOND  9
+#define THG_VERSION_THIRD   3