Patchwork D7981: packaging: rename hgrc.d to defaultrc for Windows config files next to the exe

login
register
mail settings
Submitter phabricator
Date Jan. 24, 2020, 6:43 a.m.
Message ID <differential-rev-PHID-DREV-ppizosi5ldnxyhk2mk4s-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/44599/
State Superseded
Headers show

Comments

phabricator - Jan. 24, 2020, 6:43 a.m.
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The code and the help still says that it will read hgrc.d next to the
  executable.  But this directory needs to exist to read the resource based config
  files.  Otherwise even `hg version` errors out:
  
    $ /c/Program\ Files/Mercurial/hg.exe version
    Traceback (most recent call last):
      File "hg", line 43, in <module>
      File "mercurial\dispatch.pyc", line 110, in run
      File "mercurial\dispatch.pyc", line 226, in dispatch
      File "mercurial\ui.pyc", line 308, in load
      File "mercurial\rcutil.pyc", line 99, in rccomponents
      File "mercurial\rcutil.pyc", line 69, in default_rc_resources
      File "mercurial\utils\resourceutil.pyc", line 84, in contents
    WindowsError: [Error 3] The system cannot find the path specified: 'c:\\Program Files\\mercurial\\defaultrc\\*.*'

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7981

AFFECTED FILES
  contrib/packaging/hgpackaging/py2exe.py
  contrib/packaging/hgpackaging/wix.py
  contrib/packaging/inno/mercurial.iss
  contrib/packaging/wix/mercurial.wxs

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-devel
phabricator - Jan. 24, 2020, 6:53 a.m.
mharbison72 added a comment.


  I left out the hgrc.d references in these places, because they seem to reference global hgrc.d, and not the one next to the executable.
  
  - contrib/plan9/proto
  - contrib/plan9/mkfile
  - contrib/packaging/debian/rules
  - contrib/packaging/mercurial.spec
  
  I think we still need to figure out if we need to update the documentation to reference the new resource directory, and/or drop the hgrc.d next to the executable.  But these changes at least let `hg version` and `hg config` run.  I didn't go about disabling all of the other config files that get read in after these default config files.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7981/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7981

To: mharbison72, #hg-reviewers
Cc: mercurial-devel
phabricator - Jan. 24, 2020, 6:54 a.m.
mharbison72 added a comment.
mharbison72 added subscribers: indygreg, martinvonz.


  CC @indygreg and @martinvonz because it's really late and I have no idea if I'm missing something.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7981/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7981

To: mharbison72, #hg-reviewers
Cc: martinvonz, indygreg, mercurial-devel

Patch

diff --git a/contrib/packaging/wix/mercurial.wxs b/contrib/packaging/wix/mercurial.wxs
--- a/contrib/packaging/wix/mercurial.wxs
+++ b/contrib/packaging/wix/mercurial.wxs
@@ -99,7 +99,7 @@ 
         <ComponentRef Id='MainExecutable' />
         <ComponentRef Id='ProgramMenuDir' />
         <ComponentGroupRef Id="hg.group.ROOT" />
-        <ComponentGroupRef Id="hg.group.hgrc.d" />
+        <ComponentGroupRef Id="hg.group.defaultrc" />
         <ComponentGroupRef Id="hg.group.helptext" />
         <ComponentGroupRef Id="hg.group.lib" />
         <ComponentGroupRef Id="hg.group.templates" />
diff --git a/contrib/packaging/inno/mercurial.iss b/contrib/packaging/inno/mercurial.iss
--- a/contrib/packaging/inno/mercurial.iss
+++ b/contrib/packaging/inno/mercurial.iss
@@ -51,7 +51,7 @@ 
 
 [UninstallDelete]
 Type: files; Name: {app}\Mercurial.url
-Type: filesandordirs; Name: {app}\hgrc.d
+Type: filesandordirs; Name: {app}\defaultrc
 
 [Icons]
 Name: {group}\Uninstall Mercurial; Filename: {uninstallexe}
diff --git a/contrib/packaging/hgpackaging/wix.py b/contrib/packaging/hgpackaging/wix.py
--- a/contrib/packaging/hgpackaging/wix.py
+++ b/contrib/packaging/hgpackaging/wix.py
@@ -37,7 +37,7 @@ 
 
 EXTRA_INSTALL_RULES = [
     ('contrib/packaging/wix/COPYING.rtf', 'COPYING.rtf'),
-    ('contrib/win32/mercurial.ini', 'hgrc.d/mercurial.rc'),
+    ('contrib/win32/mercurial.ini', 'defaultrc/mercurial.rc'),
 ]
 
 STAGING_REMOVE_FILES = [
diff --git a/contrib/packaging/hgpackaging/py2exe.py b/contrib/packaging/hgpackaging/py2exe.py
--- a/contrib/packaging/hgpackaging/py2exe.py
+++ b/contrib/packaging/hgpackaging/py2exe.py
@@ -45,7 +45,7 @@ 
     ('doc/*.html', 'doc/'),
     ('doc/style.css', 'doc/'),
     ('mercurial/helptext/**/*.txt', 'helptext/'),
-    ('mercurial/defaultrc/*.rc', 'hgrc.d/'),
+    ('mercurial/defaultrc/*.rc', 'defaultrc/'),
     ('mercurial/locale/**/*', 'locale/'),
     ('mercurial/templates/**/*', 'Templates/'),
     ('COPYING', 'Copying.txt'),
@@ -232,7 +232,7 @@ 
 
     # Write out a default editor.rc file to configure notepad as the
     # default editor.
-    with (staging_dir / 'hgrc.d' / 'editor.rc').open(
+    with (staging_dir / 'defaultrc' / 'editor.rc').open(
         'w', encoding='utf-8'
     ) as fh:
         fh.write('[ui]\neditor = notepad\n')