Mercurial > hg
comparison hgext/histedit.py @ 43372:66a0c5faed1e stable
py3: open chistedit file in binary mode using vfs
We write bytes to the file, so it should be open in binary
mode. Opening it via the vfs takes care of that for us.
Now you'll get yet a different traceback if you try to confirm you
histedit plan.
Differential Revision: https://phab.mercurial-scm.org/D7185
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 31 Oct 2019 15:00:49 -0700 |
parents | 85ab79bc7dab |
children | de2c8722a787 |
comparison
equal
deleted
inserted
replaced
43371:85ab79bc7dab | 43372:66a0c5faed1e |
---|---|
1682 ui.write(_(b"histedit aborted\n")) | 1682 ui.write(_(b"histedit aborted\n")) |
1683 return 0 | 1683 return 0 |
1684 if type(rc) is list: | 1684 if type(rc) is list: |
1685 ui.status(_(b"performing changes\n")) | 1685 ui.status(_(b"performing changes\n")) |
1686 rules = makecommands(rc) | 1686 rules = makecommands(rc) |
1687 filename = repo.vfs.join(b'chistedit') | 1687 with repo.vfs(b'chistedit', b'w+') as fp: |
1688 with open(filename, b'w+') as fp: | |
1689 for r in rules: | 1688 for r in rules: |
1690 fp.write(r) | 1689 fp.write(r) |
1691 opts[b'commands'] = filename | 1690 opts[b'commands'] = fp.name |
1692 return _texthistedit(ui, repo, *freeargs, **opts) | 1691 return _texthistedit(ui, repo, *freeargs, **opts) |
1693 except KeyboardInterrupt: | 1692 except KeyboardInterrupt: |
1694 pass | 1693 pass |
1695 return -1 | 1694 return -1 |
1696 | 1695 |