@@ -48,10 +48,10 @@ Update and activate the rustup toolchain 'miri' to the commit given in the
4848`rustup-toolchain-install-master` must be installed for this to work. Any extra
4949flags are passed to `rustup-toolchain-install-master`.
5050
51- ./miri rustc-pull:
52- Pull and merge Miri changes from the rustc repo. The fetched commit is stored in
53- the `rust-version` file, so the next `./miri toolchain` will install the rustc
54- we just pulled.
51+ ./miri rustc-pull <commit> :
52+ Pull and merge Miri changes from the rustc repo. Defaults to fetching the latest
53+ rustc commit. The fetched commit is stored in the `rust-version` file, so the
54+ next `./miri toolchain` will install the rustc that just got pulled.
5555
5656./miri rustc-push <github user> <branch>:
5757Push Miri changes back to the rustc repo. This will pull a copy of the rustc
@@ -113,18 +113,17 @@ toolchain)
113113 ;;
114114rustc-pull)
115115 cd " $MIRIDIR "
116- FETCH_COMMIT=$( git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1)
117- # We can't pull from a commit with josh
118- # (https://github.com/josh-project/josh/issues/1034), so we just hope that
119- # nothing gets merged into rustc *during* this pull.
120- git fetch http://localhost:8000/rust-lang/rust.git$JOSH_FILTER .git master
121- # Just verify that `master` didn't move.
122- if [[ $FETCH_COMMIT != $( git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1) ]]; then
123- echo " Looks like something got merged into Rust *while we were pulling*. Aborting. Please try again."
116+ FETCH_COMMIT=" $1 "
117+ if [ -z " $FETCH_COMMIT " ]; then
118+ FETCH_COMMIT=$( git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1)
124119 fi
125- echo " $FETCH_COMMIT " > rust-version # do this *before* merging as merging will fail in case of conflicts
120+ # Update rust-version file. As a separate commit, since making it part of
121+ # the merge has confused the heck out of josh in the past.
122+ echo " $FETCH_COMMIT " > rust-version
123+ git commit rust-version -m " Preparing for merge from rustc"
124+ # Fetch given rustc commit and note down which one that was
125+ git fetch http://localhost:8000/rust-lang/rust.git@$FETCH_COMMIT$JOSH_FILTER .git
126126 git merge FETCH_HEAD --no-ff -m " Merge from rustc"
127- git commit rust-version --amend -m " Merge from rustc"
128127 exit 0
129128 ;;
130129rustc-push)
@@ -157,11 +156,22 @@ rustc-push)
157156 fi
158157 git fetch https://github.com/rust-lang/rust $BASE
159158 git push https://github.com/$USER /rust $BASE :refs/heads/$BRANCH -f
159+ echo
160160 # Do the actual push.
161161 cd " $MIRIDIR "
162162 echo " Pushing Miri changes..."
163163 git push http://localhost:8000/$USER /rust.git$JOSH_FILTER .git HEAD:$BRANCH
164- exit 0
164+ # Do a round-trip check to make sure the push worked as expected.
165+ echo
166+ git fetch http://localhost:8000/$USER /rust.git@$JOSH_FILTER .git $BRANCH & > /dev/null
167+ if [[ $( git rev-parse HEAD) != $( git rev-parse FETCH_HEAD) ]]; then
168+ echo " ERROR: Josh created a non-roundtrip push! Do NOT merge this into rustc!"
169+ exit 1
170+ else
171+ echo " Confirmed that the push round-trips back to Miri properly. Please create a rustc PR:"
172+ echo " https://github.com/$USER /rust/pull/new/$BRANCH "
173+ exit 0
174+ fi
165175 ;;
166176many-seeds)
167177 for SEED in $( { echo obase=16; seq 0 255; } | bc) ; do
0 commit comments