mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
Add commands.debugconfig.
This lets us both view the actual config data that hg is using, and drive editors that need to see this information.
This commit is contained in:
parent
de1873f73e
commit
c575ae97dc
@ -597,6 +597,13 @@ def debugcheckstate(ui, repo):
|
||||
if errors:
|
||||
raise util.Abort(".hg/dirstate inconsistent with current parent's manifest")
|
||||
|
||||
def debugconfig(ui):
|
||||
try:
|
||||
repo = hg.repository(ui)
|
||||
except: pass
|
||||
for section, name, value in ui.walkconfig():
|
||||
ui.write('%s.%s=%s\n' % (section, name, value))
|
||||
|
||||
def debugstate(ui, repo):
|
||||
"""show the contents of the current dirstate"""
|
||||
repo.dirstate.read()
|
||||
@ -1308,6 +1315,7 @@ table = {
|
||||
'hg commit [OPTION]... [FILE]...'),
|
||||
"copy": (copy, [], 'hg copy SOURCE DEST'),
|
||||
"debugcheckstate": (debugcheckstate, [], 'debugcheckstate'),
|
||||
"debugconfig": (debugconfig, [], 'debugconfig'),
|
||||
"debugstate": (debugstate, [], 'debugstate'),
|
||||
"debugindex": (debugindex, [], 'debugindex FILE'),
|
||||
"debugindexdot": (debugindexdot, [], 'debugindexdot FILE'),
|
||||
@ -1446,7 +1454,7 @@ globalopts = [('v', 'verbose', None, 'verbose mode'),
|
||||
('', 'time', None, 'time how long the command takes'),
|
||||
]
|
||||
|
||||
norepo = "clone init version help debugindex debugindexdot paths"
|
||||
norepo = "clone init version help debugconfig debugindex debugindexdot paths"
|
||||
|
||||
def find(cmd):
|
||||
for e in table.keys():
|
||||
|
@ -52,6 +52,17 @@ class ui:
|
||||
return self.cdata.items(section)
|
||||
return []
|
||||
|
||||
def walkconfig(self):
|
||||
seen = {}
|
||||
for (section, name), value in self.overlay.iteritems():
|
||||
yield section, name, value
|
||||
seen[section, name] = 1
|
||||
for section in self.cdata.sections():
|
||||
for name, value in self.cdata.items(section):
|
||||
if (section, name) in seen: continue
|
||||
yield section, name, value.replace('\n', '\\n')
|
||||
seen[section, name] = 1
|
||||
|
||||
def username(self):
|
||||
return (os.environ.get("HGUSER") or
|
||||
self.config("ui", "username") or
|
||||
|
Loading…
Reference in New Issue
Block a user