diff hgext/mq.py @ 7113:f7fc5f5ecd62

mq: Allow qrefresh --silent to take parameters 'hg qrefresh --short file.txt' now adds changes made to file.txt to current patch. This builds on a patch for implementing --amend by Kirill Smelkov as discussed in issue933. FIXME: Why do mq refresh have two matchers if we only need one?
author Mads Kiilerich <mads@kiilerich.com>
date Fri, 17 Oct 2008 21:26:39 +0200
parents 07c8396fa001
children 88f1b8081f1c
line wrap: on
line diff
--- a/hgext/mq.py	Sat Oct 18 03:53:54 2008 -0500
+++ b/hgext/mq.py	Fri Oct 17 21:26:39 2008 +0200
@@ -1073,7 +1073,9 @@
                 man = repo.manifest.read(changes[0])
                 aaa = aa[:]
                 if opts.get('short'):
-                    match = cmdutil.matchfiles(repo, mm + aa + dd)
+                    # if amending a patch, we always match already-in-patch files
+                    match = cmdutil.matchfiles(repo, mm + aa + dd + matchfn.files())
+                    matchfn = match # FIXME: Why have two matchers if we only need one?
                 else:
                     match = cmdutil.matchall(repo)
                 m, a, r, d = repo.status(match=match)[:4]
@@ -1750,6 +1752,9 @@
     the modifications that match those patterns; the remaining modifications
     will remain in the working directory.
 
+    If --short is specified, files currently included in the patch will 
+    be refreshed just like matched files and remain in the patch.
+
     hg add/remove/copy/rename work as usual, though you might want to use
     git-style patches (--git or [diff] git=1) to track copies and renames.
     """
@@ -2411,7 +2416,7 @@
         (refresh,
          [('e', 'edit', None, _('edit commit message')),
           ('g', 'git', None, _('use git extended diff format')),
-          ('s', 'short', None, _('refresh only files already in the patch')),
+          ('s', 'short', None, _('refresh only files already in the patch and specified files')),
           ('U', 'currentuser', None, _('add/update "From: <current user>" in patch')),
           ('u', 'user', '', _('add/update "From: <given user>" in patch')),
           ('D', 'currentdate', None, _('update "Date: <current date>" in patch (if present)')),