Commit 21548eb0 authored by maruel@chromium.org's avatar maruel@chromium.org

Change the fake repo svn users to be emails.

Also remove the harcoding of the names by putting them in a variable.

This will help testing of the commit queue.

BUG=none
TEST=none

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@72454 0039d316-1c4b-4281-b951-d872f2087c98
parent 5c76de94
...@@ -156,7 +156,7 @@ def dict_diff(dict1, dict2): ...@@ -156,7 +156,7 @@ def dict_diff(dict1, dict2):
return diff return diff
def commit_svn(repo): def commit_svn(repo, usr, pwd):
"""Commits the changes and returns the new revision number.""" """Commits the changes and returns the new revision number."""
to_add = [] to_add = []
to_remove = [] to_remove = []
...@@ -169,9 +169,11 @@ def commit_svn(repo): ...@@ -169,9 +169,11 @@ def commit_svn(repo):
check_call(['svn', 'add', '--no-auto-props', '-q'] + to_add, cwd=repo) check_call(['svn', 'add', '--no-auto-props', '-q'] + to_add, cwd=repo)
if to_remove: if to_remove:
check_call(['svn', 'remove', '-q'] + to_remove, cwd=repo) check_call(['svn', 'remove', '-q'] + to_remove, cwd=repo)
proc = Popen(['svn', 'commit', repo, '-m', 'foo', '--non-interactive', proc = Popen(
'--no-auth-cache', '--username', 'user1', '--password', 'foo'], ['svn', 'commit', repo, '-m', 'foo', '--non-interactive',
cwd=repo) '--no-auth-cache',
'--username', usr, '--password', pwd],
cwd=repo)
out, err = proc.communicate() out, err = proc.communicate()
match = re.search(r'(\d+)', out) match = re.search(r'(\d+)', out)
if not match: if not match:
...@@ -213,6 +215,10 @@ class FakeReposBase(object): ...@@ -213,6 +215,10 @@ class FakeReposBase(object):
# Hostname # Hostname
HOST = '127.0.0.1' HOST = '127.0.0.1'
NB_GIT_REPOS = 1 NB_GIT_REPOS = 1
USERS = [
('user1@example.com', 'foo'),
('user2@example.com', 'bar'),
]
def __init__(self, trial_dir=None, leak=None, host=None): def __init__(self, trial_dir=None, leak=None, host=None):
global _FAKE_LOADED global _FAKE_LOADED
...@@ -306,10 +312,9 @@ class FakeReposBase(object): ...@@ -306,10 +312,9 @@ class FakeReposBase(object):
'anon-access = read\n' 'anon-access = read\n'
'auth-access = write\n' 'auth-access = write\n'
'password-db = passwd\n') 'password-db = passwd\n')
write(join(root, 'conf', 'passwd'), text = '[users]\n'
'[users]\n' text += ''.join('%s = %s\n' % (usr, pwd) for usr, pwd in self.USERS)
'user1 = foo\n' write(join(root, 'conf', 'passwd'), text)
'user2 = bar\n')
# Start the daemon. # Start the daemon.
cmd = ['svnserve', '-d', '--foreground', '-r', self.repos_dir] cmd = ['svnserve', '-d', '--foreground', '-r', self.repos_dir]
...@@ -340,7 +345,7 @@ class FakeReposBase(object): ...@@ -340,7 +345,7 @@ class FakeReposBase(object):
def _commit_svn(self, tree): def _commit_svn(self, tree):
self._genTree(self.svn_root, tree) self._genTree(self.svn_root, tree)
commit_svn(self.svn_root) commit_svn(self.svn_root, self.USERS[0][0], self.USERS[0][1])
if self.svn_revs and self.svn_revs[-1]: if self.svn_revs and self.svn_revs[-1]:
new_tree = self.svn_revs[-1].copy() new_tree = self.svn_revs[-1].copy()
new_tree.update(tree) new_tree.update(tree)
...@@ -375,7 +380,7 @@ class FakeRepos(FakeReposBase): ...@@ -375,7 +380,7 @@ class FakeRepos(FakeReposBase):
# Repos # Repos
check_call(['svn', 'checkout', 'svn://127.0.0.1/svn', self.svn_root, '-q', check_call(['svn', 'checkout', 'svn://127.0.0.1/svn', self.svn_root, '-q',
'--non-interactive', '--no-auth-cache', '--non-interactive', '--no-auth-cache',
'--username', 'user1', '--password', 'foo']) '--username', self.USERS[0][0], '--password', self.USERS[0][1]])
assert os.path.isdir(join(self.svn_root, '.svn')) assert os.path.isdir(join(self.svn_root, '.svn'))
def file_system(rev, DEPS): def file_system(rev, DEPS):
fs = { fs = {
......
...@@ -1072,10 +1072,12 @@ class GClientSmokeFromCheckout(GClientSmokeBase): ...@@ -1072,10 +1072,12 @@ class GClientSmokeFromCheckout(GClientSmokeBase):
self.enabled = self.FAKE_REPOS.setUpSVN() self.enabled = self.FAKE_REPOS.setUpSVN()
os.rmdir(self.root_dir) os.rmdir(self.root_dir)
if self.enabled: if self.enabled:
check_call(['svn', 'checkout', 'svn://127.0.0.1/svn/trunk/webkit', usr, pwd = self.FAKE_REPOS.USERS[0]
self.root_dir, '-q', check_call(
'--non-interactive', '--no-auth-cache', ['svn', 'checkout', 'svn://127.0.0.1/svn/trunk/webkit',
'--username', 'user1', '--password', 'foo']) self.root_dir, '-q',
'--non-interactive', '--no-auth-cache',
'--username', usr, '--password', pwd])
def testSync(self): def testSync(self):
if not self.enabled: if not self.enabled:
......
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