| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """ | 6 """ |
| 7 mass-rename: update source files (gyp lists, #includes) to reflect | 7 mass-rename: update source files (gyp lists, #includes) to reflect |
| 8 a rename. Expects "git diff --cached -M" to list a bunch of renames. | 8 a rename. Expects "git diff --cached -M" to list a bunch of renames. |
| 9 | 9 |
| 10 To use: | 10 To use: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 shell=True, stdout=subprocess.PIPE) | 27 shell=True, stdout=subprocess.PIPE) |
| 28 out, _ = popen.communicate() | 28 out, _ = popen.communicate() |
| 29 if popen.returncode != 0: | 29 if popen.returncode != 0: |
| 30 return 1 | 30 return 1 |
| 31 for line in out.splitlines(): | 31 for line in out.splitlines(): |
| 32 parts = line.split('\t') | 32 parts = line.split('\t') |
| 33 if len(parts) != 3: | 33 if len(parts) != 3: |
| 34 print 'Skipping: %s -- not a rename?' % parts | 34 print 'Skipping: %s -- not a rename?' % parts |
| 35 continue | 35 continue |
| 36 attrs, fro, to = parts | 36 attrs, fro, to = parts |
| 37 print fro # JAMES |
| 37 if attrs.split()[4].startswith('R'): | 38 if attrs.split()[4].startswith('R'): |
| 38 subprocess.check_call([ | 39 subprocess.check_call([ |
| 39 sys.executable, | 40 sys.executable, |
| 40 os.path.join(BASE_DIR, 'move_source_file.py'), | 41 os.path.join(BASE_DIR, 'move_source_file.py'), |
| 41 '--already_moved', | 42 '--already_moved', |
| 42 '--no_error_for_non_source_file', | 43 '--no_error_for_non_source_file', |
| 43 fro, to]) | 44 fro, to]) |
| 44 else: | 45 else: |
| 45 print 'Skipping: %s -- not a rename?' % fro | 46 print 'Skipping: %s -- not a rename?' % fro |
| 46 return 0 | 47 return 0 |
| 47 | 48 |
| 48 | 49 |
| 49 if __name__ == '__main__': | 50 if __name__ == '__main__': |
| 50 sys.exit(main()) | 51 sys.exit(main()) |
| OLD | NEW |