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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 break | 655 break |
656 values[key] = value | 656 values[key] = value |
657 return values | 657 return values |
658 | 658 |
659 @staticmethod | 659 @staticmethod |
660 def GetCheckoutRoot(directory): | 660 def GetCheckoutRoot(directory): |
661 """Returns the top level directory of the current repository. | 661 """Returns the top level directory of the current repository. |
662 | 662 |
663 The directory is returned as an absolute path. | 663 The directory is returned as an absolute path. |
664 """ | 664 """ |
| 665 directory = os.path.abspath(directory) |
665 infos = SVN.CaptureInfo(directory, print_error=False) | 666 infos = SVN.CaptureInfo(directory, print_error=False) |
666 cur_dir_repo_root = infos.get("Repository Root") | 667 cur_dir_repo_root = infos.get("Repository Root") |
667 if not cur_dir_repo_root: | 668 if not cur_dir_repo_root: |
668 return None | 669 return None |
669 | 670 |
670 while True: | 671 while True: |
671 parent = os.path.dirname(directory) | 672 parent = os.path.dirname(directory) |
672 if (SVN.CaptureInfo(parent, print_error=False).get( | 673 if (SVN.CaptureInfo(parent, print_error=False).get( |
673 "Repository Root") != cur_dir_repo_root): | 674 "Repository Root") != cur_dir_repo_root): |
674 break | 675 break |
675 directory = parent | 676 directory = parent |
676 return directory | 677 return directory |
OLD | NEW |