gpt4 book ai didi

git - 通过 HTTP 转储远程基于 Git 的 SVN 存储库时出错

转载 作者:IT王子 更新时间:2023-10-29 01:05:01 25 4
gpt4 key购买 nike

我在尝试克隆/镜像 GitHub 存储库时遇到了几个错误。我已经尝试通过本地 HTTPS 或服务器到服务器执行此操作(因此我可以将其热复制回我们的 SVN 服务器存储库)。我正在使用的 BASH 脚本应该转储 repo 失败并出现以下错误:

$ svnsync init file:///home/jdaniel/www/clone/rest https://github.com/ehime/Restful-MVC-Prototype
svnsync: E125005: Wrong or unexpected property value
svnsync: E125003: Bogus date

$ svnsync sync file:///home/jdaniel/www/clone/rest https://github.com/ehime/Restful-MVC-Prototype
svnsync: E200007: The requested report is unknown.

我也尝试过使用 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.

这以相同的 Requested report is unknown 错误结束。

到目前为止,我测试过的所有 GitHub 存储库 (4-5) 都会抛出报告未知错误。请帮忙。

最佳答案

@SimonSobisch

根据 Simons 的要求,这是我最终编写的将 Subversion 移动到 GH 的脚本

#!/usr/local/env bash
# Converter for GitHub -> Subversion Repositories

# CPR : Jd Daniel :: Ehime-ken
# MOD : 2013-03-09 @ 16:26:53; 2017-01-31 @ 13:36:15 Simon Sobisch
# VER : Version 1c

# the Github SVN url to clone from
URL={THE_SVN_URL} # https://github.com/user/repo/

# the SVN url to clone to
REPO={THE_REPO_ROOT} in # svn+ssh://user@domain.com/api/svn_name

# the SVN structure
SVNTRUNK=${SVN_TRUNK-trunk}
SVNTAGS=${SVN_TAGS-tags}
SVNBRANCHES=${SVN_BRANCHES-branches}

# use the trunk, branch, etc... I'm using the trunk
SVN="${REPO}/$SVNTRUNK"


clear || cls; # set -x #debug

## if you want to burn and rebuild your repo, uncomment below
#
#echo "Burning Repo..."
#svn rm $REPO/{$SVNTRUNK,$SVNTAGS,$SVNBRANCHES} -m "Burning..."

#echo "Rebuilding Repo...."
#svn mkdir $REPO/{$SVNTRUNK,$SVNTAGS,$SVNBRANCHES} -m "Rebuilding..."

# cleanup
find -maxdepth 1 -type d ! -name '.*' |xargs rm -rf; # tmp

# dirs
SVN_FOLDER=`pwd`"/svn"
GIT_FOLDER=`pwd`"/git"


# revs
ENDREV=`svn info $URL |grep Revision: |awk '{print $2}'`
CURREV=1

mkdir -p $SVN_FOLDER $GIT_FOLDER

echo -e "\nLinking SVN repo\n"

cd $SVN_FOLDER
svn co $SVN .

echo -e "\nDownloading GIT repo\n"

cd $GIT_FOLDER
git svn init -s $URL \
-T $SVNTRUNK \
-t $SVNTAGS \
-b $SVNBRANCHES \
--prefix=svn/

# Set authors so we get prettier authors
if [ -f "../authors" ]; then
git config svn.authorsfile ../authors
fi

echo -e "\nFound ${ENDREV} revisions\n"

for (( REVISION=$CURREV; REVISION<$ENDREV+1; REVISION++ ))
do

cd $GIT_FOLDER

echo -e "\n---> FETCHING: ${REVISION}\n"

git svn fetch -r$REVISION; echo -e "\n"
git rebase `git svn find-rev r$REVISION`; echo -e "\n"

# STATUS: git log -p -1 `git svn find-rev r19` --pretty=format: --name-only --diff-filter=A | sort -u
ADD=$(git log -p -1 `git svn find-rev r$REVISION` --pretty=format: --name-only --diff-filter=A |awk '{printf "%s ", $1}')
MOD=$(git log -p -1 `git svn find-rev r$REVISION` --pretty=format: --name-only --diff-filter=M |awk '{printf "%s ", $1}')
DEL=$(git log -p -1 `git svn find-rev r$REVISION` --pretty=format: --name-only --diff-filter=D |awk '{printf "%s ", $1}')

# copy new files
for i in $ADD
do
cp --parents $i $SVN_FOLDER/
done


