# HG changeset patch # User Idan Kamara # Date 2011-05-24 16:17:02 # Node ID 4eb88d296f6374c8de122b4f79d86e1d3e3c973e # Parent 7230aef66b7c340f4c23c21e787b3e4c119001e0 record: check patch name is valid before prompting in qrecord diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -892,7 +892,8 @@ class queue(object): if date: date = util.parsedate(date) diffopts = self.diffopts({'git': opts.get('git')}) - self.checkpatchname(patchfn) + if opts.get('checkname', True): + self.checkpatchname(patchfn) inclsubs = self.check_substate(repo) if inclsubs: inclsubs.append('.hgsubstate') diff --git a/hgext/record.py b/hgext/record.py --- a/hgext/record.py +++ b/hgext/record.py @@ -389,7 +389,10 @@ def qrecord(ui, repo, patch, *pats, **op except KeyError: raise util.Abort(_("'mq' extension not loaded")) + repo.mq.checkpatchname(patch) + def committomq(ui, repo, *pats, **opts): + opts['checkname'] = False mq.new(ui, repo, patch, *pats, **opts) dorecord(ui, repo, committomq, 'qnew', *pats, **opts) diff --git a/tests/test-qrecord.t b/tests/test-qrecord.t --- a/tests/test-qrecord.t +++ b/tests/test-qrecord.t @@ -219,6 +219,12 @@ Whole diff someone up +qrecord with bad patch name, should abort before prompting + + $ hg qrecord .hg + abort: patch name cannot begin with ".hg" + [255] + qrecord a.patch $ hg qrecord -d '0 0' -m aaa a.patch <