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 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 if sys.platform.startswith("win"): | 666 if sys.platform.startswith("win"): |
667 parent_dir = tempfile.gettempdir() | 667 parent_dir = tempfile.gettempdir() |
668 else: | 668 else: |
669 parent_dir = sys.path[0] # tempdir is not secure. | 669 parent_dir = sys.path[0] # tempdir is not secure. |
670 bogus_dir = os.path.join(parent_dir, "temp_svn_config") | 670 bogus_dir = os.path.join(parent_dir, "temp_svn_config") |
671 if not os.path.exists(bogus_dir): | 671 if not os.path.exists(bogus_dir): |
672 os.mkdir(bogus_dir) | 672 os.mkdir(bogus_dir) |
673 output = RunShell(["svn", "diff", "--config-dir", bogus_dir, file]) | 673 output = RunShell(["svn", "diff", "--config-dir", bogus_dir, file]) |
674 if output: | 674 if output: |
675 diff.append(output) | 675 diff.append(output) |
676 # On Posix platforms, svn diff on a mv/cp'd file outputs nothing. | 676 elif IsSVNMoved(file): |
677 # We put in an empty Index entry so upload.py knows about them. | 677 # svn diff on a mv/cp'd file outputs nothing. |
678 elif not sys.platform.startswith("win") and IsSVNMoved(file): | 678 # We put in an empty Index entry so upload.py knows about them. |
679 diff.append("\nIndex: %s\n" % file) | 679 diff.append("\nIndex: %s\n" % file) |
| 680 else: |
| 681 # The file is not modified anymore. It should be removed from the set. |
| 682 pass |
680 os.chdir(previous_cwd) | 683 os.chdir(previous_cwd) |
681 return "".join(diff) | 684 return "".join(diff) |
682 | 685 |
683 | 686 |
684 def UploadCL(change_info, args): | 687 def UploadCL(change_info, args): |
685 if not change_info.FileList(): | 688 if not change_info.FileList(): |
686 print "Nothing to upload, changelist is empty." | 689 print "Nothing to upload, changelist is empty." |
687 return | 690 return |
688 | 691 |
689 if not "--no_presubmit" in args: | 692 if not "--no_presubmit" in args: |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 # the files. This allows commands such as 'gcl diff xxx' to work. | 1092 # the files. This allows commands such as 'gcl diff xxx' to work. |
1090 args =["svn", command] | 1093 args =["svn", command] |
1091 root = GetRepositoryRoot() | 1094 root = GetRepositoryRoot() |
1092 args.extend([os.path.join(root, x) for x in change_info.FileList()]) | 1095 args.extend([os.path.join(root, x) for x in change_info.FileList()]) |
1093 RunShell(args, True) | 1096 RunShell(args, True) |
1094 return 0 | 1097 return 0 |
1095 | 1098 |
1096 | 1099 |
1097 if __name__ == "__main__": | 1100 if __name__ == "__main__": |
1098 sys.exit(main()) | 1101 sys.exit(main()) |
OLD | NEW |