phil-blain / CICE

Development repository for the CICE sea-ice model
Other
0 stars 0 forks source link

Make sure all Icepack commits referenced by CICE are in the history of a ref in Icepack #44

Closed phil-blain closed 2 years ago

phil-blain commented 2 years ago

Follow-up to https://github.com/CICE-Consortium/CICE/issues/753.

dans fresh clone (ou git worktree add --detach upstream/main cice4, cd ../cice4):

  1. commits dans CICE qui référencent peut-être un commit Icepack non présent (peut-être pcq pourrait être dans la pré-image i.e.):
    git log -p --submodule=log --format=%h --no-abbrev upstream/main icepack/ |\grep -B2 "not present"|\grep ^[a-f0-9]

    note: log -p ne cherche pas dans les merge commit, donc potentiellement il pourrait manquer des commits qui sont des merge. Une méthode plus robuste qui remplace (1,2,3) est donc:

    while read -r rev; do echo "-- $rev --"; irev=$(git rev-parse $rev:icepack); git -C icepack show -s --oneline $irev; done < <(git rev-list HEAD) &> icepack-revs-all.txt
    \grep "bad object" icepack-revs-all.txt|awk '{print $4}'|sort -u

    celle-ci confirme que la première méthode est OK dans notre cas et trouve tous les commits manquants, notamment:

CICE-Consortium/Icepack@005df7de8e1b351a1c911de63012f19d153a7f15 CICE-Consortium/Icepack@2c042ac4213768e55791098110d2ef2ef845881a CICE-Consortium/Icepack@51a93857d155fc2ceeda30eb22cd6b4f773c8beb CICE-Consortium/Icepack@595c00cfe8121d4e2405282fa08c0907b22e8718 CICE-Consortium/Icepack@bc13d52749f98757a9f013bf7bcf6fdddbb4a19d CICE-Consortium/Icepack@dbc3ce8b01c878d50f531ce84869fb2f2634228f

  1. commits dans Icepack qui sont potentiellement manquants:
    git show --format=ol --submodule=short $(git logo -p --format=%h --no-abbrev upstream/main icepack/ |\grep -B2 "not present"|\grep ^[a-f0-9]) -- icepack|  \grep 'Subproject commit'|awk '{print $3}' |sort -u
  2. commits dans Icepack réellement manquants:
    for i in $(git show --format=ol --submodule=short $(git logo -p --format=%h --no-abbrev upstream/main icepack/ |\grep -B2 "not present"|\grep ^[a-f0-9]) -- icepack|  \grep 'Subproject commit'|awk '{print $3}' |sort -u); do git -C icepack/ show -s --oneline $i; done |& \grep "bad object" |awk '{print $4}'

dans cice3:

  1. afficher commits dans CICE qui référence un commit Icepack non-présent:
    git log --diff-merges=m --no-abbrev --format=ol --find-object <icepack commit> -p icepack|\grep ^[A-Za-z0-9]

    (si il y a un commit de merge, affiche le commit de merge 2 fois)

ou bien avec --diff-merges=1:

git log --diff-merges=1 --no-abbrev --format=ol --find-object <icepack commit> -p icepack|\grep ^[A-Za-z0-9]

Note: ceci ne trouve pas tous les commits qui référencent un commit Icepack non-présent, puisque --find-object ne trouve que les commits qui changent le nombre d'occurence de l'objet. Donc, il faut utiliser le fichier créé par la 2e méthode ci-dessus:

\grep -B1 <icepack commit> icepack-revs-all.txt|\grep ^-- |awk '{print $2}'|sort -u
  1. pousser ref dans Icepack:
    git -C icepack push fork <icepack commit>:refs/cice/<cice commit>

    automatisé (depuis cice4)

    ICEPACK_COMMIT=<icepack commit>; for i in $( \grep -B1 $ICEPACK_COMMIT icepack-revs-all.txt |\grep ^-- |awk '{print $2}'|sort -u) ; do git -C ../cice3/icepack push fork $ICEPACK_COMMIT:refs/cice/$i ; done

I've done all the above in my fork of Icepack:

$ git -C icepack ls-remote fork|\grep cice|sort
005df7de8e1b351a1c911de63012f19d153a7f15        refs/cice/017fdf6c91fe8fd0782015dcef3d0fe5251ee5fb
005df7de8e1b351a1c911de63012f19d153a7f15        refs/cice/048724984b7d0e922a5f91e05700d11a0ef315e1
005df7de8e1b351a1c911de63012f19d153a7f15        refs/cice/24dcb3ea1cce7c10d29422afd21930c330aca117
005df7de8e1b351a1c911de63012f19d153a7f15        refs/cice/25f6da3d67afbe20faeec641578c3f62d529d025
005df7de8e1b351a1c911de63012f19d153a7f15        refs/cice/3c6305ddd81ba05e133df7c48f91101710d95892
005df7de8e1b351a1c911de63012f19d153a7f15        refs/cice/4cbdb64adfc7679c83869d967e143d7605d44198
005df7de8e1b351a1c911de63012f19d153a7f15        refs/cice/6ee546369aec47f7b155a0058175af3c6d56199b
005df7de8e1b351a1c911de63012f19d153a7f15        refs/cice/77aee28234b6b47cf775d68bcfe85b5d73a5ec8e
005df7de8e1b351a1c911de63012f19d153a7f15        refs/cice/b24930ef0510087d413260a473e2f4253d391547
005df7de8e1b351a1c911de63012f19d153a7f15        refs/cice/bd9bdd1e88fdbd9ce16adcd92f65edfdfb981494
005df7de8e1b351a1c911de63012f19d153a7f15        refs/cice/cb9e3c9bd8e11c54f2eee4baca6a23a36a59da22
005df7de8e1b351a1c911de63012f19d153a7f15        refs/cice/ef78774b4e76dc682718b1ad85d3f42bd01b0488
005df7de8e1b351a1c911de63012f19d153a7f15        refs/cice/f381e10de8570c384b0e61ea070cbfbf09e91476
005df7de8e1b351a1c911de63012f19d153a7f15        refs/cice/fe28cec492344972eec2109b264ec9b2bd62f4b6
2c042ac4213768e55791098110d2ef2ef845881a        refs/cice/0ac1c6df4f8570e33e1d06a0ba3ae9ba3e9758de
51a93857d155fc2ceeda30eb22cd6b4f773c8beb        refs/cice/41b4b44d7acb67e0a39a59f603a2da03dcbc4373
595c00cfe8121d4e2405282fa08c0907b22e8718        refs/cice/3af3d1b0e7b2b144cf9f5a183e79e5e6982e1e99
595c00cfe8121d4e2405282fa08c0907b22e8718        refs/cice/9be1c35ae62199ae0ea9c4f339105c7aec3192bf
bc13d52749f98757a9f013bf7bcf6fdddbb4a19d        refs/cice/25b603c9004a8efab02cfe3b97f5179c323f287d
bc13d52749f98757a9f013bf7bcf6fdddbb4a19d        refs/cice/7021d1338dde6320f23ccdc9e5401a6e16580a52
bc13d52749f98757a9f013bf7bcf6fdddbb4a19d        refs/cice/8864f0e906b3e5522a911b186d60a46b09347dd6
bc13d52749f98757a9f013bf7bcf6fdddbb4a19d        refs/cice/93e470a042f2179595608ea22efc86501f659331
bc13d52749f98757a9f013bf7bcf6fdddbb4a19d        refs/cice/9c1056f94c663f4a2838f60167c8ef22866dba61
bc13d52749f98757a9f013bf7bcf6fdddbb4a19d        refs/cice/9c7d03e3734705799e3c2e9e7c7c949c0e85cebf
dbc3ce8b01c878d50f531ce84869fb2f2634228f        refs/cice/38ee675d9e3f9f80eddef30c8f72e51c9142578c
phil-blain commented 2 years ago

done in CICE-Consrtium/Icepack: https://github.com/CICE-Consortium/CICE/issues/753#issuecomment-1223154025.