Mercurial > hg-stable
changeset 14422:2e77525e52d9
mq: wrap patch file name checks in a function
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Tue, 24 May 2011 19:16:51 +0300 |
parents | 639f26cab2f5 |
children | 7230aef66b7c |
files | hgext/mq.py |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Tue May 24 13:30:10 2011 -0500 +++ b/hgext/mq.py Tue May 24 19:16:51 2011 +0300 @@ -873,6 +873,14 @@ 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: