OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """SCM-specific utility classes.""" | 5 """SCM-specific utility classes.""" |
6 | 6 |
7 import cStringIO | 7 import cStringIO |
8 import glob | 8 import glob |
9 import logging | 9 import logging |
10 import os | 10 import os |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 ["diff", "--internal-diff"]) | 790 ["diff", "--internal-diff"]) |
791 else: | 791 else: |
792 # On svn < 1.7, the "--internal-diff" flag doesn't exist. Using | 792 # On svn < 1.7, the "--internal-diff" flag doesn't exist. Using |
793 # --diff-cmd=diff doesn't always work, since e.g. Windows cmd users may | 793 # --diff-cmd=diff doesn't always work, since e.g. Windows cmd users may |
794 # not have a "diff" executable in their path at all. So we use an empty | 794 # not have a "diff" executable in their path at all. So we use an empty |
795 # temporary directory as the config directory, which bypasses any user | 795 # temporary directory as the config directory, which bypasses any user |
796 # settings for the diff-cmd. | 796 # settings for the diff-cmd. |
797 bogus_dir = tempfile.mkdtemp() | 797 bogus_dir = tempfile.mkdtemp() |
798 try: | 798 try: |
799 return SVN._GenerateDiffInternal(filenames, cwd, full_move, revision, | 799 return SVN._GenerateDiffInternal(filenames, cwd, full_move, revision, |
800 ["diff", "--config-dir", bogus_dir]) | 800 ["diff", "--config_dir", bogus_dir]) |
801 finally: | 801 finally: |
802 gclient_utils.RemoveDirectory(bogus_dir) | 802 gclient_utils.RemoveDirectory(bogus_dir) |
803 | 803 |
804 @staticmethod | 804 @staticmethod |
805 def _GenerateDiffInternal(filenames, cwd, full_move, revision, diff_command): | 805 def _GenerateDiffInternal(filenames, cwd, full_move, revision, diff_command): |
806 root = os.path.normcase(os.path.join(cwd, '')) | 806 root = os.path.normcase(os.path.join(cwd, '')) |
807 def RelativePath(path, root): | 807 def RelativePath(path, root): |
808 """We must use relative paths.""" | 808 """We must use relative paths.""" |
809 if os.path.normcase(path).startswith(root): | 809 if os.path.normcase(path).startswith(root): |
810 return path[len(root):] | 810 return path[len(root):] |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 # revert, like for properties. | 1078 # revert, like for properties. |
1079 if not os.path.isdir(cwd): | 1079 if not os.path.isdir(cwd): |
1080 # '.' was deleted. It's not worth continuing. | 1080 # '.' was deleted. It's not worth continuing. |
1081 return | 1081 return |
1082 try: | 1082 try: |
1083 SVN.Capture(['revert', file_status[1]], cwd=cwd) | 1083 SVN.Capture(['revert', file_status[1]], cwd=cwd) |
1084 except subprocess2.CalledProcessError: | 1084 except subprocess2.CalledProcessError: |
1085 if not os.path.exists(file_path): | 1085 if not os.path.exists(file_path): |
1086 continue | 1086 continue |
1087 raise | 1087 raise |
OLD | NEW |