Patchwork [2,of,2] win32: remove Mercurial.ini file from Inno Setup installer (issue4435)

login
register
mail settings
Submitter Pascal Quantin
Date Nov. 4, 2014, 9:43 p.m.
Message ID <871aea23211152e39fb9.1415137400@Pascal-PC>
Download mbox | patch
Permalink /patch/6567/
State Accepted
Headers show

Comments

Pascal Quantin - Nov. 4, 2014, 9:43 p.m.
# HG changeset patch
# User Pascal Quantin <pascal.quantin@gmail.com>
# Date 1415134467 -3600
#      Tue Nov 04 21:54:27 2014 +0100
# Node ID 871aea23211152e39fb9b145e530ae5ab4886e21
# Parent  b792b22f8d3bf362c3a5c694b57214154463b8a8
win32: remove Mercurial.ini file from Inno Setup installer (issue4435)
Matt Mackall - Nov. 4, 2014, 9:51 p.m.
On Tue, 2014-11-04 at 22:43 +0100, Pascal Quantin wrote:
> # HG changeset patch
> # User Pascal Quantin <pascal.quantin@gmail.com>
> # Date 1415134467 -3600
> #      Tue Nov 04 21:54:27 2014 +0100
> # Node ID 871aea23211152e39fb9b145e530ae5ab4886e21
> # Parent  b792b22f8d3bf362c3a5c694b57214154463b8a8
> win32: remove Mercurial.ini file from Inno Setup installer (issue4435)

Queued for default, thanks.
Mads Kiilerich - Nov. 5, 2014, 1:16 a.m.
On 11/04/2014 10:43 PM, Pascal Quantin wrote:
> # HG changeset patch
> # User Pascal Quantin <pascal.quantin@gmail.com>
> # Date 1415134467 -3600
> #      Tue Nov 04 21:54:27 2014 +0100
> # Node ID 871aea23211152e39fb9b145e530ae5ab4886e21
> # Parent  b792b22f8d3bf362c3a5c694b57214154463b8a8
> win32: remove Mercurial.ini file from Inno Setup installer (issue4435)

Thanks for fixing my blind and bad changes.

> diff --git a/contrib/win32/mercurial.iss b/contrib/win32/mercurial.iss
> --- a/contrib/win32/mercurial.iss
> +++ b/contrib/win32/mercurial.iss
> @@ -67,7 +67,6 @@
>   Source: contrib\hgweb.fcgi; DestDir: {app}/Contrib
>   Source: contrib\hgweb.wsgi; DestDir: {app}/Contrib
>   Source: contrib\win32\ReadMe.html; DestDir: {app}; Flags: isreadme
> -Source: contrib\win32\mercurial.ini; DestDir: {app}; DestName: Mercurial.ini; Check: CheckFile;

Should we really just stop installing contrib/win32/mercurial.ini ? If 
so, shouldn't the file be removed?

 From the "Do Not Edit This File" I would assume that it would be a good 
fit for installation in default.d . But from the actual (no) content of 
this file, it seems like it would be fine to install it as before but 
_never_ overwrite it on upgrades.

/Mads
Pascal Quantin - Nov. 5, 2014, 6:18 a.m.
Hi,

2014-11-05 2:16 GMT+01:00 Mads Kiilerich <mads@kiilerich.com>:

> On 11/04/2014 10:43 PM, Pascal Quantin wrote:
>
>> # HG changeset patch
>> # User Pascal Quantin <pascal.quantin@gmail.com>
>> # Date 1415134467 -3600
>> #      Tue Nov 04 21:54:27 2014 +0100
>> # Node ID 871aea23211152e39fb9b145e530ae5ab4886e21
>> # Parent  b792b22f8d3bf362c3a5c694b57214154463b8a8
>> win32: remove Mercurial.ini file from Inno Setup installer (issue4435)
>>
>
> Thanks for fixing my blind and bad changes.
>
>  diff --git a/contrib/win32/mercurial.iss b/contrib/win32/mercurial.iss
>> --- a/contrib/win32/mercurial.iss
>> +++ b/contrib/win32/mercurial.iss
>> @@ -67,7 +67,6 @@
>>   Source: contrib\hgweb.fcgi; DestDir: {app}/Contrib
>>   Source: contrib\hgweb.wsgi; DestDir: {app}/Contrib
>>   Source: contrib\win32\ReadMe.html; DestDir: {app}; Flags: isreadme
>> -Source: contrib\win32\mercurial.ini; DestDir: {app}; DestName:
>> Mercurial.ini; Check: CheckFile;
>>
>
> Should we really just stop installing contrib/win32/mercurial.ini ? If so,
> shouldn't the file be removed?
>

