[PATCH 1 of 2 stable] fileset: add tests of generated working copy states

Yuya Nishihara yuya at tcha.org
Fri Jan 23 06:07:43 CST 2015


On Thu, 22 Jan 2015 14:21:27 -0800, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # 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.

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()'

Regards,


More information about the Mercurial-devel mailing list