Details
Details
- Reviewers
indygreg - Group Reviewers
hg-reviewers - Commits
- rHGbe73fa5b42d3: histedit: modernize write of histedit-last-edit file
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
| indygreg |
| hg-reviewers |
| Lint Skipped |
| Unit Tests Skipped |
| rules += '\n\n' | rules += '\n\n' | ||||
| rules += editcomment | rules += editcomment | ||||
| rules = ui.edit(rules, ui.username(), {'prefix': 'histedit'}, | rules = ui.edit(rules, ui.username(), {'prefix': 'histedit'}, | ||||
| repopath=repo.path, action='histedit') | repopath=repo.path, action='histedit') | ||||
| # Save edit rules in .hg/histedit-last-edit.txt in case | # Save edit rules in .hg/histedit-last-edit.txt in case | ||||
| # the user needs to ask for help after something | # the user needs to ask for help after something | ||||
| # surprising happens. | # surprising happens. | ||||
| f = open(repo.vfs.join('histedit-last-edit.txt'), 'w') | with repo.vfs('histedit-last-edit.txt', 'wb') as f: | ||||
| f.write(rules) | f.write(rules) | ||||
| f.close() | |||||
| return rules | return rules | ||||
| def parserules(rules, state): | def parserules(rules, state): | ||||
| """Read the histedit rules string and return list of action objects """ | """Read the histedit rules string and return list of action objects """ | ||||
| rules = [l for l in (r.strip() for r in rules.splitlines()) | rules = [l for l in (r.strip() for r in rules.splitlines()) | ||||
| if l and not l.startswith('#')] | if l and not l.startswith('#')] | ||||
| actions = [] | actions = [] | ||||