Add support for finding SVN repository to post-review
Review Request #351 — Created April 6, 2008 and submitted
The patch resolves the problem described in this thread: http://groups.google.com/group/reviewboard/browse_thread/thread/c9027e1c73cb0c86 Specifically, users can have many different URLs for the same subversion repository, none of which may match the URL that Review Board uses. There may be differences in hostnames (is it "svn" or "svn.scm" or "svn.scm.example.com") or even more drastic changes in URLs. For example, a user could have the repository NFS mounted, in which case she'd have a URL like "file:///mnt/svn/repos/"). This patch uses the JSON "get repository info" API (committed as r1263). If the local repository is Subversion, we loop through each repository on the server. First we try to find one that has the same UUID. If we get that, we check to make sure our local checkout's directory is somewhere beneath the repository URL specified on the server. If it is, we calculate the new base_path for our diff which is relative to the server's URL and send that up with our diff. This magic won't work if the server uses DOS '\' delimited paths, but it won't be any worse in that case either... it will just revert to the old behaviour. And I think that is probably a rare use case anyway (most people will use 'http' URLs).
I posted many review drafts with varying local repository URLs and server URLs.
-
-
Can you add a comment describing this function a bit? It's a little weird looking how it may return a new RepositoryInfo or itself, and this should be documented.
-
-
We'll need to coordinate a little with the change in /r/451/ as that's going to need this repository base path as well.
-
What you really want is to do something like: common_path = os.path.commonprefix([root, path]) if common_path == path: return "/" else: return path[len(common_path):] If you have, say, a base path of: "/svn/foo" and a path of "/svn/foo/trunk/abc", common_path will be "/svn/foo". Your resulting path would then be "/trunk/abc" If the common prefix is the same as the whole path, then "/".
-
-