changeset 14424:4eb88d296f63

record: check patch name is valid before prompting in qrecord
author Idan Kamara <idankk86@gmail.com>
date Tue, 24 May 2011 19:17:02 +0300
parents 7230aef66b7c
children e89534504fb9
files hgext/mq.py hgext/record.py tests/test-qrecord.t
diffstat 3 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Tue May 24 19:16:51 2011 +0300
+++ b/hgext/mq.py	Tue May 24 19:17:02 2011 +0300
@@ -892,7 +892,8 @@
         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')
--- a/hgext/record.py	Tue May 24 19:16:51 2011 +0300
+++ b/hgext/record.py	Tue May 24 19:17:02 2011 +0300
@@ -389,7 +389,10 @@
     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)
--- a/tests/test-qrecord.t	Tue May 24 19:16:51 2011 +0300
+++ b/tests/test-qrecord.t	Tue May 24 19:17:02 2011 +0300
@@ -219,6 +219,12 @@
    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 <<EOF