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

Ryan McElroy rm at fb.com
Thu Mar 30 04:24:38 EDT 2017



On 3/29/17 8:14 PM, Jun Wu wrote:
> # 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
> test-check-code: prevent files being added to the root directory

This looks good to me. Marked as pre-reviewed in patchwork.

> 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://urldefense.proofpoint.com/v2/url?u=https-3A__www.mercurial-2Dscm.org_pipermail_mercurial-2Ddevel_2016-2DJuly_086442.html&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=Jw8rundaE7TbmqBYd1txIQ&m=7_IYmz-lrpqA1zpgDDo4EeVrvcwTfaFdAiVidGqOBWY&s=xA-QLqFwEuB9rS_dq7YumUvHY2zl3rwx0hZWq4lVgxQ&e=
> [2]: https://urldefense.proofpoint.com/v2/url?u=https-3A__www.mercurial-2Dscm.org_pipermail_mercurial-2Ddevel_2017-2DMarch_095836.html&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=Jw8rundaE7TbmqBYd1txIQ&m=7_IYmz-lrpqA1zpgDDo4EeVrvcwTfaFdAiVidGqOBWY&s=KUM_-mbWo_TeA41nPw9KKJrrcbuK9jFLugGhN9B7fEY&e=

OMG I hate proofpoint. I want it to die in a fire. This is why I always 
remove the footers and the "available at" URLs haha.

>
> 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