# HG changeset patch # User Brendan Cully # Date 1156896535 25200 # Node ID a4374f7331e467d5131aeb067ae7e1eee55a2356 # Parent d838bfac668d32040237905cb03d36c8cfeef333 Call patch.diff directly instead of printdiff - this also saves an extra walk of the working directory. diff -r d838bfac668d -r a4374f7331e4 hgext/mq.py --- a/hgext/mq.py Tue Aug 29 17:08:42 2006 -0700 +++ b/hgext/mq.py Tue Aug 29 17:08:55 2006 -0700 @@ -919,13 +919,13 @@ return 1 wlock = repo.wlock() self.check_toppatch(repo) - (top, patch) = (self.applied[-1].rev, self.applied[-1].name) + (top, patchfn) = (self.applied[-1].rev, self.applied[-1].name) top = revlog.bin(top) cparents = repo.changelog.parents(top) patchparent = self.qparents(repo, top) - message, comments, user, date, patchfound = self.readheaders(patch) + message, comments, user, date, patchfound = self.readheaders(patchfn) - patchf = self.opener(patch, "w") + patchf = self.opener(patchfn, "w") msg = opts.get('msg', '').rstrip() if msg: if comments: @@ -995,8 +995,9 @@ r = list(util.unique(dd)) a = list(util.unique(aa)) filelist = filter(matchfn, util.unique(m + r + a)) - self.printdiff(repo, patchparent, files=filelist, - changes=(m, a, r, [], u), fp=patchf) + patch.diff(repo, patchparent, files=filelist, match=matchfn, + fp=patchf, changes=(m, a, r, [], u), + opts=self.diffopts()) patchf.close() changes = repo.changelog.read(tip) @@ -1019,7 +1020,7 @@ if not msg: if not message: - message = "patch queue: %s\n" % patch + message = "patch queue: %s\n" % patchfn else: message = "\n".join(message) else: @@ -1027,7 +1028,7 @@ self.strip(repo, top, update=False, backup='strip', wlock=wlock) n = repo.commit(filelist, message, changes[1], force=1, wlock=wlock) - self.applied[-1] = statusentry(revlog.hex(n), patch) + self.applied[-1] = statusentry(revlog.hex(n), patchfn) self.applied_dirty = 1 else: self.printdiff(repo, patchparent, fp=patchf) diff -r d838bfac668d -r a4374f7331e4 tests/test-mq --- a/tests/test-mq Tue Aug 29 17:08:42 2006 -0700 +++ b/tests/test-mq Tue Aug 29 17:08:55 2006 -0700 @@ -126,6 +126,27 @@ hg strip tip 2>&1 | sed 's/\(saving bundle to \).*/\1/' hg unbundle .hg/strip-backup/* +echo '% cd b; hg qrefresh' +hg init refresh +cd refresh +echo a > a +hg ci -Ama -d'0 0' +hg qnew -mfoo foo +echo a >> a +hg qrefresh +mkdir b +cd b +echo f > f +hg add f +hg qrefresh +sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ + -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo +echo % hg qrefresh . +hg qrefresh . +sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ + -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo +hg status + cat >>$HGRCPATH <