This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

tags-on-branched-commits to be restored on Monday


I wrote and have run the following script to restore
all tags to commits on branches.

$ cat tag-restore
#!/bin/bash
test $# = 0 || exit 1

orig=/var/tmp/glibc-pristine/.git
public=/w/glibc/.git

trap 'st=$?; rm -rf $mapdir && exit $st' 0
trap 'exit $?' 1 2 13 15
mapdir=$(mktemp -d) || exit 1

# Build a table mapping each tagged SHA1 to its list of tag names:
# Note the leading "*" to get the referent of each tag object.
printf 'building SHA1-to-tag-name map using orig repo...\n'
git --git-dir=$orig for-each-ref --shell \
      --format='r=%(refname) tag=${r#refs/tags/} o=%(*objectname)' refs/tags |\
    while read entry; do
        eval "$entry"
        echo "cvs/$tag" >> $mapdir/"$o"
    done

branch_heads=$(git --git-dir=$orig branch|sed s/..//|grep -v master)
for branch in $(echo "$branch_heads"); do
    # Propagate tags on $BRANCH in a pristine, just-converted-from-CVS git
    # repository to the cset-aggregated and grafted public glibc.git.

    # Use an array to map indices 0..N to the corresponding commit-on-orig-branch:
    i=0
    for c in $(git --git-dir=$orig rev-list master..$branch); do
	old_c[$i]=$c
	i=$[i+1]
    done

    # Apply those tags to the $public tree
    export GIT_DIR=$public
    i=0
    n_tagged=0
    n=$(git rev-list master..origin/cvs/$branch|wc -l)
    printf "  propagating tags to the $n-commit branch, $branch...\n"
    for c in $(git rev-list master..origin/cvs/$branch);do
	f=$mapdir/${old_c[$i]}
	tag_list=$(test -r $f && cat $f) &&
	    for t in $(echo "$tag_list"); do
		git tag -f "$t" $c
		n_tagged=$[n_tagged+1]
	    done
	i=$[i+1]
	printf '  %03d/%03d (#t=%d)\r' $i $n $n_tagged
    done
    printf "\n$branch: applied/moved $n_tagged tags\n"
done
=============================================================
It generated this output:

    building SHA1-to-tag-name map using orig repo...
      propagating tags to the 207-commit branch, fedora-2_3-branch...
      207/207 (#t=68)
    fedora-2_3-branch: applied/moved 68 tags
      propagating tags to the 411-commit branch, fedora-2_5-branch...
      411/411 (#t=161)
    fedora-2_5-branch: applied/moved 161 tags
      propagating tags to the 554-commit branch, fedora-branch...
      554/554 (#t=261)
    fedora-branch: applied/moved 261 tags
      propagating tags to the 1525-commit branch, glibc-2-1-branch...
      1525/1525 (#t=0)
    glibc-2-1-branch: applied/moved 0 tags
      propagating tags to the 661-commit branch, glibc-2-2-branch...
      661/661 (#t=0)
    glibc-2-2-branch: applied/moved 0 tags
      propagating tags to the 1161-commit branch, glibc-2_0_x...
      1161/1161 (#t=26)
    glibc-2_0_x: applied/moved 26 tags
      propagating tags to the 2-commit branch, glibc-2_10-branch...
      002/002 (#t=1)
    glibc-2_10-branch: applied/moved 1 tags
      propagating tags to the 303-commit branch, glibc-2_3-branch...
      303/303 (#t=6)
    glibc-2_3-branch: applied/moved 6 tags
      propagating tags to the 117-commit branch, glibc-2_5-branch...
      117/117 (#t=3)
    glibc-2_5-branch: applied/moved 3 tags
      propagating tags to the 6-commit branch, glibc-2_6-branch...
      006/006 (#t=0)
    glibc-2_6-branch: applied/moved 0 tags
      propagating tags to the 1-commit branch, glibc-2_7-branch...
      001/001 (#t=0)
    glibc-2_7-branch: applied/moved 0 tags
      propagating tags to the 0-commit branch, glibc-2_8-branch...

    glibc-2_8-branch: applied/moved 0 tags
      propagating tags to the 0-commit branch, glibc-2_9-branch...

    glibc-2_9-branch: applied/moved 0 tags
      propagating tags to the 883-commit branch, sparc-2_0_x-branch...
      883/883 (#t=25)
    sparc-2_0_x-branch: applied/moved 25 tags
      propagating tags to the 0-commit branch, thomas-posix1996...

    thomas-posix1996: applied/moved 0 tags
===========================

I'll push the tags on Monday, in case anyone feels
like reviewing this and spots a problem.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]