| 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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 ErrorExit("Error accessing url %s" % request_path) | 595 ErrorExit("Error accessing url %s" % request_path) |
| 596 else: | 596 else: |
| 597 return None | 597 return None |
| 598 | 598 |
| 599 | 599 |
| 600 def GetIssueDescription(issue): | 600 def GetIssueDescription(issue): |
| 601 """Returns the issue description from Rietveld.""" | 601 """Returns the issue description from Rietveld.""" |
| 602 return SendToRietveld("/%d/description" % issue) | 602 return SendToRietveld("/%d/description" % issue) |
| 603 | 603 |
| 604 | 604 |
| 605 def Opened(): | 605 def Opened(show_unknown_files): |
| 606 """Prints a list of modified files in the current directory down.""" | 606 """Prints a list of modified files in the current directory down.""" |
| 607 files = GetModifiedFiles() | 607 files = GetModifiedFiles() |
| 608 cl_keys = files.keys() | 608 cl_keys = files.keys() |
| 609 cl_keys.sort() | 609 cl_keys.sort() |
| 610 for cl_name in cl_keys: | 610 for cl_name in cl_keys: |
| 611 if cl_name: | 611 if not cl_name: |
| 612 note = "" | 612 continue |
| 613 change_info = ChangeInfo.Load(cl_name, GetRepositoryRoot(), | 613 note = "" |
| 614 fail_on_not_found=True, update_status=False) | 614 change_info = ChangeInfo.Load(cl_name, GetRepositoryRoot(), |
| 615 if len(change_info.GetFiles()) != len(files[cl_name]): | 615 fail_on_not_found=True, update_status=False) |
| 616 note = " (Note: this changelist contains files outside this directory)" | 616 if len(change_info.GetFiles()) != len(files[cl_name]): |
| 617 print "\n--- Changelist " + cl_name + note + ":" | 617 note = " (Note: this changelist contains files outside this directory)" |
| 618 print "\n--- Changelist " + cl_name + note + ":" |
| 618 for file in files[cl_name]: | 619 for file in files[cl_name]: |
| 619 print "".join(file) | 620 print "".join(file) |
| 621 if show_unknown_files: |
| 622 unknown_files = UnknownFiles([]) |
| 623 if (files.get('') or (show_unknown_files and len(unknown_files))): |
| 624 print "\n--- Not in any changelist:" |
| 625 for file in files.get('', []): |
| 626 print "".join(file) |
| 627 if show_unknown_files: |
| 628 for file in unknown_files: |
| 629 print "? %s" % file |
| 620 | 630 |
| 621 | 631 |
| 622 def Help(argv=None): | 632 def Help(argv=None): |
| 623 if argv: | 633 if argv: |
| 624 if argv[0] == 'try': | 634 if argv[0] == 'try': |
| 625 TryChange(None, ['--help'], swallow_exception=False) | 635 TryChange(None, ['--help'], swallow_exception=False) |
| 626 return | 636 return |
| 627 if argv[0] == 'upload': | 637 if argv[0] == 'upload': |
| 628 upload.RealMain(['upload.py', '--help']) | 638 upload.RealMain(['upload.py', '--help']) |
| 629 return | 639 return |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 if os.path.isfile(file_path) and file != CODEREVIEW_SETTINGS_FILE: | 1160 if os.path.isfile(file_path) and file != CODEREVIEW_SETTINGS_FILE: |
| 1151 shutil.move(file_path, GetChangesDir()) | 1161 shutil.move(file_path, GetChangesDir()) |
| 1152 if not os.path.exists(GetCacheDir()): | 1162 if not os.path.exists(GetCacheDir()): |
| 1153 os.mkdir(GetCacheDir()) | 1163 os.mkdir(GetCacheDir()) |
| 1154 except gclient_utils.Error: | 1164 except gclient_utils.Error: |
| 1155 # Will throw an exception if not run in a svn checkout. | 1165 # Will throw an exception if not run in a svn checkout. |
| 1156 pass | 1166 pass |
| 1157 | 1167 |
| 1158 # Commands that don't require an argument. | 1168 # Commands that don't require an argument. |
| 1159 command = argv[1] | 1169 command = argv[1] |
| 1160 if command == "opened": | 1170 if command == "opened" or command == "status": |
| 1161 Opened() | 1171 Opened(command == "status") |
| 1162 return 0 | |
| 1163 if command == "status": | |
| 1164 Opened() | |
| 1165 print "\n--- Not in any changelist:" | |
| 1166 UnknownFiles([]) | |
| 1167 return 0 | 1172 return 0 |
| 1168 if command == "nothave": | 1173 if command == "nothave": |
| 1169 UnknownFiles(argv[2:]) | 1174 unknown_files = UnknownFiles(argv[2:]) |
| 1175 for file in unknown_files: |
| 1176 print "? " + "".join(file) |
| 1170 return 0 | 1177 return 0 |
| 1171 if command == "changes": | 1178 if command == "changes": |
| 1172 Changes() | 1179 Changes() |
| 1173 return 0 | 1180 return 0 |
| 1174 if command == "help": | 1181 if command == "help": |
| 1175 Help(argv[2:]) | 1182 Help(argv[2:]) |
| 1176 return 0 | 1183 return 0 |
| 1177 if command == "diff" and len(argv) == 2: | 1184 if command == "diff" and len(argv) == 2: |
| 1178 files = GetFilesNotInCL() | 1185 files = GetFilesNotInCL() |
| 1179 print GenerateDiff([x[1] for x in files]) | 1186 print GenerateDiff([x[1] for x in files]) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 # the files. This allows commands such as 'gcl diff xxx' to work. | 1248 # the files. This allows commands such as 'gcl diff xxx' to work. |
| 1242 args =["svn", command] | 1249 args =["svn", command] |
| 1243 root = GetRepositoryRoot() | 1250 root = GetRepositoryRoot() |
| 1244 args.extend([os.path.join(root, x) for x in change_info.GetFileNames()]) | 1251 args.extend([os.path.join(root, x) for x in change_info.GetFileNames()]) |
| 1245 RunShell(args, True) | 1252 RunShell(args, True) |
| 1246 return 0 | 1253 return 0 |
| 1247 | 1254 |
| 1248 | 1255 |
| 1249 if __name__ == "__main__": | 1256 if __name__ == "__main__": |
| 1250 sys.exit(main()) | 1257 sys.exit(main()) |
| OLD | NEW |