User name and email are retrieved during installation if they don't already
have a mercurial.ini file
# HG changeset patch
# User Rock Hymas <r...@fogcreek.com>
# Date 1253039814 14400
# Branch stable
# Node ID d1c193fc56423343e17169aded0d2fa8598d2f4f
# Parent 25015b4f8205265a96c271796bbac52f1de256c9
Create a mercurial.ini file in the users HOME directory with username set
User name and email are retrieved during installation if they don't already have a mercurial.ini file
diff --git a/contrib/win32/mercurial.iss b/contrib/win32/mercurial.iss
--- a/contrib/win32/mercurial.iss
+++ b/contrib/win32/mercurial.iss
@@ -41,14 +41,14 @@
ArchitecturesInstallIn64BitMode=x64
[Types]
-Name: "full"; Description: "Full installation"
-Name: "custom"; Description: "Custom installation"; Flags: iscustom
+Name: full; Description: Full installation
+Name: custom; Description: Custom installation; Flags: iscustom
[Components]
-Name: "main"; Description: "Main Files (includes 'hg' and 'hgtk' commands)"; Types: full custom; Flags: fixed
-Name: "help"; Description: "Help Files"; Types: full
-Name: "hgbook"; Description: "The book 'Mercurial: The Definitive Guide' (PDF)"; Types: full
-Name: "shell"; Description: "Shell integration (overlay icons, context menu) [admin required]"; Types: full; Flags: restart; Check: ShellInstallPossible
+Name: main; Description: Main Files (includes 'hg' and 'hgtk' commands); Types: full custom; Flags: fixed
+Name: help; Description: Help Files; Types: full
+Name: hgbook; Description: The book 'Mercurial: The Definitive Guide' (PDF); Types: full
+Name: shell; Description: Shell integration (overlay icons, context menu) [admin required]; Types: full; Flags: restart; Check: ShellInstallPossible
[Files]
Source: ..\build-hg\contrib\mercurial.el; DestDir: {app}/contrib
@@ -58,16 +58,17 @@
Source: ..\build-hg\contrib\win32\ReadMe.html; DestDir: {app}; Flags: isreadme
Source: ..\build-hg\templates\*.*; DestDir: {app}\templates; Flags: recursesubdirs createallsubdirs
Source: ..\build-hg\locale\*.*; DestDir: {app}\locale; Flags: recursesubdirs createallsubdirs
-Source: ..\build-hg\i18n\*.*; DestDir: {app}\i18n; Flags:
+Source: ..\build-hg\i18n\*.*; DestDir: {app}\i18n; Flags:
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:
-Source: ..\contrib\TortoiseOverlays\*.*; DestDir: {app}/TortoiseOverlays;
+Source: ..\contrib\*.exe; DestDir: {app}; Flags:
+Source: ..\contrib\*.dll; DestDir: {app}; Flags:
+Source: ..\contrib\TortoiseOverlays\*.*; DestDir: {app}/TortoiseOverlays
Source: contrib\refreshicons.cmd; DestDir: {app}/contrib
-Source: dist\*.exe; Excludes: "thgtaskbar.exe"; DestDir: {app}; Flags: ignoreversion
+Source: dist\*.exe; Excludes: thgtaskbar.exe; DestDir: {app}; Flags: ignoreversion
Source: dist\thgtaskbar.exe; DestDir: {app}; Flags: ignoreversion; Components: shell
Source: dist\*.dll; DestDir: {app}; Flags: ignoreversion
Source: dist\library.zip; DestDir: {app}
@@ -76,10 +77,10 @@
Source: icons\*; DestDir: {app}\icons; Flags: ignoreversion recursesubdirs createallsubdirs
Source: dist\gtk\*; DestDir: {app}\gtk; Flags: ignoreversion recursesubdirs createallsubdirs
Source: locale\*.*; DestDir: {app}\locale; Flags: recursesubdirs createallsubdirs
-Source: i18n\*.*; DestDir: {app}\i18n; Flags:
+Source: i18n\*.*; DestDir: {app}\i18n; Flags:
Source: COPYING.txt; DestDir: {app}; DestName: Copying.txt
Source: icons\thg_logo.ico; DestDir: {app}
-Source: ..\misc\hgbook.pdf; DestDir: {app}/docs ; Components: hgbook
+Source: ..\misc\hgbook.pdf; DestDir: {app}/docs; Components: hgbook
Source: ..\misc\ThgShellx86.dll; DestDir: {app}; DestName: ThgShell.dll; Check: not Is64BitInstallMode; Flags: ignoreversion restartreplace uninsrestartdelete; Components: shell
Source: ..\misc\ThgShellx64.dll; DestDir: {app}; DestName: ThgShell.dll; Check: Is64BitInstallMode; Flags: ignoreversion restartreplace uninsrestartdelete; Components: shell
@@ -122,15 +123,15 @@
procedure FileExpandString(fn: String);
var
- InFile: String;
- i: Integer;
- InFileLines: TArrayOfString;
+ InFile: String;
+ i: Integer;
+ InFileLines: TArrayOfString;
begin
- InFile := ExpandConstant(fn);
- LoadStringsFromFile(InFile, InFileLines);
- for i:= 0 to GetArrayLength(InFileLines)-1 do
- InFileLines[i] := ExpandConstant(InFileLines[i]);
- SaveStringsToFile(InFile, InFileLines, False);
+ InFile := ExpandConstant(fn);
+ LoadStringsFromFile(InFile, InFileLines);
+ for i:= 0 to GetArrayLength(InFileLines)-1 do
+ InFileLines[i] := ExpandConstant(InFileLines[i]);
+ SaveStringsToFile(InFile, InFileLines, False);
end;
var IsUpgrade: Boolean;
@@ -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
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop