# HG changeset patch # User Bryan O'Sullivan # Date 1124857812 25200 # Node ID 25e7ea0f2cfffc0f1c75456c10261d7c67649204 # Parent cb31576ed3e4aeedfb144280354ab0bf48634c55 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. diff -r cb31576ed3e4 -r 25e7ea0f2cff mercurial/commands.py --- a/mercurial/commands.py Tue Aug 23 16:46:10 2005 -0700 +++ b/mercurial/commands.py Tue Aug 23 21:30:12 2005 -0700 @@ -597,6 +597,13 @@ 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 @@ '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 @@ ('', '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(): diff -r cb31576ed3e4 -r 25e7ea0f2cff mercurial/ui.py --- a/mercurial/ui.py Tue Aug 23 16:46:10 2005 -0700 +++ b/mercurial/ui.py Tue Aug 23 21:30:12 2005 -0700 @@ -52,6 +52,17 @@ 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