Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.

Commit 0452255

Browse files
committed
prefix to help fix paths, codecov/support#472
1 parent 15a6b15 commit 0452255

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

codecov/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ def main(*argv, **kwargs):
223223
advanced.add_argument('-X', '--disable', nargs="*", default=[], help="Disable features. Accepting **search** to disable crawling through directories, **detect** to disable detecting CI provider, **gcov** disable gcov commands, `pycov` disables running python `coverage xml`, **fix** to disable report adjustments http://bit.ly/1O4eBpt")
224224
advanced.add_argument('--root', default=None, help="Project directory. Default: current direcory or provided in CI environment variables")
225225
advanced.add_argument('--commit', '-c', default=None, help="Commit SHA, set automatically")
226+
advanced.add_argument('--prefix', '-P', default=None, help="Prefix network paths to help resolve paths: https://github.com/codecov/support/issues/472")
226227
advanced.add_argument('--branch', '-b', default=None, help="Branch name")
227228
advanced.add_argument('--build', default=None, help="Specify a custom build number to distinguish CI jobs, provided automatically for supported CI companies")
228229
advanced.add_argument('--pr', default=None, help="Specify a custom pr number, provided automatically for supported CI companies")
@@ -563,6 +564,13 @@ def main(*argv, **kwargs):
563564
try_to_run('cd %s && hg locate' % root) or
564565
try_to_run('hg locate') or '').strip())
565566

567+
if codecov.prefix:
568+
prefix = codecov.prefix.strip('/')
569+
toc = '{}/{}'.format(
570+
prefix,
571+
toc.replace('\n', '\n{}/'.format(prefix))
572+
)
573+
566574
# Detect codecov.yml location
567575
yaml_location = re.search(
568576
r'\.?codecov\.ya?ml$',

tests/test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,11 @@ def test_disable_search(self):
204204
else:
205205
raise Exception("Did not raise AssertionError")
206206

207+
def test_prefix(self):
208+
self.fake_report()
209+
res = self.run_cli(prefix='/foo/bar/', dump=True, token='a', branch='b', commit='c')
210+
assert '\nfoo/bar/.gitignore' in res['reports']
211+
207212
def write_c(self):
208213
c = '\n'.join(('#include <stdio.h>',
209214
'static int t = 1;'

0 commit comments

Comments
 (0)