Patchwork test-check-code: prevent files being added to the root directory

login
register
mail settings
Submitter Jun Wu
Date March 29, 2017, 7:14 p.m.
Message ID <4b4345a62fbd9fb0f461.1490814882@x1c>
Download mbox | patch
Permalink /patch/19823/
State Accepted
Headers show

Comments

Jun Wu - March 29, 2017, 7:14 p.m.
# HG changeset patch
# User Jun Wu <quark@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
Ryan McElroy - March 30, 2017, 8:24 a.m.
On 3/29/17 8:14 PM, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark@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
Jun Wu - March 30, 2017, 5:18 p.m.
Excerpts from Ryan McElroy's message of 2017-03-30 09:24:38 +0100:
> On 3/29/17 8:14 PM, Jun Wu wrote:
> > # HG changeset patch
> > # User Jun Wu <quark@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://www.mercurial-scm.org/pipermail/mercurial-devel/2016-July/086442.html
> > [2]: https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-March/095836.html
> 
> 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.

I didn't see proofpoint?

This is an advertisement of sup [1].

[1]: https://github.com/quark-zju/sup/
Yuya Nishihara - March 31, 2017, 2:46 p.m.
On Wed, 29 Mar 2017 12:14:42 -0700, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark@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

Queued, thanks.

Patch

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