Mercurial > public > mercurial-scm > hg
diff hgext/mq.py @ 7177:09ed32b79656
mq: Fix --qrefresh --short to work with --exclude and --include
pmezard expects
hg qref -s -X b
to apply the -X to the list of files in the patch, and thus remove b from the
patch.
That's how it worked before f7fc5f5ecd62. That change seemed sensible, but it
wasn't...
mpm says
(17:22:30) pmezard_: kiilerix1: do you mean that -X should be forbidden with -s ?
(17:22:54) pmezard_: kiilerix1: and --include too
(17:23:03) mpm: No because you should be able to say hg qref -s foo* -X foo-bar
so mpm expects
hg qref -s -X b *
to apply the -X to the list of files in the working directory, and thus don't
include b in the patch
This patch tries to make both usecases work by creating a matchfn which uses
the include/excludes but not the filelist.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Sun, 19 Oct 2008 16:31:24 +0200 |
parents | ce10a2f22258 |
children | f77c8d8331ca |
line wrap: on
line diff
--- a/hgext/mq.py Sun Oct 19 20:29:41 2008 +0200 +++ b/hgext/mq.py Sun Oct 19 16:31:24 2008 +0200 @@ -1076,7 +1076,6 @@ if opts.get('git'): self.diffopts().git = True - matchfn = cmdutil.match(repo, pats, opts) tip = repo.changelog.tip() if top == tip: # if the top of our patch queue is also the tip, there is an @@ -1086,7 +1085,7 @@ # changed to speed up the diff # # in short mode, we only diff the files included in the - # patch already + # patch already plus specified files # # this should really read: # mm, dd, aa, aa2 = repo.status(tip, patchparent)[:4] @@ -1097,10 +1096,13 @@ changes = repo.changelog.read(tip) man = repo.manifest.read(changes[0]) aaa = aa[:] + matchfn = cmdutil.match(repo, pats, opts) if opts.get('short'): - # if amending a patch, we always match already-in-patch files + # if amending a patch, we start with existing + # files plus specified files - unfiltered match = cmdutil.matchfiles(repo, mm + aa + dd + matchfn.files()) - matchfn = match # FIXME: Why have two matchers if we only need one? + # filter with inc/exl options + matchfn = cmdutil.match(repo, opts=opts) else: match = cmdutil.matchall(repo) m, a, r, d = repo.status(match=match)[:4]