Store branch description in the config file
[stgit] / stgit / main.py
index 49089e6..1a1f534 100644 (file)
@@ -68,6 +68,7 @@ commands = Commands({
     'clean':            'clean',
     'clone':            'clone',
     'commit':           'commit',
+    'cp':              'copy',
     'export':           'export',
     'files':            'files',
     'float':            'float',
@@ -92,6 +93,7 @@ commands = Commands({
     'rm':               'rm',
     'series':           'series',
     'show':             'show',
+    'sink':             'sink',
     'status':           'status',
     'sync':             'sync',
     'top':              'top',
@@ -102,28 +104,30 @@ commands = Commands({
 
 # classification: repository, stack, patch, working copy
 repocommands = (
-    'branch',
     'clone',
     'id',
-    'pull'
     )
 stackcommands = (
     'applied',
     'assimilate',
+    'branch',
     'clean',
     'commit',
     'float',
     'goto',
     'hide',
     'init',
+    'patches',
     'pop',
+    'pull',
     'push',
     'rebase',
     'series',
+    'sink',
     'top',
     'unapplied',
     'uncommit',
-    'unhide'
+    'unhide',
     )
 patchcommands = (
     'delete',
@@ -138,15 +142,15 @@ patchcommands = (
     'refresh',
     'rename',
     'show',
-    'sync'
+    'sync',
     )
 wccommands = (
     'add',
+    'cp',
     'diff',
-    'patches',
     'resolved',
     'rm',
-    'status'
+    'status',
     )
 
 def _print_helpstring(cmd):
@@ -256,6 +260,15 @@ def main():
     from stgit.git import GitException
     from stgit.commands.common import CmdException
     from stgit.gitmergeonefile import GitMergeException
+    from stgit.utils import EditorException
+
+    try:
+        debug_level = int(os.environ['STGIT_DEBUG_LEVEL'])
+    except KeyError:
+        debug_level = 0
+    except ValueError:
+        print >> sys.stderr, 'Invalid STGIT_DEBUG_LEVEL environment variable'
+        sys.exit(1)
 
     try:
         config_setup()
@@ -271,9 +284,13 @@ def main():
 
         command.func(parser, options, args)
     except (IOError, ParsingError, NoSectionError, CmdException,
-            StackException, GitException, GitMergeException), err:
+            StackException, GitException, GitMergeException,
+            EditorException), err:
         print >> sys.stderr, '%s %s: %s' % (prog, cmd, err)
-        sys.exit(2)
+        if debug_level:
+            raise
+        else:
+            sys.exit(2)
     except KeyboardInterrupt:
         sys.exit(1)