Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(495)

Side by Side Diff: scm.py

Issue 502085: Factor out gcl.GetRepositoryRoot() into scm.SVN.GetCheckoutRoot() (Closed)
Patch Set: Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gcl.py ('k') | tests/gcl_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « gcl.py ('k') | tests/gcl_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698