Mercurial > hg
changeset 5830:c32d41affb68
hg qrecord -- like record, but for mq
I'm a former Darcs user, and I've discovered that it is very convenient to
actually perform development using MQ first, and only when the patches are
'ready' move them to project's history in stone.
Usually I work on some topic, temporarily forgetting about any version control,
and just do coding, experimenting, debugging, etc.
After some time, I approach a moment, where my work should actually go to
patches/commits, and here is the problem::
As it is now, there is no way to put part of the changes into one patch,
and another part of the changes into second patch.
This works, but only when changes are touching separate files, and for
semantically different changes touching the same file(s) there is now
pretty way to put them into separate patches.
For some time, I've tolerated the pain to run vim patches/... and move hunks
between files by hand, but I think this affects my productivity badly.
So, here is the first step towards untiing the problem:
Let's use 'hg qrecord' for mq, like we use 'hg record' for usual commits!
author | Kirill Smelkov <kirr@mns.spb.ru> |
---|---|
date | Thu, 10 Jan 2008 12:07:18 +0300 |
parents | 784073457a0f |
children | 4a40b7066525 e52383c7e7ab |
files | hgext/record.py |
diffstat | 1 files changed, 45 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/record.py Thu Jan 10 12:07:18 2008 +0300 +++ b/hgext/record.py Thu Jan 10 12:07:18 2008 +0300 @@ -5,10 +5,10 @@ # This software may be used and distributed according to the terms of # the GNU General Public License, incorporated herein by reference. -'''interactive change selection during commit''' +'''interactive change selection during commit or qrefresh''' from mercurial.i18n import _ -from mercurial import cmdutil, commands, cmdutil, hg, mdiff, patch, revlog +from mercurial import cmdutil, commands, cmdutil, extensions, hg, mdiff, patch, revlog from mercurial import util import copy, cStringIO, errno, operator, os, re, shutil, tempfile @@ -358,10 +358,27 @@ ? - display help''' - def record_commiter(ui, repo, pats, opts): + def record_committer(ui, repo, pats, opts): commands.commit(ui, repo, *pats, **opts) - dorecord(ui, repo, record_commiter, *pats, **opts) + dorecord(ui, repo, record_committer, *pats, **opts) + + +def qrecord(ui, repo, *pats, **opts): + '''interactively select changes for qrefresh + + see 'hg help record' for more information and usage + ''' + + try: + mq = extensions.find('mq') + except KeyError: + raise util.Abort(_("'mq' extension not loaded")) + + def qrecord_committer(ui, repo, pats, opts): + mq.refresh(ui, repo, *pats, **opts) + + dorecord(ui, repo, qrecord_committer, *pats, **opts) def dorecord(ui, repo, committer, *pats, **opts): @@ -478,8 +495,29 @@ cmdtable = { "record": (record, - [('A', 'addremove', None, - _('mark new/missing files as added/removed before committing')), - ] + commands.walkopts + commands.commitopts + commands.commitopts2, + + # add commit options + commands.table['^commit|ci'][1], + _('hg record [OPTION]... [FILE]...')), } + + +def extsetup(): + try: + mq = extensions.find('mq') + except KeyError: + return + + qcmdtable = { + "qrecord": + (qrecord, + + # add qrefresh options + mq.cmdtable['^qrefresh'][1], + + _('hg qrecord [OPTION]... [FILE]...')), + } + + cmdtable.update(qcmdtable) +