# HG changeset patch
# User Rock Hymas <[email protected]>
# Date 1253044345 14400
# Branch stable
# Node ID 69a4647178107528dad3cdb8e18c7dccfe7f8840
# Parent b55454ab7e07b3084f58c23d9da719eefbe9e730
installer: Create a mercurial.ini file in users HOME directory with username set
Ask for username during install if there is no mercurial.ini
diff --git a/contrib/win32/mercurial.iss b/contrib/win32/mercurial.iss
--- a/contrib/win32/mercurial.iss
+++ b/contrib/win32/mercurial.iss
@@ -62,6 +62,7 @@
Source: ..\build-hg\doc\*.html; DestDir: {app}\docs; Flags: ; Components: help
Source: {app}\Mercurial.ini; DestDir: {app}\backup; Flags: external
skipifsourcedoesntexist uninsneveruninstall
Source: contrib\win32\mercurial.ini; DestDir: {app}; DestName: Mercurial.ini;
AfterInstall: FileExpandString('{app}\Mercurial.ini')
+Source: contrib\win32\mercurialuser.ini; DestDir: {%USERPROFILE}; DestName:
Mercurial.ini; AfterInstall:
FileExpandStringEx('{%USERPROFILE}\Mercurial.ini'); Flags: onlyifdoesntexist
Source: ReleaseNotes.txt; DestDir: {app}; DestName: ReleaseNotes.txt
Source: ..\contrib\*.exe; DestDir: {app}; Flags:
Source: ..\contrib\*.dll; DestDir: {app}; Flags:
@@ -172,16 +173,60 @@
SP1Missing := True;
end;
-function ShouldSkipPage(PageID: Integer): Boolean;
-begin
- { Skip wpSelectDir page if upgrading; show all others }
- case PageID of
- wpSelectDir:
- Result := IsUpgrade;
- else
- Result := False;
- end;
-end;
+var UserInfoPage: TInputQueryWizardPage;
+var GetUserName: Boolean;
+
+procedure InitializeWizard();
+begin
+ if (not(FileExists(ExpandConstant('{%USERPROFILE}\Mercurial.ini')))) then
+ begin
+ // Create the page
+ UserInfoPage := CreateInputQueryPage(wpUserInfo,
+ 'Personal Information', 'Who are you?',
+ 'Please specify your name and email address, then click Next.');
+
+ // Add items (False means it's not a password edit)
+ UserInfoPage.Add('Full Name:', False);
+ UserInfoPage.Add('Email address:', False);
+
+ // Set initial values (optional)
+ UserInfoPage.Values[0] := ExpandConstant('{username}');
+ GetUserName := True;
+ end
+ else
+ GetUserName := False;
+end;
+
+procedure FileExpandStringEx(fn: String);
+var
+ InFile: String;
+ i: Integer;
+ InFileLines: TArrayOfString;
+begin
+ if (GetUserName) then
+ begin
+ InFile := ExpandConstant(fn);
+ LoadStringsFromFile(InFile, InFileLines);
+ for i:= 0 to GetArrayLength(InFileLines)-1 do
+ begin
+ InFileLines[i] := ExpandConstantEx(InFileLines[i],
+ 'hgusername',
+ UserInfoPage.Values[0] + ' <' + UserInfoPage.Values[1] + '>');
+ end;
+ SaveStringsToFile(InFile, InFileLines, False);
+ end;
+end;
+
+function ShouldSkipPage(PageID: Integer): Boolean;
+begin
+ { Skip wpSelectDir page if upgrading; show all others }
+ case PageID of
+ wpSelectDir:
+ Result := IsUpgrade;
+ else
+ Result := False;
+ end;
+end;
function TerminateThgTaskbar(): Boolean;
var
diff --git a/contrib/win32/mercurialuser.ini b/contrib/win32/mercurialuser.ini
new file mode 100644
--- /dev/null
+++ b/contrib/win32/mercurialuser.ini
@@ -0,0 +1,5 @@
+; User specific Mercurial config file.
+; See the hgrc man page for details.
+
+[ui]
+username = {hgusername}
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Tortoisehg-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop