- skip-blame as just b'' prefixes
Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG6ed04139ed37: py3: fix test-fix-metadata.t
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | contrib/python3-whitelist (1 line) | |||
M | tests/test-fix-metadata.t (14 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
90b6fd996143 | c77ab654415b | Pulkit Goyal | Jun 5 2019, 3:02 PM |
test-fastannotate-revmap.py | test-fastannotate-revmap.py | ||||
test-fastannotate.t | test-fastannotate.t | ||||
test-fetch.t | test-fetch.t | ||||
test-filebranch.t | test-filebranch.t | ||||
test-filecache.py | test-filecache.py | ||||
test-filelog.py | test-filelog.py | ||||
test-fileset-generated.t | test-fileset-generated.t | ||||
test-fileset.t | test-fileset.t | ||||
test-fix-metadata.t | |||||
test-fix-topology.t | test-fix-topology.t | ||||
test-fix.t | test-fix.t | ||||
test-flagprocessor.t | test-flagprocessor.t | ||||
test-flags.t | test-flags.t | ||||
test-fncache.t | test-fncache.t | ||||
test-gendoc-da.t | test-gendoc-da.t | ||||
test-gendoc-de.t | test-gendoc-de.t | ||||
test-gendoc-el.t | test-gendoc-el.t |
A python hook for "hg fix" that prints out the number of files and revisions | A python hook for "hg fix" that prints out the number of files and revisions | ||||
that were affected, along with which fixer tools were applied. Also checks how | that were affected, along with which fixer tools were applied. Also checks how | ||||
many times it sees a specific key generated by one of the fixer tools defined | many times it sees a specific key generated by one of the fixer tools defined | ||||
below. | below. | ||||
$ cat >> $TESTTMP/postfixhook.py <<EOF | $ cat >> $TESTTMP/postfixhook.py <<EOF | ||||
> import collections | > import collections | ||||
> def file(ui, repo, rev=None, path='', metadata=None, **kwargs): | > def file(ui, repo, rev=None, path=b'', metadata=None, **kwargs): | ||||
> ui.status('fixed %s in revision %d using %s\n' % | > ui.status(b'fixed %s in revision %d using %s\n' % | ||||
> (path, rev, ', '.join(metadata.keys()))) | > (path, rev, b', '.join(metadata.keys()))) | ||||
> def summarize(ui, repo, replacements=None, wdirwritten=False, | > def summarize(ui, repo, replacements=None, wdirwritten=False, | ||||
> metadata=None, **kwargs): | > metadata=None, **kwargs): | ||||
> counts = collections.defaultdict(int) | > counts = collections.defaultdict(int) | ||||
> keys = 0 | > keys = 0 | ||||
> for fixername, metadatalist in metadata.items(): | > for fixername, metadatalist in metadata.items(): | ||||
> for metadata in metadatalist: | > for metadata in metadatalist: | ||||
> if metadata is None: | > if metadata is None: | ||||
> continue | > continue | ||||
> counts[fixername] += 1 | > counts[fixername] += 1 | ||||
> if 'key' in metadata: | > if 'key' in metadata: | ||||
> keys += 1 | > keys += 1 | ||||
> ui.status('saw "key" %d times\n' % (keys,)) | > ui.status(b'saw "key" %d times\n' % (keys,)) | ||||
> for name, count in sorted(counts.items()): | > for name, count in sorted(counts.items()): | ||||
> ui.status('fixed %d files with %s\n' % (count, name)) | > ui.status(b'fixed %d files with %s\n' % (count, name)) | ||||
> if replacements: | > if replacements: | ||||
> ui.status('fixed %d revisions\n' % (len(replacements),)) | > ui.status(b'fixed %d revisions\n' % (len(replacements),)) | ||||
> if wdirwritten: | > if wdirwritten: | ||||
> ui.status('fixed the working copy\n') | > ui.status(b'fixed the working copy\n') | ||||
> EOF | > EOF | ||||
Some mock output for fixer tools that demonstrate what could go wrong with | Some mock output for fixer tools that demonstrate what could go wrong with | ||||
expecting the metadata output format. | expecting the metadata output format. | ||||
$ printf 'new content\n' > $TESTTMP/missing | $ printf 'new content\n' > $TESTTMP/missing | ||||
$ printf 'not valid json\0new content\n' > $TESTTMP/invalid | $ printf 'not valid json\0new content\n' > $TESTTMP/invalid | ||||
$ printf '{"key": "value"}\0new content\n' > $TESTTMP/valid | $ printf '{"key": "value"}\0new content\n' > $TESTTMP/valid |