I did not remove it yet as it is still used by the WIX installer and I have
no knowledge on how to safely modify it. So I will let the "right" guy
finish the work :)


> From the "Do Not Edit This File" I would assume that it would be a good
> fit for installation in default.d . But from the actual (no) content of
> this file, it seems like it would be fine to install it as before but
> _never_ overwrite it on upgrades.
>

In fact there were still 2 useful things in this file: a default editor for
Windows (notepad) so that 'hg config --edit' works fine and the location of
the cacert.pem file (this entry is generated during the installation
procedure). Rather than keeping this now almost useless Mercurial.ini file
in the installation folder, I decided to follow your new proposal and
create cacerts.rc and editor.rc files in the default.d folder.

Pascal.

Patch

diff --git a/contrib/win32/mercurial.iss b/contrib/win32/mercurial.iss
--- a/contrib/win32/mercurial.iss
+++ b/contrib/win32/mercurial.iss
@@ -67,7 +67,6 @@ 
 Source: contrib\hgweb.fcgi; DestDir: {app}/Contrib
 Source: contrib\hgweb.wsgi; DestDir: {app}/Contrib
 Source: contrib\win32\ReadMe.html; DestDir: {app}; Flags: isreadme
-Source: contrib\win32\mercurial.ini; DestDir: {app}; DestName: Mercurial.ini; Check: CheckFile;
 Source: contrib\win32\postinstall.txt; DestDir: {app}; DestName: ReleaseNotes.txt
 Source: dist\hg.exe; DestDir: {app}; AfterInstall: Touch('{app}\hg.exe.local')
 #if ARCH == "x64"
@@ -93,10 +92,13 @@ 
 
 [INI]
 Filename: {app}\Mercurial.url; Section: InternetShortcut; Key: URL; String: http://mercurial.selenic.com/
-Filename: {app}\Mercurial.ini; Section: web; Key: cacerts; String: {app}\cacert.pem
+Filename: {app}\default.d\editor.rc; Section: ui; Key: editor; String: notepad
+Filename: {app}\default.d\cacerts.rc; Section: web; Key: cacerts; String: {app}\cacert.pem
 
 [UninstallDelete]
 Type: files; Name: {app}\Mercurial.url
+Type: filesandordirs; Name: {app}\default.d
+Type: files; Name: "{app}\hg.exe.local"
 
 [Icons]
 Name: {group}\Uninstall Mercurial; Filename: {uninstallexe}
@@ -111,26 +113,7 @@ 
 [UninstallRun]
 Filename: "{app}\add_path.exe"; Parameters: "/del {app}"
 
-[UninstallDelete]
-Type: files; Name: "{app}\hg.exe.local"
-
 [Code]
-var
-  WriteFile: Boolean;
-  CheckDone: Boolean;
-
-function CheckFile(): Boolean;
-begin
-  if not CheckDone then begin
-    WriteFile := True;
-    if FileExists(ExpandConstant(CurrentFileName)) then begin
-        WriteFile := MsgBox('' + ExpandConstant(CurrentFileName) + '' #13#13 'The file already exists.' #13#13 'Would you like Setup to overwrite it?', mbConfirmation, MB_YESNO) = idYes;
-    end;
-    CheckDone := True;
-  end;
-  Result := WriteFile;
-end;
-
 procedure Touch(fn: String);
 begin
   SaveStringToFile(ExpandConstant(fn), '', False);