[PATCH] mq: abort cleanly when invalid patch name is given to qguard

Christian Ebert blacktrash at gmx.net
Sat Mar 3 10:56:24 CST 2007


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1172940853 -3600
# Node ID 5f7590e2862b853ad5c4829d6f546b850ae28803
# Parent  ef7c39ae5d4c597db98a7ef4a42941e37a123e84
mq: abort cleanly when invalid patch name is given to qguard

diff -r ef7c39ae5d4c -r 5f7590e2862b hgext/mq.py
--- a/hgext/mq.py	Fri Mar 02 14:03:30 2007 -0800
+++ b/hgext/mq.py	Sat Mar 03 17:54:13 2007 +0100
@@ -1738,7 +1738,10 @@ def guard(ui, repo, *args, **opts):
     if patch is None:
         raise util.Abort(_('no patch to work with'))
     if args or opts['none']:
-        q.set_guards(q.find_series(patch), args)
+        idx = q.find_series(patch)
+        if idx is None:
+            raise util.Abort(_('no patch named %s') % patch)
+        q.set_guards(idx, args)
         q.save_dirty()
     else:
         status(q.series.index(q.lookup(patch)))




More information about the Mercurial-devel mailing list