567 |
568 |
568 The return value can either be |
569 The return value can either be |
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 |
578 |
581 |
579 def username(self): |
582 def username(self): |
582 Searched in this order: $HGUSER, [ui] section of hgrcs, $EMAIL |
585 Searched in this order: $HGUSER, [ui] section of hgrcs, $EMAIL |
583 and stop searching if one of these is set. |
586 and stop searching if one of these is set. |
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(): |
597 try: |
600 try: |
598 user = '%s@%s' % (util.getuser(), socket.getfqdn()) |
601 user = '%s@%s' % (util.getuser(), socket.getfqdn()) |
1073 # instead default to E to plumb commit messages to |
1076 # instead default to E to plumb commit messages to |
1074 # avoid confusion. |
1077 # avoid confusion. |
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): |
1085 """setup the progbar singleton to the ui object""" |
1088 """setup the progbar singleton to the ui object""" |
1086 if (self.quiet or self.debugflag |
1089 if (self.quiet or self.debugflag |