Changes GetSVNBranch to prefer the first ref over the last. The
scenario I encountered was I've added another one of my machines as a
remote, and because we preferred the last ref my diffs were always
against my remote machine rather than local trunk. This change prefers
the first over the last. Another option would be to prefer something
like remotes/origin/trunk. Let me know what you think.

I've got a similar change to git-cl, but I'll wait until we agree upon
this before uploading that one.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@44094 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/scm.py b/scm.py
index 209e064..3febbe4 100644
--- a/scm.py
+++ b/scm.py
@@ -172,7 +172,9 @@
     for ref in remotes:
       match = git_svn_re.search(
           GIT.Capture(['cat-file', '-p', ref], cwd)[0])
-      if match:
+      if match and match.group(1) not in svn_refs:
+        # To prefer local refs over remote ones we only set the first occurence.
+        # The assumption being local refs are usually first.
         svn_refs[match.group(1)] = ref
 
     svn_branch = ''