[PATCH 1 of 2] qrecord: record complements commit, so qrecord should complement qnew

Kirill Smelkov kirr at mns.spb.ru
Wed Jan 23 13:00:55 CST 2008


# HG changeset patch
# User Kirill Smelkov <kirr at mns.spb.ru>
# Date 1201114179 -10800
# Node ID b014ff3fdaebe2d74d0ad7e0fba9d39a6fc17849
# Parent  6482d34974ac3cad16c5e9527eecc4eb25c5b9fe
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.

diff --git a/hgext/record.py b/hgext/record.py
--- a/hgext/record.py
+++ b/hgext/record.py
@@ -364,10 +364,10 @@ def record(ui, repo, *pats, **opts):
     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 @@ def qrecord(ui, repo, *pats, **opts):
         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 @@ def extsetup():
     "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)


More information about the Mercurial-devel mailing list