Actually when the user commits a file into their local repository I need to update come information into those files automatically like for example: version string, for this I use pre-commit hooks.
To update the version string first I need to take the current version of the file from already existing file in bitbucket remote branch. Of Couse I should not take the current version for the file in my local repository since other users could have done some changes and pushed the same file.
To get the file in bitbucket remote branch I wrote a small python script using 'requests' module. So when the file exists in remote branch it returns me the raw content of the file. When the file does not exists it returns status code 404(page not found) . So I assumed that file does not exists! I think this is not the reliable way to say file does not exists in the branch. Is there a reliable way to check if the file exists in the remote branch or not ?