Created
October 30, 2014 10:00
-
-
Save sergio-bershadsky/79afb7bc36e223d37da0 to your computer and use it in GitHub Desktop.
Simple script to track changes in repository
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import subprocess | |
| DIR = os.path.dirname(os.path.abspath(__file__)) | |
| PYTHON = os.path.normpath(os.path.join(DIR, '../', 'env', 'bin', 'python')) | |
| UPDATE_SCRIPT = os.path.normpath(os.path.join(DIR, 'update.py')) | |
| GIT_HEAD = ['git', 'rev-list', 'HEAD', '--count'] | |
| GIT_PULL = ['git', 'pull'] | |
| UPDATE = [PYTHON, UPDATE_SCRIPT] | |
| if __name__ == "__main__": | |
| before_pull = subprocess.check_output(GIT_HEAD) | |
| subprocess.call(GIT_PULL) | |
| after_pull = subprocess.check_output(GIT_HEAD) | |
| if before_pull != after_pull: | |
| subprocess.call(UPDATE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment