annotate tests/sitecustomize.py @ 29181:dae38633eba8 stable

localrepo: prevent executable-bit only changes from being lost on amend If you have just executable-bit change and amend it twice it will vanish: * After the first amend the commit will have the proper executable bit set in manifest but it won't have the the file on the list of files in changelog. * The second amend will read the wrong list of files from changelog and it will copy the manifest entry from parent for this file. * Voila! The change is lost. This change repairs the bug in localrepo causing this and adds a test for it.
author Mateusz Kwapich <mitrandir@fb.com>
date Thu, 19 May 2016 14:35:22 -0700
parents b12bda49c3e3
children d2c40510104e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28946
b12bda49c3e3 py3: use absolute_import in sitecustomize.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 24505
diff changeset
1 from __future__ import absolute_import
24505
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
2 import os
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
3
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
4 if os.environ.get('COVERAGE_PROCESS_START'):
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
5 try:
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
6 import coverage
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
7 import random
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
8
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
9 # uuid is better, but not available in Python 2.4.
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
10 covpath = os.path.join(os.environ['COVERAGE_DIR'],
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
11 'cov.%s' % random.randrange(0, 1000000000000))
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
12 cov = coverage.coverage(data_file=covpath, auto_data=True)
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
13 cov._warn_no_data = False
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
14 cov._warn_unimported_source = False
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
15 cov.start()
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
16 except ImportError:
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
17 pass