changeset 3186:245bb70d7dfb

mq: raise util.Abort instead of using sys.exit(1)
author Brendan Cully <brendan@kublai.com>
date Thu, 28 Sep 2006 11:41:33 -0700
parents b3e103c388fc
children fca5ddbaa12a
files hgext/mq.py
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Wed Sep 27 14:50:20 2006 -0700
+++ b/hgext/mq.py	Thu Sep 28 11:41:33 2006 -0700
@@ -803,11 +803,9 @@
             wlock = repo.wlock()
         patch = self.lookup(patch)
         if patch and self.isapplied(patch):
-            self.ui.warn(_("patch %s is already applied\n") % patch)
-            sys.exit(1)
+            raise util.Abort(_("patch %s is already applied") % patch)
         if self.series_end() == len(self.series):
-            self.ui.warn(_("patch series fully applied\n"))
-            sys.exit(1)
+            raise util.Abort(_("patch series fully applied"))
         if not force:
             self.check_localchanges(repo)
 
@@ -857,8 +855,7 @@
             if not info:
                 raise util.Abort(_("patch %s is not applied") % patch)
         if len(self.applied) == 0:
-            self.ui.warn(_("no patches applied\n"))
-            sys.exit(1)
+            raise util.Abort(_("no patches applied"))
 
         if not update:
             parents = repo.dirstate.parents()
@@ -1378,6 +1375,9 @@
         end = q.series.index(patch) + 1
     else:
         end = len(q.applied)
+    if not end:
+        return
+
     return q.qseries(repo, length=end, status='A', summary=opts.get('summary'))
 
 def unapplied(ui, repo, patch=None, **opts):