| OLD | NEW |
| 1 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2006-2009 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 os | 7 import os |
| 8 import re | 8 import re |
| 9 import shutil | 9 import shutil |
| 10 import subprocess | 10 import subprocess |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 previous_cwd = os.getcwd() | 614 previous_cwd = os.getcwd() |
| 615 root = os.path.join(root or SVN.GetCheckoutRoot(previous_cwd), '') | 615 root = os.path.join(root or SVN.GetCheckoutRoot(previous_cwd), '') |
| 616 def RelativePath(path, root): | 616 def RelativePath(path, root): |
| 617 """We must use relative paths.""" | 617 """We must use relative paths.""" |
| 618 if path.startswith(root): | 618 if path.startswith(root): |
| 619 return path[len(root):] | 619 return path[len(root):] |
| 620 return path | 620 return path |
| 621 try: | 621 try: |
| 622 os.chdir(root) | 622 os.chdir(root) |
| 623 diff = "".join(filter(None, | 623 diff = "".join(filter(None, |
| 624 [SVN.DiffItem(RelativePath(f, root, revision), | 624 [SVN.DiffItem(RelativePath(f, root), |
| 625 full_move=full_move) | 625 full_move=full_move, |
| 626 revision=revision) |
| 626 for f in filenames])) | 627 for f in filenames])) |
| 627 finally: | 628 finally: |
| 628 os.chdir(previous_cwd) | 629 os.chdir(previous_cwd) |
| 629 return diff | 630 return diff |
| 630 | 631 |
| 631 | 632 |
| 632 @staticmethod | 633 @staticmethod |
| 633 def GetEmail(repo_root): | 634 def GetEmail(repo_root): |
| 634 """Retrieves the svn account which we assume is an email address.""" | 635 """Retrieves the svn account which we assume is an email address.""" |
| 635 infos = SVN.CaptureInfo(repo_root) | 636 infos = SVN.CaptureInfo(repo_root) |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 if not cur_dir_repo_root: | 697 if not cur_dir_repo_root: |
| 697 return None | 698 return None |
| 698 | 699 |
| 699 while True: | 700 while True: |
| 700 parent = os.path.dirname(directory) | 701 parent = os.path.dirname(directory) |
| 701 if (SVN.CaptureInfo(parent, print_error=False).get( | 702 if (SVN.CaptureInfo(parent, print_error=False).get( |
| 702 "Repository Root") != cur_dir_repo_root): | 703 "Repository Root") != cur_dir_repo_root): |
| 703 break | 704 break |
| 704 directory = parent | 705 directory = parent |
| 705 return directory | 706 return directory |
| OLD | NEW |