要爲GCC版本創建的Git標籤,則必須先git clone git://gcc.gnu.org/git/gcc.git ; cd git
克隆Git倉庫,然後獲取釋放分支機構,按照說明in the gcc wiki:
~/gcc> for f in 2_95 3_0 3_1 3_2 3_3 3_4 ; do git config --add remote.origin.fetch refs/remotes/gcc-$f-branch:refs/remotes/origin/gcc-$f-branch; done
~/gcc> for f in 1_00 1_1; do git config --add remote.origin.fetch refs/remotes/egcs_${f}_branch:refs/remotes/origin/egcs_${f}_branch; done
~/gcc> git remote update
然後你就可以對各種創建標籤發佈如下:
#! /bin/sh
# These commits removed "prerelease" from DEV-PHASE
git tag gcc-4.5.0 72d56ebb66ff343f779686a70c7be429238f5d5d
git tag gcc-4.4.4 fdaa572e16a4a3ed881c9daa357c933c06dc31cb
git tag gcc-4.4.3 51a24d9c5dbd1c57edd1e424e9e3d2ff7d51c69b
git tag gcc-4.4.2 36b1f6c832fa33bee30bff27673c0dbdc395c176
git tag gcc-4.4.1 d380ec468c73de5d574a447eafafc2459c7cf30b
git tag gcc-4.4.0 2728d6e41532213f6aeb4389279ea4bfb67fc630
git tag gcc-4.3.5 16d5e336556f03096929f6dde24f512b54a461ec
git tag gcc-4.3.4 cbbc992fb4715f214e3cdde8772a7a689e73b93f
git tag gcc-4.3.3 7c2c8f392d84e82a0486f4620f144d30a7f5b23b
git tag gcc-4.3.2 d68c00434de71550eaf302687e50f25de9f54a7f
git tag gcc-4.3.1 1394445da1475b1bf4f38d021e87f40f45ce89f3
git tag gcc-4.3.0 16c0ea36c9d625d2ae7a101163c8bde9f760a021
git tag gcc-4.2.4 274499b7a967415ae994d93dbe23f30845885aaf
git tag gcc-4.2.3 e5e549f0d8c2f02bf7785f1330c4ee5c5c764d62
git tag gcc-4.2.2 541a9a5982606677fe5bb7068000ba603de6caa9
git tag gcc-4.2.1 13cfe4cbd201e7390fe0f74f87aada6d6c1f9d81
git tag gcc-4.2.0 18187566601443fc139424f6f0563d49ac1760e9
git tag gcc-4.1.2 fd3c8e16b8724e10f1de95bbc157f2ac838ecf6a
git tag gcc-4.1.1 a393db9348d55e6b889d4b87a8728af8fa22f90c
git tag gcc-4.1.0 abe98e32d2e56516eacbfe8aad3dcec9750e4d50
# These commits created unadorned gcc/version.c except for
# gcc-3.3.6, which includes the subsequent parse.y fix.
git tag gcc-4.0.4 e3a4cd335ea4a9fc2c9e2c8f7f9f47b8d104cd6b
git tag gcc-4.0.3 89ef6ca7fc65f4bd4328a7ed92073787767108e1
git tag gcc-4.0.2 ba94c4d3347470baad33d33da0aab6c466d3a76d
git tag gcc-4.0.1 dc4eedf60db8034421294df88f4006758d0a3fee
git tag gcc-4.0.0 81a28974b35a40ea0f9e49ebcf461808f79cd1c9
git tag gcc-3.4.6 359e576cf4a70392fda974114498ba451310ab05
git tag gcc-3.4.5 31f752f38d95c8d5b8f4368ab7f6630dd8569190
git tag gcc-3.4.4 8e095405a5fe8adf3f01361c05e7010a9b94e8cc
git tag gcc-3.4.3 5625cbd10a9d3a1fbe7541f1776f8a3efdbee1e8
git tag gcc-3.4.2 7db743b07c1d46b879c0cb1a43597ed5e9feae2c
git tag gcc-3.4.1 a1d11c1349ec7908053ab5d2c6200652e4d8c700
git tag gcc-3.4.0 3b3ea0678785edcb024c8fb6c2a870a1260bd407
git tag gcc-3.3.6 67be34f080d258b9accdc9b2dc60e522a071b24d
git tag gcc-3.3.5 34ae055bd7b7f51982f981c9e039899e948d4a79
git tag gcc-3.3.4 fbd67149061d692b9da2dbabd782367cdc429551
git tag gcc-3.3.3 46f1268b65c1b8634a5bd1e10b9c8410d1387010
git tag gcc-3.3.2 79d8c6c28fc8d439fe84d65a2fbfe23df3527d93
git tag gcc-3.3.1 7650ad7cf3c4148167ec46b700ef164b9cc96dbf
git tag gcc-3.3 b96376930b5c43b42d357a269de640596dc0fe34
git tag gcc-3.2.3 d79068c19439ded5d3c025455c7d56dd33b968fb
git tag gcc-3.2.2 bfac687d15cfc11828f9d8a0a64616dfb9cfa58d
git tag gcc-3.2.1 85fed4a8c013f5532a7ac6a831fc3a86b20045f9
git tag gcc-3.2 0fc80fd06dd97851b2b63e09becd3cb9f4e0fffc
git tag gcc-3.1.1 941e96525189b92bc056913f51f362b96ea5cb45
git tag gcc-3.1 b7ba1b367cf7cedf834b83cc47594bac9549fab0
# These commits set "(release)" in gcc/versionc.c
git tag gcc-2.95.3 35ab1cbf431d6c6cefe00721286cfce1737d11c7
git tag gcc-2.95.2 980266352750ab98bbc2a4fa2da04a6e4c2af019
git tag gcc-2.95.1 ee41387a5663e9239605bf48259227016944dbf1
git tag gcc-2.95 100d7691ebd6455c709c5ceae36bdd6baa4a2087
注意,提交上述手動導出ID,但已證實對SVN在可能的腳本下面。 我沒有提供EGCS版本的標籤,但訣竅是查看發行版分支並使用git log -p gcc/version.c
來顯示相關的提交ID。
我試圖找到一種方法來做快速的自動標記設置,甚至成功的最近(gcc-4.1 +)發佈,但似乎gcc-3.X和早期gcc-4.0.X標簽在SVN倉庫沒有被導入官方倉庫,所以我無法爲這些倉庫生成正確的結果。該腳本如下,但它又爲舊版本生成不正確的標籤:
#! /bin/bash
# git clone git://gcc.gnu.org/git/gcc.git && cd gcc
s=svn://gcc.gnu.org/svn/gcc
# git svn init $s
echo 'Creating tags.db (This takes several seconds.)'
git log --grep=git-svn-id: --remotes \
| egrep '(^commit |git-svn-id:)' \
| sed -e 's/^ *git-svn-id:[^@]*@\([0-9]*\).*/\1/' \
| awk 'BEGIN { RS = "commit " ; FS = "\n" } { print $1, $2 }' \
> tags.db
echo 'Reading tags.db'
while read cid rev ; do commit[$rev]=$cid ; done < tags.db
echo 'Fetching SVN revisions and tagging'
echo ' SVN rev'
echo ' Git commit ID in git SVN rev Tag'
echo ' ======================================== ======= ======= ======= = = ='
echo ' (Waiting for remote svn info. This takes a few seconds.)'
for t in `svn ls $s/tags | fgrep release | sed -e '[email protected]/[email protected]@'`
do
rev=`svn info $s/tags/$t | grep '^Last Changed Rev: ' | awk '{ print $4 }'`
# Scan the svn log for the first SVN revision mirrored in GIT.
# This is required because git-svn does not mirror SVN tag/branch revisions.
for r in `svn log -l 2 $s/tags/$t \
| grep '^r[0-9][0-9]* | ' \
| awk '{ print $1 }' \
| sed -e 's/r//'`
do
if [ x"${commit[$r]}" = x ] ; then continue ; fi
printf " %40s %7s %7s %s\n" "${commit[$r]}" "$r" "$rev" "$t"
if [ x"${commit[$r]}" != x ] ; then
git tag -f "$t" "${commit[$r]}"
fi
break
done
done
echo 'Removing tags.db'
rm tags.db
echo 'Done.'
它的工作!我也遵循那些你引用的說明(http://gcc.gnu.org/wiki/GitMirror#The_various_release_branches),現在有我需要的標籤。 感謝您的幫助。 – 2010-07-21 04:04:26
@Glenn:歡迎您:)這很奇怪,您需要額外的步驟,因爲gobling refspec remote.origin.fetch refs/remotes/*:refs/remotes/origin/*'應該導入每個分支。 – VonC 2010-07-21 04:11:06
我錯了:它沒有爲我工作。我擁有的標籤是部分的,來自我的其他努力。這很可能是因爲這些其他努力造成的。我將在您引用的維基頁面之後重新開始重試。 – 2010-07-21 04:47:37