halcanary | ffe5400 | 2016-03-29 09:09:29 -0700 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | # Copyright 2016 Google Inc. |
| 3 | # |
| 4 | # Use of this source code is governed by a BSD-style license that can be |
| 5 | # found in the LICENSE file. |
| 6 | |
| 7 | import os |
| 8 | import sys |
| 9 | |
| 10 | milestone_file = 'include/core/SkMilestone.h' |
| 11 | |
| 12 | usage = ''' |
| 13 | usage: |
| 14 | git fetch |
Ravi Mistry | e5be65e | 2021-05-20 16:01:33 -0400 | [diff] [blame] | 15 | git checkout -b change_milestone origin/main |
halcanary | ffe5400 | 2016-03-29 09:09:29 -0700 | [diff] [blame] | 16 | python %s MILESTONE_NUMBER |
| 17 | git add %s |
| 18 | git commit -m "Update Skia milestone." |
| 19 | git cl land |
| 20 | |
| 21 | ''' |
| 22 | try: |
| 23 | milestone = int(sys.argv[1]) |
| 24 | assert milestone > 0 |
| 25 | except (IndexError, ValueError, AssertionError): |
| 26 | sys.stderr.write(usage % (sys.argv[0], milestone_file)) |
| 27 | exit(1) |
| 28 | |
| 29 | text = '''/* |
| 30 | * Copyright 2016 Google Inc. |
| 31 | * |
| 32 | * Use of this source code is governed by a BSD-style license that can be |
| 33 | * found in the LICENSE file. |
| 34 | */ |
| 35 | #ifndef SK_MILESTONE |
| 36 | #define SK_MILESTONE %d |
| 37 | #endif |
| 38 | ''' |
| 39 | |
| 40 | os.chdir(os.path.join(os.path.dirname(__file__), os.pardir)) |
| 41 | |
| 42 | with open(milestone_file, 'w') as o: |
| 43 | o.write(text % milestone) |
| 44 | |
| 45 | with open(milestone_file, 'r') as f: |
| 46 | sys.stdout.write(f.read()) |