Commit 5b5d043a authored by evan@chromium.org's avatar evan@chromium.org

git_cl: drop migration code

Everyone at this point should have been migrated to the new format.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@121509 0039d316-1c4b-4281-b951-d872f2087c98
parent 3b871cb7
...@@ -146,7 +146,6 @@ class Settings(object): ...@@ -146,7 +146,6 @@ class Settings(object):
self.tree_status_url = None self.tree_status_url = None
self.viewvc_url = None self.viewvc_url = None
self.updated = False self.updated = False
self.did_migrate_check = False
self.is_gerrit = None self.is_gerrit = None
def LazyUpdateIfNeeded(self): def LazyUpdateIfNeeded(self):
...@@ -276,32 +275,6 @@ class Settings(object): ...@@ -276,32 +275,6 @@ class Settings(object):
return RunGit(['config', param], **kwargs).strip() return RunGit(['config', param], **kwargs).strip()
def CheckForMigration():
"""Migrate from the old issue format, if found.
We used to store the branch<->issue mapping in a file in .git, but it's
better to store it in the .git/config, since deleting a branch deletes that
branch's entry there.
"""
# Don't run more than once.
if settings.did_migrate_check:
return
gitdir = RunGit(['rev-parse', '--git-dir']).strip()
storepath = os.path.join(gitdir, 'cl-mapping')
if os.path.exists(storepath):
print "old-style git-cl mapping file (%s) found; migrating." % storepath
store = open(storepath, 'r')
for line in store:
branch, issue = line.strip().split()
RunGit(['config', 'branch.%s.rietveldissue' % ShortBranchName(branch),
issue])
store.close()
os.remove(storepath)
settings.did_migrate_check = True
def ShortBranchName(branch): def ShortBranchName(branch):
"""Convert a name like 'refs/heads/foo' to just 'foo'.""" """Convert a name like 'refs/heads/foo' to just 'foo'."""
return branch.replace('refs/heads/', '') return branch.replace('refs/heads/', '')
...@@ -421,7 +394,6 @@ or verify this branch is set up to track another (via the --track argument to ...@@ -421,7 +394,6 @@ or verify this branch is set up to track another (via the --track argument to
def GetIssue(self): def GetIssue(self):
if not self.has_issue: if not self.has_issue:
CheckForMigration()
issue = RunGit(['config', self._IssueSetting()], error_ok=True).strip() issue = RunGit(['config', self._IssueSetting()], error_ok=True).strip()
if issue: if issue:
self.issue = issue self.issue = issue
......
...@@ -99,7 +99,6 @@ class TestGitCl(TestCase): ...@@ -99,7 +99,6 @@ class TestGitCl(TestCase):
((['git', 'rev-parse', 'HEAD'],), '12345'), ((['git', 'rev-parse', 'HEAD'],), '12345'),
((['git', 'diff', '--name-status', '-r', 'master...', '.'],), ((['git', 'diff', '--name-status', '-r', 'master...', '.'],),
'M\t.gitignore\n'), 'M\t.gitignore\n'),
((['git', 'rev-parse', '--git-dir'],), '.git'),
((['git', 'config', 'branch.master.rietveldissue'],), ''), ((['git', 'config', 'branch.master.rietveldissue'],), ''),
((['git', 'config', 'branch.master.rietveldpatchset'],), ''), ((['git', 'config', 'branch.master.rietveldpatchset'],), ''),
((['git', 'log', '--pretty=format:%s%n%n%b', 'master...'],), 'foo'), ((['git', 'log', '--pretty=format:%s%n%n%b', 'master...'],), 'foo'),
...@@ -155,7 +154,6 @@ class TestGitCl(TestCase): ...@@ -155,7 +154,6 @@ class TestGitCl(TestCase):
((['git', 'diff', '--name-status', '-r', 'refs/remotes/origin/master...', ((['git', 'diff', '--name-status', '-r', 'refs/remotes/origin/master...',
'.'],), '.'],),
'M\tPRESUBMIT.py'), 'M\tPRESUBMIT.py'),
((['git', 'rev-parse', '--git-dir'],), '.git'),
((['git', 'config', 'branch.working.rietveldissue'],), '12345'), ((['git', 'config', 'branch.working.rietveldissue'],), '12345'),
((['git', 'config', 'branch.working.rietveldserver'],), ((['git', 'config', 'branch.working.rietveldserver'],),
'codereview.example.com'), 'codereview.example.com'),
...@@ -167,7 +165,6 @@ class TestGitCl(TestCase): ...@@ -167,7 +165,6 @@ class TestGitCl(TestCase):
@classmethod @classmethod
def _dcommit_calls_bypassed(cls): def _dcommit_calls_bypassed(cls):
return [ return [
((['git', 'rev-parse', '--git-dir'],), '.git'),
((['git', 'config', 'branch.working.rietveldissue'],), '12345'), ((['git', 'config', 'branch.working.rietveldissue'],), '12345'),
((['git', 'config', 'branch.working.rietveldserver'],), ((['git', 'config', 'branch.working.rietveldserver'],),
'codereview.example.com'), 'codereview.example.com'),
...@@ -336,7 +333,6 @@ class TestGitCl(TestCase): ...@@ -336,7 +333,6 @@ class TestGitCl(TestCase):
((['git', 'rev-parse', 'HEAD'],), '12345'), ((['git', 'rev-parse', 'HEAD'],), '12345'),
((['git', 'diff', '--name-status', '-r', 'master...', '.'],), ((['git', 'diff', '--name-status', '-r', 'master...', '.'],),
'M\t.gitignore\n'), 'M\t.gitignore\n'),
((['git', 'rev-parse', '--git-dir'],), '.git'),
((['git', 'config', 'branch.master.rietveldissue'],), ''), ((['git', 'config', 'branch.master.rietveldissue'],), ''),
((['git', 'config', 'branch.master.rietveldpatchset'],), ''), ((['git', 'config', 'branch.master.rietveldpatchset'],), ''),
((['git', 'log', '--pretty=format:%s%n%n%b', 'master...'],), 'foo'), ((['git', 'log', '--pretty=format:%s%n%n%b', 'master...'],), 'foo'),
......
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