changeset 486:c9aab7092af1

python/hgrc.py
author Jeff Hammel <jhammel@mozilla.com>
date Sat, 10 Aug 2013 21:13:42 -0700
parents e192c235d5d6
children 178419da6e0b
files python/hgrc.py
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/python/hgrc.py	Sat Aug 10 21:05:48 2013 -0700
+++ b/python/hgrc.py	Sat Aug 10 21:13:42 2013 -0700
@@ -21,18 +21,19 @@
     def __init__(self, section_name, *section_names):
         self.sections = [section_name]
         self.sections.extend(section_names)
-    def __call__(self, parser):
+    def __call__(self, function):
         def wrapped(parser, *args, **kwargs):
             for section in self.sections:
                 if section not in parser.sections():
                     parser.add_section(section)
-            f(*args, **kwargs)
+            function(parser, *args, **kwargs)
         return wrapped
 
 #@parser # decorator makes this x-form path -> ConfigParser automagically
 @section('paths')
 def set_default(parser, default):
     """set [paths]:default"""
+    print 'OIOIOIOI!'
 
 @section('paths')
 def set_default_push(parser, default_push):
@@ -176,7 +177,7 @@
     print_ini = actions.pop('print_ini', None)
 
     # alter .hgrc files
-    for action_name, parameter in actions:
+    for action_name, parameter in actions.items():
 
         # XXX crappy
         method = action_map[action_name]
@@ -187,10 +188,10 @@
         for path, ini in config.items():
 
             # call method with parser
-            if parameter is not None:
+            if parameter is None:
+                method(ini)
+            else:
                 method(ini, parameter)
-            else:
-                method(ini)
 
     # print .hgrc files, if specified
     if print_ini: