Commit 814b1cab authored by agable's avatar agable Committed by Commit bot

Remove svn support from smaller git extensions

R=iannucci@chromium.org
BUG=475320

Review-Url: https://codereview.chromium.org/2354313003
parent debf6c85
......@@ -1007,7 +1007,6 @@ def make_workdir(repository, new_workdir):
'refs',
'remotes',
'rr-cache',
'svn'
]
make_workdir_common(repository, new_workdir, GIT_DIRECTORY_WHITELIST,
['HEAD'])
......
......@@ -214,7 +214,6 @@ class _Drover(object):
'packed-refs',
'remotes',
'rr-cache',
'svn',
]
FILES_TO_COPY = ['config', 'HEAD']
......
......@@ -15,7 +15,6 @@ import git_common as git
FOOTER_PATTERN = re.compile(r'^\s*([\w-]+): (.*)$')
CHROME_COMMIT_POSITION_PATTERN = re.compile(r'^([\w/\-\.]+)@{#(\d+)}$')
GIT_SVN_ID_PATTERN = re.compile('^([^\s@]+)@(\d+)')
def normalize_name(header):
......@@ -68,20 +67,6 @@ def split_footers(message):
return message_lines[:-len(footer_lines)], footer_lines, footers
def get_footer_svn_id(branch=None):
if not branch:
branch = git.root()
svn_id = None
message = git.run('log', '-1', '--format=%B', branch)
footers = parse_footers(message)
git_svn_id = get_unique(footers, 'git-svn-id')
if git_svn_id:
match = GIT_SVN_ID_PATTERN.match(git_svn_id)
if match:
svn_id = match.group(1)
return svn_id
def get_footer_change_id(message):
"""Returns a list of Gerrit's ChangeId from given commit message."""
return parse_footers(message).get(normalize_name('Change-Id'), [])
......@@ -150,9 +135,7 @@ def get_position(footers):
Cr-Commit-Position: refs/heads/master@{#292272}
would give the return value ('refs/heads/master', 292272). If
Cr-Commit-Position is not defined, we try to infer the ref and position
from git-svn-id. The position number can be None if it was not inferrable.
would give the return value ('refs/heads/master', 292272).
"""
position = get_unique(footers, 'Cr-Commit-Position')
......@@ -161,29 +144,6 @@ def get_position(footers):
assert match, 'Invalid Cr-Commit-Position value: %s' % position
return (match.group(1), match.group(2))
svn_commit = get_unique(footers, 'git-svn-id')
if svn_commit:
match = GIT_SVN_ID_PATTERN.match(svn_commit)
assert match, 'Invalid git-svn-id value: %s' % svn_commit
# V8 has different semantics than Chromium.
if re.match(r'.*https?://v8\.googlecode\.com/svn/trunk',
match.group(1)):
return ('refs/heads/candidates', match.group(2))
if re.match(r'.*https?://v8\.googlecode\.com/svn/branches/bleeding_edge',
match.group(1)):
return ('refs/heads/master', match.group(2))
# Assume that any trunk svn revision will match the commit-position
# semantics.
if re.match('.*/trunk.*$', match.group(1)):
return ('refs/heads/master', match.group(2))
# But for now only support faking branch-heads for chrome.
branch_match = re.match('.*/chrome/branches/([\w/-]+)/src$', match.group(1))
if branch_match:
# svn commit numbers do not map to branches.
return ('refs/branch-heads/%s' % branch_match.group(1), None)
raise ValueError('Unable to infer commit position from footers')
......
......@@ -25,16 +25,6 @@ My commit message is my best friend. It is my life. I must master it.
_position_footer = 'Cr-Commit-Position: %s\n' % _position
_git_svn_id = ('svn://svn.chromium.org/chrome/trunk/src@290386'
' 0039d316-1c4b-4281-b951-d872f2087c98')
_git_svn_id_footer = 'git-svn-id: %s\n' % _git_svn_id
_git_svn_id_branch = (
'svn://svn.chromium.org/chrome/branches/blabble/src@177288')
_git_svn_id_footer_branch = 'git-svn-id: %s\n' % _git_svn_id_branch
def testFootersBasic(self):
self.assertEqual(
git_footers.split_footers('Not-A: footer'),
......@@ -51,33 +41,11 @@ My commit message is my best friend. It is my life. I must master it.
self.assertEqual(
git_footers.parse_footers(self._message + self._position_footer),
{ 'Cr-Commit-Position': [ self._position ] })
self.assertEqual(
git_footers.parse_footers(self._message + self._git_svn_id_footer),
{ 'Git-Svn-Id': [ self._git_svn_id ] })
self.assertEqual(
git_footers.parse_footers(self._message + self._position_footer
+ self._position_footer),
{ 'Cr-Commit-Position': [ self._position, self._position ] })
def testTrunkHeuristic(self):
footers = git_footers.parse_footers(self._message + self._git_svn_id_footer)
self.assertEqual(
footers,
{ 'Git-Svn-Id': [ self._git_svn_id ] })
self.assertEqual(
git_footers.get_position(footers),
('refs/heads/master', '290386'))
def testBranchHeuristic(self):
footers = git_footers.parse_footers(self._message +
self._git_svn_id_footer_branch)
self.assertEqual(
footers,
{ 'Git-Svn-Id': [ self._git_svn_id_branch ] })
self.assertEqual(
git_footers.get_position(footers),
('refs/branch-heads/blabble', None))
def testGetFooterChangeId(self):
msg = '\n'.join(['whatever',
'',
......
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