Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG1e0c9f9f6f36: tests: port inline Python in test-http-branchmap.t to Python 3
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | tests/test-http-branchmap.t (14 lines) |
> import sys | > import sys | ||||
> from mercurial import ui, hg, commands | > from mercurial import ui, hg, commands | ||||
> | > | ||||
> class StdoutWrapper(object): | > class StdoutWrapper(object): | ||||
> def __init__(self, stdout): | > def __init__(self, stdout): | ||||
> self._file = stdout | > self._file = stdout | ||||
> | > | ||||
> def write(self, data): | > def write(self, data): | ||||
> if data == '47\n': | > if data == b'47\n': | ||||
> # latin1 encoding is one %xx (3 bytes) shorter | > # latin1 encoding is one %xx (3 bytes) shorter | ||||
> data = '44\n' | > data = b'44\n' | ||||
> elif data.startswith('%C3%A6 '): | > elif data.startswith(b'%C3%A6 '): | ||||
> # translate to latin1 encoding | > # translate to latin1 encoding | ||||
> data = '%%E6 %s' % data[7:] | > data = b'%%E6 %s' % data[7:] | ||||
> self._file.write(data) | > self._file.write(data) | ||||
> | > | ||||
> def __getattr__(self, name): | > def __getattr__(self, name): | ||||
> return getattr(self._file, name) | > return getattr(self._file, name) | ||||
> | > | ||||
> sys.stdout = StdoutWrapper(sys.stdout) | > sys.stdout = StdoutWrapper(getattr(sys.stdout, 'buffer', sys.stdout)) | ||||
> sys.stderr = StdoutWrapper(sys.stderr) | > sys.stderr = StdoutWrapper(getattr(sys.stderr, 'buffer', sys.stderr)) | ||||
> | > | ||||
> myui = ui.ui.load() | > myui = ui.ui.load() | ||||
> repo = hg.repository(myui, 'a') | > repo = hg.repository(myui, b'a') | ||||
> commands.serve(myui, repo, stdio=True, cmdserver=False) | > commands.serve(myui, repo, stdio=True, cmdserver=False) | ||||
> EOF | > EOF | ||||
$ echo baz >> b/foo | $ echo baz >> b/foo | ||||
$ hg -R b ci -m baz | $ hg -R b ci -m baz | ||||
$ hg push -R b -e "\"$PYTHON\" oldhg" ssh://dummy/ --encoding latin1 | $ hg push -R b -e "\"$PYTHON\" oldhg" ssh://dummy/ --encoding latin1 | ||||
pushing to ssh://dummy/ | pushing to ssh://dummy/ | ||||
searching for changes | searching for changes | ||||
remote: adding changesets | remote: adding changesets | ||||
remote: adding manifests | remote: adding manifests | ||||
remote: adding file changes | remote: adding file changes | ||||
remote: added 1 changesets with 1 changes to 1 files | remote: added 1 changesets with 1 changes to 1 files |