##// END OF EJS Templates
tests: refactor git ident usage on test_vcs_operations
marcink -
r425:38a06a10 default
parent child Browse files
Show More
@@ -87,18 +87,21 b' def _add_files_and_push(vcs, dest, clone'
87 added_file = jn(path, '%ssetup.py' % tempfile._RandomNameSequence().next())
87 added_file = jn(path, '%ssetup.py' % tempfile._RandomNameSequence().next())
88 Command(cwd).execute('touch %s' % added_file)
88 Command(cwd).execute('touch %s' % added_file)
89 Command(cwd).execute('%s add %s' % (vcs, added_file))
89 Command(cwd).execute('%s add %s' % (vcs, added_file))
90 author_str = 'Marcin Kuźminski <me@email.com>'
91
92 git_ident = "git config user.name {} && git config user.email {}".format(
93 'Marcin Kuźminski', 'me@email.com')
90
94
91 for i in xrange(kwargs.get('files_no', 3)):
95 for i in xrange(kwargs.get('files_no', 3)):
92 cmd = """echo 'added_line%s' >> %s""" % (i, added_file)
96 cmd = """echo 'added_line%s' >> %s""" % (i, added_file)
93 Command(cwd).execute(cmd)
97 Command(cwd).execute(cmd)
94 author_str = 'Marcin Kuźminski <me@email.com>'
95 if vcs == 'hg':
98 if vcs == 'hg':
96 cmd = """hg commit -m 'commited new %s' -u '%s' %s """ % (
99 cmd = """hg commit -m 'commited new %s' -u '%s' %s """ % (
97 i, author_str, added_file
100 i, author_str, added_file
98 )
101 )
99 elif vcs == 'git':
102 elif vcs == 'git':
100 cmd = """EMAIL="me@email.com" git commit -m 'commited new %s' """\
103 cmd = """%s && git commit -m 'commited new %s' %s""" % (
101 """--author '%s' %s """ % (i, author_str, added_file)
104 git_ident, i, added_file)
102 Command(cwd).execute(cmd)
105 Command(cwd).execute(cmd)
103
106
104 # PUSH it back
107 # PUSH it back
@@ -108,7 +111,8 b' def _add_files_and_push(vcs, dest, clone'
108 'hg push --verbose', clone_url)
111 'hg push --verbose', clone_url)
109 elif vcs == 'git':
112 elif vcs == 'git':
110 stdout, stderr = Command(cwd).execute(
113 stdout, stderr = Command(cwd).execute(
111 'git push --verbose', clone_url + " master")
114 """%s && git push --verbose %s master""" % (
115 git_ident, clone_url))
112
116
113 return stdout, stderr
117 return stdout, stderr
114
118
General Comments 0
You need to be logged in to leave comments. Login now