Patchwork D2231: narrow: fix for getting the username when running http server

login
register
mail settings
Submitter phabricator
Date Feb. 13, 2018, 9:07 p.m.
Message ID <929d30806cb0e7fcf34404fc3abf2429@localhost.localdomain>
Download mbox | patch
Permalink /patch/27847/
State Not Applicable
Headers show

Comments

phabricator - Feb. 13, 2018, 9:07 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG4224f26c0d35: narrow: fix for getting the username when running http server (authored by idlsoft, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2231?vs=5649&id=5653

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

AFFECTED FILES
  hgext/narrow/narrowbundle2.py

CHANGE DETAILS




To: idlsoft, #hg-reviewers, durin42
Cc: mercurial-devel

Patch

diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py
--- a/hgext/narrow/narrowbundle2.py
+++ b/hgext/narrow/narrowbundle2.py
@@ -327,13 +327,14 @@ 
             part.addparam('treemanifest', '1')
 
 def applyacl_narrow(repo, kwargs):
-    username = repo.ui.shortuser(repo.ui.username())
-    user_includes = repo.ui.configlist(
+    ui = repo.ui
+    username = ui.shortuser(ui.environ.get('REMOTE_USER') or ui.username())
+    user_includes = ui.configlist(
         _NARROWACL_SECTION, username + '.includes',
-        repo.ui.configlist(_NARROWACL_SECTION, 'default.includes'))
-    user_excludes = repo.ui.configlist(
+        ui.configlist(_NARROWACL_SECTION, 'default.includes'))
+    user_excludes = ui.configlist(
         _NARROWACL_SECTION, username + '.excludes',
-        repo.ui.configlist(_NARROWACL_SECTION, 'default.excludes'))
+        ui.configlist(_NARROWACL_SECTION, 'default.excludes'))
     if not user_includes:
         raise error.Abort(_("{} configuration for user {} is empty")
                           .format(_NARROWACL_SECTION, username))