[PATCH] test-check-code: prevent files being added to the root directory

Jun Wu quark at fb.com
Wed Mar 29 19:14:42 UTC 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1490814860 25200
#      Wed Mar 29 12:14:20 2017 -0700
# Node ID 4b4345a62fbd9fb0f4610d013c4ee5c9c06287e0
# Parent  cda83a1bfb3ac3a23cfa158c407be93755c1018e
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 4b4345a62fbd
test-check-code: prevent files being added to the root directory

Adding new files in the root directory is probably a mistake, and is usually
discouraged [1]. The test catches it to avoid mistakes like [2].

Modify the test if files need to be added in the root.

[1]: https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-July/086442.html
[2]: https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-March/095836.html

diff --git a/tests/test-check-code.t b/tests/test-check-code.t
--- a/tests/test-check-code.t
+++ b/tests/test-check-code.t
@@ -55,2 +55,19 @@ New errors are not allowed. Warnings are
   ...               'command is %s; expected %s' % (commands[i], command))
   ...         break
+
+Prevent adding new files in the root directory accidentally.
+
+  $ hg files 'glob:*'
+  .editorconfig
+  .hgignore
+  .hgsigs
+  .hgtags
+  CONTRIBUTING
+  CONTRIBUTORS
+  COPYING
+  Makefile
+  README
+  hg
+  hgeditor
+  hgweb.cgi
+  setup.py


More information about the Mercurial-devel mailing list