Mercurial > evolve
comparison hgext3rd/topic/__init__.py @ 4812:67567d7f1174
python3: enforce byte prefix for vfs.open()
Changeset ea8da5aa23c6e723d7f0006387a1a20eef58fc9a added raw prefix to open(),
but also to vfs.open(). The latter only handles bytestring arguments.
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Tue, 06 Aug 2019 15:06:27 +0200 |
parents | ea8da5aa23c6 |
children | 48b30ff742cb |
comparison
equal
deleted
inserted
replaced
4811:e1dc374909bd | 4812:67567d7f1174 |
---|---|
921 def _changecurrenttopic(repo, newtopic): | 921 def _changecurrenttopic(repo, newtopic): |
922 """changes the current topic.""" | 922 """changes the current topic.""" |
923 | 923 |
924 if newtopic: | 924 if newtopic: |
925 with repo.wlock(): | 925 with repo.wlock(): |
926 with repo.vfs.open(r'topic', r'w') as f: | 926 with repo.vfs.open(b'topic', b'w') as f: |
927 f.write(newtopic) | 927 f.write(newtopic) |
928 else: | 928 else: |
929 if repo.vfs.exists('topic'): | 929 if repo.vfs.exists('topic'): |
930 repo.vfs.unlink('topic') | 930 repo.vfs.unlink('topic') |
931 | 931 |
1183 maywarn = False | 1183 maywarn = False |
1184 | 1184 |
1185 hint = _("see 'hg help -e topic.topic-mode' for details") | 1185 hint = _("see 'hg help -e topic.topic-mode' for details") |
1186 if opts.get('topic'): | 1186 if opts.get('topic'): |
1187 t = opts['topic'] | 1187 t = opts['topic'] |
1188 with repo.vfs.open(r'topic', r'w') as f: | 1188 with repo.vfs.open(b'topic', b'w') as f: |
1189 f.write(t) | 1189 f.write(t) |
1190 elif opts.get('amend'): | 1190 elif opts.get('amend'): |
1191 pass | 1191 pass |
1192 elif notopic and mayabort: | 1192 elif notopic and mayabort: |
1193 msg = _("no active topic") | 1193 msg = _("no active topic") |
1195 elif notopic and maywarn: | 1195 elif notopic and maywarn: |
1196 ui.warn(_("warning: new draft commit without topic\n")) | 1196 ui.warn(_("warning: new draft commit without topic\n")) |
1197 if not ui.quiet: | 1197 if not ui.quiet: |
1198 ui.warn(("(%s)\n") % hint) | 1198 ui.warn(("(%s)\n") % hint) |
1199 elif notopic and mayrandom: | 1199 elif notopic and mayrandom: |
1200 with repo.vfs.open(r'topic', r'w') as f: | 1200 with repo.vfs.open(b'topic', b'w') as f: |
1201 f.write(randomname.randomtopicname(ui)) | 1201 f.write(randomname.randomtopicname(ui)) |
1202 return orig(ui, repo, *args, **opts) | 1202 return orig(ui, repo, *args, **opts) |
1203 | 1203 |
1204 def committextwrap(orig, repo, ctx, subs, extramsg): | 1204 def committextwrap(orig, repo, ctx, subs, extramsg): |
1205 ret = orig(repo, ctx, subs, extramsg) | 1205 ret = orig(repo, ctx, subs, extramsg) |
1239 if ((not partial and not branchmerge) or isrebase) and not ist0: | 1239 if ((not partial and not branchmerge) or isrebase) and not ist0: |
1240 t = '' | 1240 t = '' |
1241 pctx = repo[node] | 1241 pctx = repo[node] |
1242 if pctx.phase() > phases.public: | 1242 if pctx.phase() > phases.public: |
1243 t = pctx.topic() | 1243 t = pctx.topic() |
1244 with repo.vfs.open(r'topic', r'w') as f: | 1244 with repo.vfs.open(b'topic', b'w') as f: |
1245 f.write(t) | 1245 f.write(t) |
1246 if t and t != ot: | 1246 if t and t != ot: |
1247 repo.ui.status(_("switching to topic %s\n") % t) | 1247 repo.ui.status(_("switching to topic %s\n") % t) |
1248 if ot and not t: | 1248 if ot and not t: |
1249 st = stack.stack(repo, topic=ot) | 1249 st = stack.stack(repo, topic=ot) |