Changeset View
Changeset View
Standalone View
Standalone View
contrib/buildbot/phabricator_wrapper.py
Show First 20 Lines • Show All 383 Lines • ▼ Show 20 Lines | def get_file_content_from_master(self, path): | ||||
BITCOIN_ABC_REPO, | BITCOIN_ABC_REPO, | ||||
data, | data, | ||||
)) | )) | ||||
# Browse the parent directory to extract the file hash. | # Browse the parent directory to extract the file hash. | ||||
# Use a Diffusion browsequery on the parent directory because the | # Use a Diffusion browsequery on the parent directory because the | ||||
# API will fail if a filename is given. If path is not set the root | # API will fail if a filename is given. If path is not set the root | ||||
# directory is browsed. | # directory is browsed. | ||||
# Since https://secure.phabricator.com/D21519 the browsequery endpoint | |||||
# will return an empty result if the trailing slash is missing from the | |||||
# searched path. There is an exception for the root directory for which | |||||
# the '/' path is invalid and will throw an error. | |||||
browse_data = self.diffusion.browsequery( | browse_data = self.diffusion.browsequery( | ||||
path=os.path.dirname(path) or None, | path=os.path.join(os.path.dirname(path), '') or None, | ||||
commit=latest_commit_hash, | commit=latest_commit_hash, | ||||
repository=BITCOIN_ABC_REPO, | repository=BITCOIN_ABC_REPO, | ||||
branch="master", | branch="master", | ||||
) | ) | ||||
# No file in the directory | # No file in the directory | ||||
if not browse_data or 'paths' not in browse_data: | if not browse_data or 'paths' not in browse_data: | ||||
file_not_found("diffusion.browsequery returned no path data") | file_not_found("diffusion.browsequery returned no path data") | ||||
▲ Show 20 Lines • Show All 127 Lines • Show Last 20 Lines |