-
Type: Task
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
Python Drivers
-
Not Needed
-
Context
In PYTHON-4264 we moved some files to nested synchronous and asynchronous folders, without preserving git blame. We should restore the git blame for the synchronous files to point back to the previous files. I wrote a script to do this. (Inlined below).
Definition of done
Ensure git blame is working for files that migrated from
pymongo/
and for gridfs as well.
Pitfalls
Ensure we preserve overall git history.
set -eux export branch=fix-pymongo-history # Commit prior to PYTHON-4264 BASE_COMMIT=da03da34c6498378d6a9a7f5c9c5c19cd579d9b1 pymongo_files=("client_session.py" "encryption.py" "auth_oidc.py" \ "collection.py" "pool.py" "command_cursor.py" "mongo_client.py" \ "change_stream.py" "cursor.py" \ "auth.py" "database.py") git checkout master git branch -D $branch || true git checkout -b $branch git checkout master git branch -D restore-file || true git checkout -b restore-file $BASE_COMMIT function move() { local name=$1 local source=$2 local target=$3 echo $target # The important rename commit. git mv $source $target git add $target git commit -m "Rename $source to $target" git checkout HEAD~1 $source git add $source # Sync files with latest state. git checkout master $target git checkout master $source git add $target $source git commit -m "Sync $name to master" } for name in "${pymongo_files[@]}" do mkdir -p pymongo/synchronous source="pymongo/$name" target="pymongo/synchronous/$name" move $name $source $target done mkdir -p gridfs/synchronous name="grid_file.py" source="gridfs/$name" target="gridfs/synchronous/$name" move $name $source $target # # There should not be any conflicts or changes to target file in this commit! git merge -X theirs $branch -m "Merge $branch" # # The missing "fast-forward merge" feature on GitHub. git checkout $branch && git merge --ff-only restore-file
- is related to
-
PYTHON-4867 Restore git blame for pymongo/uri_parser.py
- Closed