# HG changeset patch # User Idan Kamara # Date 2011-05-24 16:16:51 # Node ID 2e77525e52d99cf5e0b65e635e3af64650886512 # Parent 639f26cab2f5776d93ab33c3a92c9f88b03e5f2b mq: wrap patch file name checks in a function diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -873,6 +873,14 @@ class queue(object): raise util.Abort(_('"%s" cannot be used in the name of a patch') % c) + def checkpatchname(self, name, force=False): + self.check_reserved_name(name) + if not force and os.path.exists(self.join(name)): + if os.path.isdir(self.join(name)): + raise util.Abort(_('"%s" already exists as a directory') + % name) + else: + raise util.Abort(_('patch "%s" already exists') % name) def new(self, repo, patchfn, *pats, **opts): """options: