ehi*_*ime 10 svn git bash github repository
我试图克隆/镜像GitHub仓库时遇到了几个错误.我试过在本地通过HTTPS或服务器到服务器这样做(所以我可以将它热回复到我们的SVN服务器仓库).我正在使用的BASH脚本应该转储repo失败并出现以下错误:
$ svnsync init file:/// home/jdaniel/www/clone/rest https://github.com/ehime/Restful-MVC-Prototype
svnsync:E125005:错误或意外的属性值
svnsync:E125003:虚假日期$ svnsync同步文件:/// home/jdaniel/www/clone/rest https://github.com/ehime/Restful-MVC-Prototype
svnsync:E200007:请求的报告未知.
我也试过使用snvrdump但得到一个类似奇怪的问题:
$ svnrdump dump https://github.com/ehime/CLI-Parser
SVN-fs-dump-format-version: 3
UUID: cfadd8e1-f89a-a5da-a424-ce57b7db7bff
Revision-number: 0
Prop-content-length: 163
Content-length: 163
K 10
git-commit
V 0
K 10
svn:author
V 0
K 8
svn:date
V 0
K 7
svn:log
V 0
K 25
svn:wc:ra_dav:version-url
V 39
/ehime/Restful-MVC-Prototype/!svn/bln/0
PROPS-END
* Dumped revision 0.
Revision-number: 1
Prop-content-length: 299
Content-length: 299
K 10
git-commit
V 40
ec089b697a5698f71d5edffb2f90b1385acbc53f
K 10
svn:author
V 5
ehime
K 8
svn:date
V 27
2013-08-16T17:16:26.000000Z
K 7
svn:log
V 61
Initial repository configuration with working hello world bs
K 25
svn:wc:ra_dav:version-url
V 39
/ehime/Restful-MVC-Prototype/!svn/bln/1
PROPS-END
svnrdump: E200007: The requested report is unknown.
Run Code Online (Sandbox Code Playgroud)
这以相同的Requested report is unknown错误结束.
到目前为止我测试的所有GitHub repos(4-5)都会报告未知错误.请帮忙.
@西蒙索比什
\n根据 Simons 的要求,这是我最终编写的用于将 Subversion 移至 GH 的脚本
\n#!/usr/local/env bash\n# Converter for GitHub -> Subversion Repositories\n\n# CPR : Jd Daniel :: Ehime-ken\n# MOD : 2013-03-09 @ 16:26:53; 2017-01-31 @ 13:36:15 Simon Sobisch\n# VER : Version 1c\n\n# the Github SVN url to clone from\nURL={THE_SVN_URL} # https://github.com/user/repo/\n\n# the SVN url to clone to\nREPO={THE_REPO_ROOT} in # svn+ssh://user@domain.com/api/svn_name\n\n# the SVN structure\nSVNTRUNK=${SVN_TRUNK-trunk}\nSVNTAGS=${SVN_TAGS-tags}\nSVNBRANCHES=${SVN_BRANCHES-branches}\n\n# use the trunk, branch, etc... I'm using the trunk\nSVN="${REPO}/$SVNTRUNK"\n\n\nclear || cls; # set -x #debug\n\n## if you want to burn and rebuild your repo, uncomment below\n#\n#echo "Burning Repo..."\n#svn rm $REPO/{$SVNTRUNK,$SVNTAGS,$SVNBRANCHES} -m "Burning..."\n\n#echo "Rebuilding Repo...."\n#svn mkdir $REPO/{$SVNTRUNK,$SVNTAGS,$SVNBRANCHES} -m "Rebuilding..."\n\n# cleanup\nfind -maxdepth 1 -type d ! -name '.*' |xargs rm -rf; # tmp\n\n# dirs\nSVN_FOLDER=`pwd`"/svn"\nGIT_FOLDER=`pwd`"/git"\n\n\n# revs\nENDREV=`svn info $URL |grep Revision: |awk '{print $2}'`\nCURREV=1\n\n mkdir -p $SVN_FOLDER $GIT_FOLDER\n\necho -e "\\nLinking SVN repo\\n"\n\n cd $SVN_FOLDER\n svn co $SVN .\n\necho -e "\\nDownloading GIT repo\\n"\n\n cd $GIT_FOLDER\n git svn init -s $URL \\\n -T $SVNTRUNK \\\n -t $SVNTAGS \\\n -b $SVNBRANCHES \\\n --prefix=svn/\n\n # Set authors so we get prettier authors\n if [ -f "../authors" ]; then\n git config svn.authorsfile ../authors\n fi\n\n echo -e "\\nFound ${ENDREV} revisions\\n"\n\n for (( REVISION=$CURREV; REVISION<$ENDREV+1; REVISION++ ))\n do\n\n cd $GIT_FOLDER\n\n echo -e "\\n---> FETCHING: ${REVISION}\\n"\n\n git svn fetch -r$REVISION; echo -e "\\n"\n git rebase `git svn find-rev r$REVISION`; echo -e "\\n"\n\n # STATUS: git log -p -1 `git svn find-rev r19` --pretty=format: --name-only --diff-filter=A | sort -u\n ADD=$(git log -p -1 `git svn find-rev r$REVISION` --pretty=format: --name-only --diff-filter=A |awk '{printf "%s ", $1}')\n MOD=$(git log -p -1 `git svn find-rev r$REVISION` --pretty=format: --name-only --diff-filter=M |awk '{printf "%s ", $1}')\n DEL=$(git log -p -1 `git svn find-rev r$REVISION` --pretty=format: --name-only --diff-filter=D |awk '{printf "%s ", $1}')\n\n # copy new files\n for i in $ADD\n do\n cp --parents $i $SVN_FOLDER/\n done\n\n\n # copy modified files\n for i in $MOD\n do\n cp --parents $i $SVN_FOLDER/\n done\n\n\n # set opts for SVN logging\n HASH=$(git log -1 --pretty=format:'Hash: %h <%H>')\n AUTHOR='Jd Daniel <dodomeki@gmail.com>' # or $(git log -1 --pretty="%cn <%cE>")\n\n TMPDATE=$(git log -1 --pretty=%ad --date=iso8601)\n DATE=$(date --date "$TMPDATE" -u +"%Y-%m-%dT%H:%M:%S.%N" |sed 's/.....$/Z/g')\n\n LOGMSG=$(git log -1 --pretty=%s)\n\n # move to svn\n cd $SVN_FOLDER\n\n\n # burn file if it exists....\n if [ "$DEL" != "" ]; then\n for i in $DEL\n do\n test -f $i && svn --force rm $i\n done\n fi\n\n # first round of additions....\n [ -z "$ADD" ] || svn --force add $ADD\n [ -z "$MOD" ] || svn --force add $MOD\n\n\n # try 2 for adding in case we missed ? files\n ADDTRY=$(svn st . |grep "^?" |awk '{print $2}')\n [ -z "$ADDTRY" ] || svn --force add $ADDTRY\n\n # do commit\n svn ci -m "$LOGMSG"$'\\n\\n'"$HASH"\n\n # servers pre-revprop-change\n # cp hooks/pre-revprop-change.tmpl pre-revprop-change; chmod +x pre-revprop-change\n # if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:author" ]; then exit 0; fi\n # if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:date" ]; then exit 0; fi\n # echo "Changing revision properties other than svn:log, svn:author and svn:date is prohibited" >&2\n\n # change this commits author and date\n svn propset --revprop -r HEAD svn:author "$AUTHOR"\n svn propset --revprop -r HEAD svn:date "$DATE"\n\n done\n\nexit\nRun Code Online (Sandbox Code Playgroud)\n不管怎样,git-svn 很好地支持了这一点,只是与通常的 git svn 克隆略有不同。
\n我们使用稍微不同的而不是标准的项目/主干|分支|标签,parent/trunk|branches|tags/project因此您\xe2\x80\x99会看到我指定了 -T/-t/-b标志。
git svn init\nRun Code Online (Sandbox Code Playgroud)\n这是我从现有的本地 git 存储库中所做的:
\n# Create the project directory in subversion\n$ /usr/bin/svn mkdir\n https://example.com/svn/parent/trunk/project\n -m "Make project directory."\nCommitted revision 200.\n\n# Initialize git-svn, doesn't fetch anything yet\n$ git svn init https://example.com/svn/\n -T parent/trunk/project\n -t parent/tags/project\n -b parent/branches/project\n --prefix=svn/\n\n# Set authors so we get prettier authors\n$ git config svn.authorsfile ../authors\n\n# Now pull down the svn commits\n$ git svn fetch\nW: Ignoring error from SVN, ...\nW: Do not be alarmed at the above message git-svn ...\nThis may take a while on large repositories\nr200 = (guid) (refs/remotes/svn/trunk)\n\n# We should now see our svn trunk setup under our svn remote\n$ git branch -av\n* master c3a7161 The latest git commit.\n remotes/svn/trunk 3b7fed6 Make project directory.\n\n# Now we want to take all of our local commits and \n# rebase them on top of the new svn/trunk\n$ git rebase svn/trunk\nFirst, rewinding head to replay your work on top of it...\nApplying: First git commit\nApplying: The latest git commit\n\n# Now we should see our local commits applied\n# on top of svn/trunk\n$ git lg\n* 52b7977 (HEAD, master) The latest git commit\n* a34e162 First git commit\n* 3b7fed6 (svn/trunk) Make project directory.\n\n# Everything is cool, push it back to svn\n$ git svn dcommit\nCommitting to https://example.com/svn/parent/trunk/project\n...\n\n\xe2\x80\x93prefix=svn\nRun Code Online (Sandbox Code Playgroud)\n我最近特别喜欢的一个标志git svn clone是,您也可以将其与 一起使用--prefix=svn/。
这将为远程 Subversion 分支、标签和主干的所有跟踪分支添加 svn/ 前缀,使其看起来非常像常规 git 远程使用的常用 origin/ 习惯用法。
\n由于跟踪分支具有前缀,您还可以将它们用作本地分支名称,例如:
\n# Name your copy of svn/trunk "trunk" instead of "master"\n$ git checkout -b trunk master\nSwitched to a new branch 'trunk'\n\n$ git branch -d master\nDeleted branch master (was 33c3136).\n\n$ git branch -av\n* trunk 33c3136 Latest svn commit\n* remotes/svn/trunk 33c3136 Latest svn commit\nRun Code Online (Sandbox Code Playgroud)\n然后,如果您想跟踪其他分支:
\n$ git checkout -b featurea svn/featurea\nRun Code Online (Sandbox Code Playgroud)\n