Use git-rev-parse to find the local GIT repository
[stgit] / stgit / commands / export.py
index c04ecc5..b33c9ea 100644 (file)
@@ -78,6 +78,7 @@ def func(parser, options, args):
     series = file(os.path.join(dirname, 'series'), 'w+')
 
     applied = crt_series.get_applied()
+    unapplied = crt_series.get_unapplied()
 
     if options.range:
         boundaries = options.range.split(':')
@@ -99,11 +100,18 @@ def func(parser, options, args):
         if start in applied:
             start_idx = applied.index(start)
         else:
-            raise CmdException, 'Patch "%s" not applied' % start
+            if start in unapplied:
+                raise CmdException, 'Patch "%s" not applied' % start
+            else:
+                raise CmdException, 'Patch "%s" does not exist' % start
+
         if stop in applied:
             stop_idx = applied.index(stop) + 1
         else:
-            raise CmdException, 'Patch "%s" not applied' % stop
+            if stop in unapplied:
+                raise CmdException, 'Patch "%s" not applied' % stop
+            else:
+                raise CmdException, 'Patch "%s" does not exist' % stop
 
         if start_idx >= stop_idx:
             raise CmdException, 'Incorrect patch range order'
@@ -124,7 +132,7 @@ def func(parser, options, args):
     else:
         patch_tmpl_list = []
 
-    patch_tmpl_list += [os.path.join(git.base_dir, 'patchexport.tmpl'),
+    patch_tmpl_list += [os.path.join(git.get_base_dir(), 'patchexport.tmpl'),
                         os.path.join(sys.prefix,
                                      'share/stgit/templates/patchexport.tmpl')]
     tmpl = ''