changeset 36200:4224f26c0d35

narrow: fix for getting the username when running http server Differential Revision: https://phab.mercurial-scm.org/D2231
author Sandu Turcan <idlsoft@gmail.com>
date Tue, 13 Feb 2018 14:39:02 -0500
parents 48797b21882e
children 068f520754ca
files hgext/narrow/narrowbundle2.py
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/narrow/narrowbundle2.py	Mon Feb 12 16:22:31 2018 -0800
+++ b/hgext/narrow/narrowbundle2.py	Tue Feb 13 14:39:02 2018 -0500
@@ -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))