| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2009 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 # Wrapper script around Rietveld's upload.py that groups files into | 6 # Wrapper script around Rietveld's upload.py that groups files into |
| 7 # changelists. | 7 # changelists. |
| 8 | 8 |
| 9 import getpass | 9 import getpass |
| 10 import os | 10 import os |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 description = split_data[2] | 524 description = split_data[2] |
| 525 save = False | 525 save = False |
| 526 if update_status: | 526 if update_status: |
| 527 for file in files: | 527 for file in files: |
| 528 filename = os.path.join(GetRepositoryRoot(), file[1]) | 528 filename = os.path.join(GetRepositoryRoot(), file[1]) |
| 529 status_result = GetSVNStatus(filename) | 529 status_result = GetSVNStatus(filename) |
| 530 if not status_result or not status_result[0][0]: | 530 if not status_result or not status_result[0][0]: |
| 531 # File has been reverted. | 531 # File has been reverted. |
| 532 save = True | 532 save = True |
| 533 files.remove(file) | 533 files.remove(file) |
| 534 elif status != file[0]: | 534 continue |
| 535 status = status_result[0][0] |
| 536 if status != file[0]: |
| 535 save = True | 537 save = True |
| 536 files[files.index(file)] = (status, file[1]) | 538 files[files.index(file)] = (status, file[1]) |
| 537 change_info = ChangeInfo(changename, issue, description, files) | 539 change_info = ChangeInfo(changename, issue, description, files) |
| 538 if save: | 540 if save: |
| 539 change_info.Save() | 541 change_info.Save() |
| 540 return change_info | 542 return change_info |
| 541 | 543 |
| 542 | 544 |
| 543 def GetCLs(): | 545 def GetCLs(): |
| 544 """Returns a list of all the changelists in this repository.""" | 546 """Returns a list of all the changelists in this repository.""" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 previous_cwd = os.getcwd() | 743 previous_cwd = os.getcwd() |
| 742 if root is None: | 744 if root is None: |
| 743 os.chdir(GetRepositoryRoot()) | 745 os.chdir(GetRepositoryRoot()) |
| 744 else: | 746 else: |
| 745 os.chdir(root) | 747 os.chdir(root) |
| 746 | 748 |
| 747 diff = [] | 749 diff = [] |
| 748 for file in files: | 750 for file in files: |
| 749 # Use svn info output instead of os.path.isdir because the latter fails | 751 # Use svn info output instead of os.path.isdir because the latter fails |
| 750 # when the file is deleted. | 752 # when the file is deleted. |
| 751 if GetSVNFileInfo(file).get("Node Kind") == "directory": | 753 if GetSVNFileInfo(file).get("Node Kind") in ("dir", "directory"): |
| 752 continue | 754 continue |
| 753 # If the user specified a custom diff command in their svn config file, | 755 # If the user specified a custom diff command in their svn config file, |
| 754 # then it'll be used when we do svn diff, which we don't want to happen | 756 # then it'll be used when we do svn diff, which we don't want to happen |
| 755 # since we want the unified diff. Using --diff-cmd=diff doesn't always | 757 # since we want the unified diff. Using --diff-cmd=diff doesn't always |
| 756 # work, since they can have another diff executable in their path that | 758 # work, since they can have another diff executable in their path that |
| 757 # gives different line endings. So we use a bogus temp directory as the | 759 # gives different line endings. So we use a bogus temp directory as the |
| 758 # config directory, which gets around these problems. | 760 # config directory, which gets around these problems. |
| 759 if sys.platform.startswith("win"): | 761 if sys.platform.startswith("win"): |
| 760 parent_dir = tempfile.gettempdir() | 762 parent_dir = tempfile.gettempdir() |
| 761 else: | 763 else: |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1182 # the files. This allows commands such as 'gcl diff xxx' to work. | 1184 # the files. This allows commands such as 'gcl diff xxx' to work. |
| 1183 args =["svn", command] | 1185 args =["svn", command] |
| 1184 root = GetRepositoryRoot() | 1186 root = GetRepositoryRoot() |
| 1185 args.extend([os.path.join(root, x) for x in change_info.FileList()]) | 1187 args.extend([os.path.join(root, x) for x in change_info.FileList()]) |
| 1186 RunShell(args, True) | 1188 RunShell(args, True) |
| 1187 return 0 | 1189 return 0 |
| 1188 | 1190 |
| 1189 | 1191 |
| 1190 if __name__ == "__main__": | 1192 if __name__ == "__main__": |
| 1191 sys.exit(main()) | 1193 sys.exit(main()) |
| OLD | NEW |