| 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 subprocess | 9 import subprocess |
| 10 import sys | 10 import sys |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 | 479 |
| 480 while True: | 480 while True: |
| 481 key = ReadOneItem('K') | 481 key = ReadOneItem('K') |
| 482 if not key: | 482 if not key: |
| 483 break | 483 break |
| 484 value = ReadOneItem('V') | 484 value = ReadOneItem('V') |
| 485 if not value: | 485 if not value: |
| 486 break | 486 break |
| 487 values[key] = value | 487 values[key] = value |
| 488 return values | 488 return values |
| 489 |
| 490 @staticmethod |
| 491 def GetCheckoutRoot(directory): |
| 492 """Returns the top level directory of the current repository. |
| 493 |
| 494 The directory is returned as an absolute path. |
| 495 """ |
| 496 infos = SVN.CaptureInfo(directory, print_error=False) |
| 497 cur_dir_repo_root = infos.get("Repository Root") |
| 498 if not cur_dir_repo_root: |
| 499 return None |
| 500 |
| 501 while True: |
| 502 parent = os.path.dirname(directory) |
| 503 if (SVN.CaptureInfo(parent, print_error=False).get( |
| 504 "Repository Root") != cur_dir_repo_root): |
| 505 break |
| 506 directory = parent |
| 507 return directory |
| OLD | NEW |