##// END OF EJS Templates
py3: use encoding.environ in ui.py...
Pulkit Goyal -
r30277:e9fca89c default
parent child Browse files
Show More
@@ -22,6 +22,7 b' from .node import hex'
22
22
23 from . import (
23 from . import (
24 config,
24 config,
25 encoding,
25 error,
26 error,
26 formatter,
27 formatter,
27 progress,
28 progress,
@@ -569,9 +570,11 b' class ui(object):'
569 - False if HGPLAIN is not set, or feature is in HGPLAINEXCEPT
570 - False if HGPLAIN is not set, or feature is in HGPLAINEXCEPT
570 - True otherwise
571 - True otherwise
571 '''
572 '''
572 if 'HGPLAIN' not in os.environ and 'HGPLAINEXCEPT' not in os.environ:
573 if ('HGPLAIN' not in encoding.environ and
574 'HGPLAINEXCEPT' not in encoding.environ):
573 return False
575 return False
574 exceptions = os.environ.get('HGPLAINEXCEPT', '').strip().split(',')
576 exceptions = encoding.environ.get('HGPLAINEXCEPT',
577 '').strip().split(',')
575 if feature and exceptions:
578 if feature and exceptions:
576 return feature not in exceptions
579 return feature not in exceptions
577 return True
580 return True
@@ -584,13 +587,13 b' class ui(object):'
584 If not found and ui.askusername is True, ask the user, else use
587 If not found and ui.askusername is True, ask the user, else use
585 ($LOGNAME or $USER or $LNAME or $USERNAME) + "@full.hostname".
588 ($LOGNAME or $USER or $LNAME or $USERNAME) + "@full.hostname".
586 """
589 """
587 user = os.environ.get("HGUSER")
590 user = encoding.environ.get("HGUSER")
588 if user is None:
591 if user is None:
589 user = self.config("ui", ["username", "user"])
592 user = self.config("ui", ["username", "user"])
590 if user is not None:
593 if user is not None:
591 user = os.path.expandvars(user)
594 user = os.path.expandvars(user)
592 if user is None:
595 if user is None:
593 user = os.environ.get("EMAIL")
596 user = encoding.environ.get("EMAIL")
594 if user is None and self.configbool("ui", "askusername"):
597 if user is None and self.configbool("ui", "askusername"):
595 user = self.prompt(_("enter a commit username:"), default=None)
598 user = self.prompt(_("enter a commit username:"), default=None)
596 if user is None and not self.interactive():
599 if user is None and not self.interactive():
@@ -814,9 +817,9 b' class ui(object):'
814 def termwidth(self):
817 def termwidth(self):
815 '''how wide is the terminal in columns?
818 '''how wide is the terminal in columns?
816 '''
819 '''
817 if 'COLUMNS' in os.environ:
820 if 'COLUMNS' in encoding.environ:
818 try:
821 try:
819 return int(os.environ['COLUMNS'])
822 return int(encoding.environ['COLUMNS'])
820 except ValueError:
823 except ValueError:
821 pass
824 pass
822 return util.termwidth()
825 return util.termwidth()
@@ -1075,10 +1078,10 b' class ui(object):'
1075 editor = 'E'
1078 editor = 'E'
1076 else:
1079 else:
1077 editor = 'vi'
1080 editor = 'vi'
1078 return (os.environ.get("HGEDITOR") or
1081 return (encoding.environ.get("HGEDITOR") or
1079 self.config("ui", "editor") or
1082 self.config("ui", "editor") or
1080 os.environ.get("VISUAL") or
1083 encoding.environ.get("VISUAL") or
1081 os.environ.get("EDITOR", editor))
1084 encoding.environ.get("EDITOR", editor))
1082
1085
1083 @util.propertycache
1086 @util.propertycache
1084 def _progbar(self):
1087 def _progbar(self):
General Comments 0
You need to be logged in to leave comments. Login now