1 # vim: set ts=8 sts=4 et sw=4 tw=99:
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 def get_all_toplevel_filenames():
9 '''Get a list of all the files in the (Mercurial or Git) repository.'''
12 cmd
= ['hg', 'manifest', '-q']
13 all_filenames
= subprocess
.check_output(cmd
, universal_newlines
=True,
14 stderr
=subprocess
.PIPE
).split('\n')
17 failed_cmds
.append(cmd
)
20 # Get the relative path to the top-level directory.
21 cmd
= ['git', 'rev-parse', '--show-cdup']
22 top_level
= subprocess
.check_output(cmd
, universal_newlines
=True,
23 stderr
=subprocess
.PIPE
).split('\n')[0]
24 cmd
= ['git', 'ls-files', '--full-name', top_level
]
25 all_filenames
= subprocess
.check_output(cmd
, universal_newlines
=True,
26 stderr
=subprocess
.PIPE
).split('\n')
29 failed_cmds
.append(cmd
)
31 raise Exception('failed to run any of the repo manifest commands', failed_cmds
)