Commit d8da2c10 authored by sky@chromium.org's avatar sky@chromium.org

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
parent 30ef9ae3
...@@ -172,7 +172,9 @@ class GIT(object): ...@@ -172,7 +172,9 @@ class GIT(object):
for ref in remotes: for ref in remotes:
match = git_svn_re.search( match = git_svn_re.search(
GIT.Capture(['cat-file', '-p', ref], cwd)[0]) 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_refs[match.group(1)] = ref
svn_branch = '' svn_branch = ''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment