Patchwork [1,of,2] run-tests: remove code that creates a dummy 'diffstat'

login
register
mail settings
Submitter Sean Farley
Date Nov. 16, 2013, 4:09 a.m.
Message ID <32b6b92916e9c4f0c5a0.1384574956@hit-nxdomain.opendns.com>
Download mbox | patch
Permalink /patch/2975/
State Accepted
Commit e13fed95c69b529e5192526da283525261face3c
Headers show

Comments

Sean Farley - Nov. 16, 2013, 4:09 a.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1384574168 18000
#      Fri Nov 15 22:56:08 2013 -0500
# Node ID 32b6b92916e9c4f0c5a0b9e40efcbecdb0b7afac
# Parent  c38c3fdc8b9317ba09e03ab09364c3800da7c50c
run-tests: remove code that creates a dummy 'diffstat'

This was introduced in fb1d7a42663c for an old test that is no longer the same.
Mads Kiilerich - Nov. 16, 2013, 3:57 p.m.
On 11/15/2013 11:09 PM, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley@gmail.com>
> # Date 1384574168 18000
> #      Fri Nov 15 22:56:08 2013 -0500
> # Node ID 32b6b92916e9c4f0c5a0b9e40efcbecdb0b7afac
> # Parent  c38c3fdc8b9317ba09e03ab09364c3800da7c50c
> run-tests: remove code that creates a dummy 'diffstat'
>
> This was introduced in fb1d7a42663c for an old test that is no longer the same.

+1

Another argument for this change is that this diffstat only was created 
when installing hg. It would thus not be created when running with 
--local - and nobody ever complained about that. Creating diffstat that 
way is "obviously" not correct ... and we don't know in which cases it 
would be necessary.

This diffstat command is something that also should be removed when 
exiting run-tests ... if it was created in all cases and not only when 
installing hg in a temp location.

/Mads

> diff --git a/tests/run-tests.py b/tests/run-tests.py
> --- a/tests/run-tests.py
> +++ b/tests/run-tests.py
> @@ -496,22 +496,10 @@
>           sys.exit(1)
>       os.chdir(TESTDIR)
>   
>       usecorrectpython()
>   
> -    vlog("# Installing dummy diffstat")
> -    f = open(os.path.join(BINDIR, 'diffstat'), 'w')
> -    f.write('#!' + sys.executable + '\n'
> -            'import sys\n'
> -            'files = 0\n'
> -            'for line in sys.stdin:\n'
> -            '    if line.startswith("diff "):\n'
> -            '        files += 1\n'
> -            'sys.stdout.write("files patched: %d\\n" % files)\n')
> -    f.close()
> -    os.chmod(os.path.join(BINDIR, 'diffstat'), 0700)
> -
>       if options.py3k_warnings and not options.anycoverage:
>           vlog("# Updating hg command to enable Py3k Warnings switch")
>           f = open(os.path.join(BINDIR, 'hg'), 'r')
>           lines = [line.rstrip() for line in f]
>           lines[0] += ' -3'
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -496,22 +496,10 @@ 
         sys.exit(1)
     os.chdir(TESTDIR)
 
     usecorrectpython()
 
-    vlog("# Installing dummy diffstat")
-    f = open(os.path.join(BINDIR, 'diffstat'), 'w')
-    f.write('#!' + sys.executable + '\n'
-            'import sys\n'
-            'files = 0\n'
-            'for line in sys.stdin:\n'
-            '    if line.startswith("diff "):\n'
-            '        files += 1\n'
-            'sys.stdout.write("files patched: %d\\n" % files)\n')
-    f.close()
-    os.chmod(os.path.join(BINDIR, 'diffstat'), 0700)
-
     if options.py3k_warnings and not options.anycoverage:
         vlog("# Updating hg command to enable Py3k Warnings switch")
         f = open(os.path.join(BINDIR, 'hg'), 'r')
         lines = [line.rstrip() for line in f]
         lines[0] += ' -3'