# copy modified files
for i in $MOD
do
cp --parents $i $SVN_FOLDER/
done


# set opts for SVN logging
HASH=$(git log -1 --pretty=format:'Hash: %h <%H>')
AUTHOR='Jd Daniel <dodomeki@gmail.com>' # or $(git log -1 --pretty="%cn <%cE>")

TMPDATE=$(git log -1 --pretty=%ad --date=iso8601)
DATE=$(date --date "$TMPDATE" -u +"%Y-%m-%dT%H:%M:%S.%N" |sed 's/.....$/Z/g')

LOGMSG=$(git log -1 --pretty=%s)

# move to svn
cd $SVN_FOLDER


# burn file if it exists....
if [ "$DEL" != "" ]; then
for i in $DEL
do
test -f $i && svn --force rm $i
done
fi

# first round of additions....
[ -z "$ADD" ] || svn --force add $ADD
[ -z "$MOD" ] || svn --force add $MOD


# try 2 for adding in case we missed ? files
ADDTRY=$(svn st . |grep "^?" |awk '{print $2}')
[ -z "$ADDTRY" ] || svn --force add $ADDTRY

# do commit
svn ci -m "$LOGMSG"$'\n\n'"$HASH"

# servers pre-revprop-change
# cp hooks/pre-revprop-change.tmpl pre-revprop-change; chmod +x pre-revprop-change
# if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:author" ]; then exit 0; fi
# if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:date" ]; then exit 0; fi
# echo "Changing revision properties other than svn:log, svn:author and svn:date is prohibited" >&2

# change this commits author and date
svn propset --revprop -r HEAD svn:author "$AUTHOR"
svn propset --revprop -r HEAD svn:date "$DATE"

done

exit

无论如何,git-svn 对此提供了很好的支持,只是在通常的 git svn clone 上略有不同。

我们使用略有不同的 parent/trunk|branches|tags/project 而不是标准的 project/trunk|branches|tags所以你会看到我指定了 -T/-t/-b 标志。

git svn init

这是我从现有的本地 git 存储库中所做的:

# Create the project directory in subversion
$ /usr/bin/svn mkdir
https://example.com/svn/parent/trunk/project
-m "Make project directory."
Committed revision 200.

# Initialize git-svn, doesn't fetch anything yet
$ git svn init https://example.com/svn/
-T parent/trunk/project
-t parent/tags/project
-b parent/branches/project
--prefix=svn/

# Set authors so we get prettier authors
$ git config svn.authorsfile ../authors

# Now pull down the svn commits
$ git svn fetch
W: Ignoring error from SVN, ...
W: Do not be alarmed at the above message git-svn ...
This may take a while on large repositories
r200 = (guid) (refs/remotes/svn/trunk)

# We should now see our svn trunk setup under our svn remote
$ git branch -av
* master c3a7161 The latest git commit.
remotes/svn/trunk 3b7fed6 Make project directory.

# Now we want to take all of our local commits and
# rebase them on top of the new svn/trunk
$ git rebase svn/trunk
First, rewinding head to replay your work on top of it...
Applying: First git commit
Applying: The latest git commit

# Now we should see our local commits applied
# on top of svn/trunk
$ git lg
* 52b7977 (HEAD, master) The latest git commit
* a34e162 First git commit
* 3b7fed6 (svn/trunk) Make project directory.

# Everything is cool, push it back to svn
$ git svn dcommit
Committing to https://example.com/svn/parent/trunk/project
...

–prefix=svn

我最近特别喜欢的一个标志是 --prefix=svn/,您也可以将它与 git svn clone 一起使用。

这将为所有远程 Subversion 分支、标签和主干的跟踪分支加上 svn/前缀,使其看起来很像常规 git 远程使用的通常的 origin/习语。

跟踪分支有一个前缀,你也可以将它们用作本地分支名称,例如:

# Name your copy of svn/trunk "trunk" instead of "master"
$ git checkout -b trunk master
Switched to a new branch 'trunk'

$ git branch -d master
Deleted branch master (was 33c3136).

$ git branch -av
* trunk 33c3136 Latest svn commit
* remotes/svn/trunk 33c3136 Latest svn commit

然后,如果您有其他要跟踪的分支:

$ git checkout -b featurea svn/featurea

关于git - 通过 HTTP 转储远程基于 Git 的 SVN 存储库时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18522284/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com