Infrastructure for current directory handling
[stgit] / stgit / main.py
index f54330d..15582dd 100644 (file)
@@ -252,6 +252,7 @@ def main():
     usage = command.usage.split('\n')[0].strip()
     parser = OptionParser(usage = usage, option_list = command.options)
     options, args = parser.parse_args()
+    directory = command.directory
 
     # These modules are only used from this point onwards and do not
     # need to be imported earlier
@@ -261,14 +262,13 @@ def main():
     from stgit.stack import Series
 
     try:
-        debug_level = int(os.environ['STGIT_DEBUG_LEVEL'])
-    except KeyError:
-        debug_level = 0
+        debug_level = int(os.environ.get('STGIT_DEBUG_LEVEL', 0))
     except ValueError:
         out.error('Invalid STGIT_DEBUG_LEVEL environment variable')
         sys.exit(1)
 
     try:
+        directory.setup()
         config_setup()
 
         # 'clone' doesn't expect an already initialised GIT tree. A Series