aoc-all

My solutions to all Advent of Code
git clone https://git.instinctive.eu/aoc-all.git
Log | Files | Refs | README | LICENSE

import-past.sh (3569B)


      1 #!/bin/sh
      2 
      3 # Copyright (c) 2024, Natacha Porté
      4 #
      5 # Permission to use, copy, modify, and distribute this software for any
      6 # purpose with or without fee is hereby granted, provided that the above
      7 # copyright notice and this permission notice appear in all copies.
      8 #
      9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     16 
     17 set -Cuex
     18 
     19 rm -rf aoc-*
     20 
     21 NL='
     22 '
     23 
     24 mkdir aoc-all
     25 cd aoc-all
     26 git init -b trunk
     27 cd ..
     28 
     29 git clone https://github.com/faelys/aoc-2022.git
     30 cd aoc-2022
     31 FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch --tree-filter \
     32     'rm -f LICENSE && mkdir -p 2022 && mv [^2]* 2022/' HEAD
     33 git update-ref -d refs/original/refs/heads/main \
     34     afd60166b3442493163230effb1e9b19fb10e2c6
     35 FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch --msg-filter \
     36     'sed "s/^Initial commit\$/Initial 2022 commit/"' HEAD
     37 git update-ref -d refs/original/refs/heads/main \
     38     f75d9dbcb613dbc8b952d46c662293bdbea0ed54
     39 cd ..
     40 
     41 cd aoc-all
     42 git fetch ../aoc-2022
     43 # git update-ref HEAD FETCH_HEAD
     44 git reset --hard FETCH_HEAD
     45 cd ..
     46 
     47 git clone https://github.com/faelys/aoc-2023.git
     48 cd aoc-2023
     49 FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch --msg-filter \
     50     'sed "s/^Add project infrastructure\$/Add 2023 infrastructure/"' HEAD
     51 git update-ref -d refs/original/refs/heads/trunk \
     52     41f18daf4e7e805ada852b79ca5986c93d146922
     53 FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch --parent-filter \
     54     'sed s/-p\ 256d123f149ab6b41e0397ba6d39f60f9e911c8d//' HEAD
     55 git update-ref -d refs/original/refs/heads/trunk \
     56     cb813ee19bd9ddeb7150c39d4ba027868ebdaf4a
     57 FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch --tree-filter \
     58     'rm -rf LICENCE .fossil-settings && mkdir -p 2023 && mv [^2]* 2023' HEAD
     59 git update-ref -d refs/original/refs/heads/trunk \
     60     c3e8914da1869e6a36031f26de1c3cd347686578
     61 cd ..
     62 
     63 
     64 cd aoc-all
     65 git fetch ../aoc-2023
     66 git checkout -b fetched FETCH_HEAD
     67 git rebase --onto trunk --root --committer-date-is-author-date
     68 git checkout trunk
     69 git merge --ff fetched
     70 git branch -d fetched
     71 git gc --prune=now
     72 cd ..
     73 
     74 # Failed alternative to the last block, using a bare repository:
     75 #
     76 # cd aoc-all
     77 # test "$(git rev-list --all --max-parents=0 | wc -l)" -eq 1
     78 # ROOT_ID="$(git rev-list --all --max-parents=0)"
     79 # OLD_HEAD="$(git show-ref trunk)"
     80 # OLD_HEAD="${OLD_HEAD%% *}"
     81 # git fetch ../aoc-2023
     82 # git branch fetched FETCH_HEAD
     83 # test "$(git rev-list --all --max-parents=0 | wc -l)" -eq 2
     84 # test "$(git rev-list --all --max-parents=0 \
     85 #         | grep -Fv "${ROOT_ID}" | wc -l)" \
     86 #     -eq 1
     87 # FETCH_ROOT="$(git rev-list --all --max-parents=0 \
     88 #               | grep -Fv "${ROOT_ID}")"
     89 # git replace --gr
     90 # FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch trunk..fetched
     91 # git reset --soft fetched
     92 # git branch -d fetched
     93 # git update-ref -d refs/original/refs/heads/fetched
     94 # git update-ref -d refs/replace/"${FETCH_ROOT}"
     95 # git gc --prune=now
     96 # cd ..
     97 
     98 cd aoc-all
     99 git fast-export HEAD | fossil import --git \
    100     -A admin \
    101     --attribute 'natgh@instinctive.eu nat' \
    102     --attribute 'natacha@instinctive.eu nat' \
    103     ../aoc-fossil
    104 fossil user -R ../aoc-fossil \
    105     new nat 'Natasha Kerensikova <natgh@instinctive.eu>' nat
    106 cd ..