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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gcl.py ('k') | tests/gcl_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scm.py
diff --git a/scm.py b/scm.py
index 8dc127e33eafea38c44e6f8ea59acea2a251ba35..96ae2647c603a739ccf184ef801f503d93f260a3 100644
--- a/scm.py
+++ b/scm.py
@@ -486,3 +486,22 @@ class SVN(object):
break
values[key] = value
return values
+
+ @staticmethod
+ def GetCheckoutRoot(directory):
+ """Returns the top level directory of the current repository.
+
+ The directory is returned as an absolute path.
+ """
+ infos = SVN.CaptureInfo(directory, print_error=False)
+ cur_dir_repo_root = infos.get("Repository Root")
+ if not cur_dir_repo_root:
+ return None
+
+ while True:
+ parent = os.path.dirname(directory)
+ if (SVN.CaptureInfo(parent, print_error=False).get(
+ "Repository Root") != cur_dir_repo_root):
+ break
+ directory = parent
+ return directory
« 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