Patchwork D7690: windows: don't return early from building the hgrc search path

login
register
mail settings
Submitter phabricator
Date Dec. 18, 2019, 3:49 a.m.
Message ID <differential-rev-PHID-DREV-z65bjwffmzyul3zuhl4t-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/43946/
State Superseded
Headers show

Comments

phabricator - Dec. 18, 2019, 3:49 a.m.
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This will minimize the changes needed to add other sources.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/scmwindows.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/scmwindows.py b/mercurial/scmwindows.py
--- a/mercurial/scmwindows.py
+++ b/mercurial/scmwindows.py
@@ -38,16 +38,15 @@ 
     value = util.lookupreg(
         b'SOFTWARE\\Mercurial', None, winreg.HKEY_LOCAL_MACHINE
     )
-    if not isinstance(value, bytes) or not value:
-        return rcpath
-    value = util.localpath(value)
-    for p in value.split(pycompat.ospathsep):
-        if p.lower().endswith(b'mercurial.ini'):
-            rcpath.append(p)
-        elif os.path.isdir(p):
-            for f, kind in util.listdir(p):
-                if f.endswith(b'.rc'):
-                    rcpath.append(os.path.join(p, f))
+    if value and isinstance(value, bytes):
+        value = util.localpath(value)
+        for p in value.split(pycompat.ospathsep):
+            if p.lower().endswith(b'mercurial.ini'):
+                rcpath.append(p)
+            elif os.path.isdir(p):
+                for f, kind in util.listdir(p):
+                    if f.endswith(b'.rc'):
+                        rcpath.append(os.path.join(p, f))
     return rcpath