Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign updoc: book migration lost some changes #4906
Comments
This comment has been minimized.
This comment has been minimized.
|
I had a go at automatically finding possibly-problematic commits that didn't update the book. The book became canonical at ec25b8b (#4453), providing a migration map; I took the final version of it, so it's possible this misses some changes using book file names that changed somewhere in the middle. I want to find commits that touch one of the listed sources but none of the listed destinations. First get all the commits to master since the book became canonical: $ git rev-list ^ec25b8b4501a6021f163a07ab19afc9c1660f28e master | tee COMMITS | wc -l
444Audit each change individually, writing out the commit hashes that appear problematic (script included below): $ while read COMMIT_HASH
do
git diff-tree --no-commit-id --name-only -r $COMMIT_HASH \
| ./audit-doc-changes.py $COMMIT_HASH \
| tee BAD_COMMITS | wc -l
done <COMMITS
25The list of possibly-bad commits:
audit-doc-changes.py: #!/usr/bin/env python3
import sys
# Wildcards manually expanded based on directory contents as of
# 1271bb4de0c0e0a085be239c2418af9c673ffc87
_MIGRATION_MAP = {
'index.md': {'book/src/index.md',
'book/src/getting-started/first-steps.md',
'book/src/getting-started/index.md',
'book/src/getting-started/installation.md'},
'guide.md': {'book/src/guide/cargo-toml-vs-cargo-lock.md',
'book/src/guide/continuous-integration.md',
'book/src/guide/creating-a-new-project.md',
'book/src/guide/dependencies.md',
'book/src/guide/index.md',
'book/src/guide/project-layout.md',
'book/src/guide/tests.md',
'book/src/guide/why-cargo-exists.md',
'book/src/guide/working-on-an-existing-project.md'},
'build-script.md': 'book/src/reference/build-scripts.md',
'config.md': 'book/src/reference/config.md',
'crates-io.md': 'book/src/reference/publishing.md',
'environment-variables.md': 'book/src/reference/environment-variables.md',
'external-tools.md': 'book/src/reference/external-tools.md',
'manifest.md': 'book/src/reference/manifest.md',
'pkgid-spec.md': 'book/src/reference/pkgid-spec.md',
'source-replacement.md': 'book/src/reference/source-replacement.md',
'specifying-dependencies.md': 'book/src/reference/specifying-dependencies.md',
'faq.md': 'book/src/faq.md',
}
MIGRATION_MAP = {}
for k, v in _MIGRATION_MAP.items():
if isinstance(v, str):
v = 'src/doc/' + v
else:
v = {'src/doc/' + s for s in v}
MIGRATION_MAP['src/doc/' + k] = v
commit_hash = sys.argv[1]
changed_files = set(map(str.strip, sys.stdin))
print(changed_files, file=sys.stderr)
problem = False
for changed_file in changed_files:
must_change = MIGRATION_MAP.get(changed_file, None)
if must_change is None:
continue
if isinstance(must_change, str):
problem |= must_change not in changed_files
else:
problem |= all(f not in changed_files for f in must_change)
if problem:
print(commit_hash) |
This comment has been minimized.
This comment has been minimized.
|
Working on cherry-picking the flagged commits:
|
tari commentedJan 6, 2018
•
edited
Doc structure changes in #4904 appear to have lost some commits that were not correctly kept in sync with the
book/files.For instance, both f59eb30 and 53012bd only touched
manifest.mdand notbook/src/reference/manifest.mdso they were lost in the migration. This is just one issue I was bitten by, so there are likely other commits that were lost as well.