buildbot-contrib
buildbot-contrib copied to clipboard
Sam patch hgbuildbot python3
I hove this port is okay, I am not too familiar with porting from Python 2 to Python 3.
Here is the output of diff hgbuildbot.py hgbuildbot-python3.py
157d156
<
159,160c158,160
< if hooktype != 'changegroup':
< ui.status('hgbuildbot: hooktype %s not supported.\n' % hooktype)
---
> if hooktype != b'changegroup':
> ui.status(('hgbuildbot: hooktype %s not supported.\n' % hooktype).encode())
164c164
< masters = ui.configlist('hgbuildbot', 'master')
---
> masters = ui.configlist(b'hgbuildbot', b'master')
166,167c166,167
< ui.write('* You must add a [hgbuildbot] section to .hg/hgrc in '
< 'order to use the Buildbot hook\n')
---
> ui.write(('* You must add a [hgbuildbot] section to .hg/hgrc in '
> 'order to use the Buildbot hook\n').encode())
171c171
< venv = ui.config('hgbuildbot', 'venv', None)
---
> venv = ui.config(b'hgbuildbot', b'venv', None)
174c174
< ui.write('* Virtualenv "%s" does not exist.\n' % venv)
---
> ui.write(('* Virtualenv "%s" does not exist.\n' % venv).encode())
182,183c182,183
< username = ui.config('hgbuildbot', 'user')
< password = ui.config('hgbuildbot', 'passwd')
---
> username = ui.config(b'hgbuildbot', b'user')
> password = ui.config(b'hgbuildbot', b'passwd')
190,191c190,191
< branchtype = ui.config('hgbuildbot', 'branchtype', 'inrepo')
< branch = ui.config('hgbuildbot', 'branch', None)
---
> branchtype = ui.config(b'hgbuildbot', b'branchtype', 'inrepo')
> branch = ui.config(b'hgbuildbot', b'branch', None)
194,197c194,197
< baseurl = ui.config('hgbuildbot', 'baseurl',
< ui.config('web', 'baseurl', ''))
< stripcount = int(ui.config('hgbuildbot', 'strip',
< ui.config('notify', 'strip', 0)))
---
> baseurl = ui.config(b'hgbuildbot', b'baseurl',
> ui.config(b'web', b'baseurl', b''))
> stripcount = int(ui.config(b'hgbuildbot', b'strip',
> ui.config(b'notify', b'strip', 0)))
200,202c200,202
< category = ui.config('hgbuildbot', 'category', None)
< project = ui.config('hgbuildbot', 'project', '')
< codebase = ui.config('hgbuildbot', 'codebase', '')
---
> category = ui.config(b'hgbuildbot', b'category', None)
> project = ui.config(b'hgbuildbot', b'project', b'')
> codebase = ui.config(b'hgbuildbot', b'codebase', b'')
205c205
< if branch is None and branchtype == 'dirname':
---
> if branch is None and branchtype == b'dirname':
222,223c222,223
< if branchtype == 'inrepo':
< branch = extra['branch']
---
> if branchtype == b'inrepo':
> branch = extra[b'branch']
231c231
< files = ["merge"]
---
> files = [b"merge"]
239c239
< 'files': json.dumps(files),
---
> 'files': json.dumps(files, default=lambda o: o.decode()),
247a248
>
256,258c257,259
< ui.warn("couldn't notify buildbot about {}: {} {}".format(
< hex(node)[:12], response.status_code, response.reason
< ))
---
> ui.warn(("couldn't notify buildbot about {}: {} {}".format(
> hex(node)[:12].decode(), response.status_code, response.reason
> )).encode())
260c261
< ui.status("notified buildbot about {}".format(hex(node)[:12]))
---
> ui.status(("notified buildbot about {}".format(hex(node)[:12])).encode())
266c267
< path = '/'.join(path.split(os.sep))
---
> path = b'/'.join(path.split(os.sep.encode()))
268c269
< return path.split('/', count)[-1]
---
> return path.split(b'/', count)[-1]
Is it worth creating a copy for python 3 rather than applying the change to the existing file?
IMHO Python2 has had end of life already but I was assuming the quite some people might still have their buildbot environments with a Python2 setup. Therefore the additional file. But I agree, updating the existing file would be cleaner.
Please resubmit this PR against buildbot repository.