From patchwork Fri Jan 23 12:07:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1,of,2,stable] fileset: add tests of generated working copy states From: Yuya Nishihara X-Patchwork-Id: 7537 Message-Id: <20150123210743.5d777348624bb6d18dc0228f@tcha.org> To: Martin von Zweigbergk Cc: mercurial-devel@selenic.com Date: Fri, 23 Jan 2015 21:07:43 +0900 On Thu, 22 Jan 2015 14:21:27 -0800, Martin von Zweigbergk wrote: > # HG changeset patch > # User Martin von Zweigbergk > # Date 1421883624 28800 > # Wed Jan 21 15:40:24 2015 -0800 > # Branch stable > # Node ID 9e6464357f9dc8f145e30b0af89e3deb1bc5c2dd > # Parent a43fdf33a6beb697945a3dbb7253f0436ea278a6 > fileset: add tests of generated working copy states > +Test revert > + > +BROKEN: the files that get undeleted were not modified, they were removed, > +and content1_content2_missing-tracked was also not modified, it was deleted > + > + $ hg revert 'set:modified()' > + reverting content1_content1_content3-tracked > + reverting content1_content2_content1-tracked > + undeleting content1_content2_content1-untracked > + undeleting content1_content2_content2-untracked > + reverting content1_content2_content3-tracked > + undeleting content1_content2_content3-untracked > + reverting content1_content2_missing-tracked > + undeleting content1_content2_missing-untracked > + reverting missing_content2_content3-tracked > + > +BROKEN: only the files that get forgotten are correct > + > + $ hg revert 'set:added()' > + forgetting content1_missing_content1-tracked > + forgetting content1_missing_content3-tracked > + undeleting missing_content2_content2-untracked > + undeleting missing_content2_content3-untracked > + reverting missing_content2_missing-tracked > + undeleting missing_content2_missing-untracked > + forgetting missing_missing_content3-tracked > + > + $ hg revert 'set:removed()' > + undeleting content1_content1_content1-untracked > + undeleting content1_content1_content3-untracked > + undeleting content1_content1_missing-untracked > + > + $ hg revert 'set:deleted()' > + reverting content1_content1_missing-tracked > + forgetting content1_missing_missing-tracked > + forgetting missing_missing_missing-tracked > + > + $ hg revert 'set:unknown()' > + > + $ hg revert 'set:clean()' "revert" tests will have mostly undesired result due of issue4497, so I don't think it's worth adding them at this point. http://bz.selenic.com/show_bug.cgi?id=4497 I got many diffs with quick workaround for issue4497. Regards, diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2578,7 +2578,8 @@ def revert(ui, repo, ctx, parents, *pats return ui.warn("%s: %s\n" % (m.rel(path), msg)) - m = scmutil.match(ctx, pats, opts) + # XXX not work with largefiles, can't use 'set:**', etc. + m = scmutil.match(repo[None], pats, opts) m.bad = badfn for abs in ctx.walk(m): if abs not in names: diff --git a/tests/test-fileset-generated.t b/tests/test-fileset-generated.t --- a/tests/test-fileset-generated.t +++ b/tests/test-fileset-generated.t @@ -130,12 +130,7 @@ and content1_content2_missing-tracked wa $ hg revert 'set:modified()' reverting content1_content1_content3-tracked reverting content1_content2_content1-tracked - undeleting content1_content2_content1-untracked - undeleting content1_content2_content2-untracked reverting content1_content2_content3-tracked - undeleting content1_content2_content3-untracked - reverting content1_content2_missing-tracked - undeleting content1_content2_missing-untracked reverting missing_content2_content3-tracked BROKEN: only the files that get forgotten are correct @@ -143,20 +138,25 @@ BROKEN: only the files that get forgotte $ hg revert 'set:added()' forgetting content1_missing_content1-tracked forgetting content1_missing_content3-tracked - undeleting missing_content2_content2-untracked - undeleting missing_content2_content3-untracked - reverting missing_content2_missing-tracked - undeleting missing_content2_missing-untracked forgetting missing_missing_content3-tracked $ hg revert 'set:removed()' undeleting content1_content1_content1-untracked undeleting content1_content1_content3-untracked undeleting content1_content1_missing-untracked + undeleting content1_content2_content1-untracked + undeleting content1_content2_content2-untracked + undeleting content1_content2_content3-untracked + undeleting content1_content2_missing-untracked + undeleting missing_content2_content2-untracked + undeleting missing_content2_content3-untracked + undeleting missing_content2_missing-untracked $ hg revert 'set:deleted()' reverting content1_content1_missing-tracked + reverting content1_content2_missing-tracked forgetting content1_missing_missing-tracked + reverting missing_content2_missing-tracked forgetting missing_missing_missing-tracked $ hg revert 'set:unknown()'