Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/ui.py @ 1071:8f0ac653f85e
Add support for extension modules
This adds support for an [extensions] section to hgrc. This has the form of:
[extensions]
mod=[path]
If a path is specified, the python module found at that path is load.
Otherwise, __import__ is used to find the module.
Each module must implement a dict called cmdtable where the command line
options for that module live. Each module must also implement a reposetup
function:
cmdtable = {}
def reposetup(ui, repo): pass
Index: hg/mercurial/ui.py
===================================================================
author | mason@suse.com |
---|---|
date | Fri, 26 Aug 2005 14:05:52 -0700 |
parents | 6d5a62a549fa |
children | ee4f60abad93 |
comparison
equal
deleted
inserted
replaced
1070:b55c6685c953 | 1071:8f0ac653f85e |
---|---|
20 self.quiet = self.configbool("ui", "quiet") | 20 self.quiet = self.configbool("ui", "quiet") |
21 self.verbose = self.configbool("ui", "verbose") | 21 self.verbose = self.configbool("ui", "verbose") |
22 self.debugflag = self.configbool("ui", "debug") | 22 self.debugflag = self.configbool("ui", "debug") |
23 self.interactive = self.configbool("ui", "interactive", True) | 23 self.interactive = self.configbool("ui", "interactive", True) |
24 | 24 |
25 self.updateopts(verbose, debug, quiet, interactive) | |
26 | |
27 def updateopts(self, verbose=False, debug=False, quiet=False, | |
28 interactive=True): | |
25 self.quiet = (self.quiet or quiet) and not verbose and not debug | 29 self.quiet = (self.quiet or quiet) and not verbose and not debug |
26 self.verbose = (self.verbose or verbose) or debug | 30 self.verbose = (self.verbose or verbose) or debug |
27 self.debugflag = (self.debugflag or debug) | 31 self.debugflag = (self.debugflag or debug) |
28 self.interactive = (self.interactive and interactive) | 32 self.interactive = (self.interactive and interactive) |
29 | 33 |
60 for section in self.cdata.sections(): | 64 for section in self.cdata.sections(): |
61 for name, value in self.cdata.items(section): | 65 for name, value in self.cdata.items(section): |
62 if (section, name) in seen: continue | 66 if (section, name) in seen: continue |
63 yield section, name, value.replace('\n', '\\n') | 67 yield section, name, value.replace('\n', '\\n') |
64 seen[section, name] = 1 | 68 seen[section, name] = 1 |
69 | |
70 def extensions(self): | |
71 return self.configitems("extensions") | |
65 | 72 |
66 def username(self): | 73 def username(self): |
67 return (os.environ.get("HGUSER") or | 74 return (os.environ.get("HGUSER") or |
68 self.config("ui", "username") or | 75 self.config("ui", "username") or |
69 os.environ.get("EMAIL") or | 76 os.environ.get("EMAIL") or |