Fix scm.SVN.GetCheckoutRoot() so it is not confused by intermixed checkouts
from the same repository.

TEST=added regression test.
BUG=none

Review URL: http://codereview.chromium.org/6578029

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@75937 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/scm.py b/scm.py
index f0b956a..8563705 100644
--- a/scm.py
+++ b/scm.py
@@ -806,14 +806,19 @@
     """
     directory = os.path.abspath(directory)
     try:
-      cur_dir_repo_root = SVN.CaptureInfo(directory)['Repository Root']
+      info = SVN.CaptureInfo(directory)
+      cur_dir_repo_root = info['Repository Root']
+      url = info['URL']
     except gclient_utils.Error:
       return None
     while True:
       parent = os.path.dirname(directory)
       try:
-        if SVN.CaptureInfo(parent)['Repository Root'] != cur_dir_repo_root:
+        info = SVN.CaptureInfo(parent)
+        if (info['Repository Root'] != cur_dir_repo_root or
+            info['URL'] != os.path.dirname(url)):
           break
+        url = info['URL']
       except gclient_utils.Error:
         break
       directory = parent