qrecord: record complements commit, so qrecord should complement qnew
authorKirill Smelkov <kirr@mns.spb.ru>
Wed, 23 Jan 2008 21:49:39 +0300
changeset 5932 b014ff3fdaeb
parent 5931 6482d34974ac
child 5933 28a79c259fcf
qrecord: record complements commit, so qrecord should complement qnew Also there is an idea flying around to create something that will complement qrefresh: - maybe 'qammend'? or - 'qrefresh --interactive'? If we settle on '--interactive', then it would be conveniet to add this flag to 'commit' and 'qnew' as well.
hgext/record.py
--- a/hgext/record.py	Wed Jan 23 17:16:33 2008 +0100
+++ b/hgext/record.py	Wed Jan 23 21:49:39 2008 +0300
@@ -364,10 +364,10 @@
     dorecord(ui, repo, record_committer, *pats, **opts)
 
 
-def qrecord(ui, repo, *pats, **opts):
-    '''interactively select changes for qrefresh
+def qrecord(ui, repo, patch, *pats, **opts):
+    '''interactively record a new patch
 
-    see 'hg help record' for more information and usage
+    see 'hg help qnew' & 'hg help record' for more information and usage
     '''
 
     try:
@@ -376,8 +376,10 @@
         raise util.Abort(_("'mq' extension not loaded"))
 
     def qrecord_committer(ui, repo, pats, opts):
-        mq.refresh(ui, repo, *pats, **opts)
+        mq.new(ui, repo, patch, *pats, **opts)
 
+    opts = opts.copy()
+    opts['force'] = True    # always 'qnew -f'
     dorecord(ui, repo, qrecord_committer, *pats, **opts)
 
 
@@ -513,10 +515,10 @@
     "qrecord":
         (qrecord,
 
-         # add qrefresh options
-         mq.cmdtable['^qrefresh'][1],
+         # add qnew options, except '--force'
+         [opt for opt in mq.cmdtable['qnew'][1] if opt[1] != 'force'],
 
-         _('hg qrecord [OPTION]... [FILE]...')),
+         _('hg qrecord [OPTION]... PATCH [FILE]...')),
     }
 
     cmdtable.update(qcmdtable)