# HG changeset patch # User Alexis S. L. Carvalho # Date 1173575003 10800 # Node ID 7307d2e98b322ed80a07aad758225a4ced2a6305 # Parent b36bd7534c08eba29307d13e57eceb55c7ea7afd fix qrefresh'ing an empty patch This is not superefficient (the commit will have to walk the whole tree), but it works. diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -1015,10 +1015,10 @@ class queue: m = util.unique(mm) r = util.unique(dd) a = util.unique(aa) - filelist = filter(matchfn, util.unique(m + r + a)) + c = [filter(matchfn, l) for l in (m, a, r, [], u)] + filelist = util.unique(c[0] + c[1] + c[2]) patch.diff(repo, patchparent, files=filelist, match=matchfn, - fp=patchf, changes=(m, a, r, [], u), - opts=self.diffopts()) + fp=patchf, changes=c, opts=self.diffopts()) patchf.close() repo.dirstate.setparents(*cparents) @@ -1066,7 +1066,8 @@ class queue: message = msg self.strip(repo, top, update=False, backup='strip', wlock=wlock) - n = repo.commit(filelist, message, changes[1], force=1, wlock=wlock) + n = repo.commit(filelist, message, changes[1], match=matchfn, + force=1, wlock=wlock) self.applied[-1] = statusentry(revlog.hex(n), patchfn) self.applied_dirty = 1 else: diff --git a/tests/test-mq b/tests/test-mq --- a/tests/test-mq +++ b/tests/test-mq @@ -55,6 +55,18 @@ sed -e "s/^\(diff -r \)\([a-f0-9]* \)/\1 -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/test.patch +echo % empty qrefresh + +hg qrefresh -X a +echo 'revision:' +hg diff -r -2 -r -1 +echo 'patch:' +cat .hg/patches/test.patch +echo 'working dir diff:' +hg diff --nodates -q +# restore things +hg qrefresh + echo % qpop hg qpop diff --git a/tests/test-mq.out b/tests/test-mq.out --- a/tests/test-mq.out +++ b/tests/test-mq.out @@ -71,6 +71,17 @@ diff -r xa @@ -1,1 +1,2 @@ a a +a +% empty qrefresh +revision: +patch: +foo bar + +working dir diff: +--- a/a ++++ b/a +@@ -1,1 +1,2 @@ a + a ++a % qpop Patch queue now empty % qpush