我正在尝试建立一个git存储库的darcs镜像。我有一些正常工作的东西,但存在一个重大问题:如果我向git repo推送了许多提交,那么这些提交将被合并成一个单独的darcs补丁集。我真的希望确保每个git提交都设置为单独的darcs补丁集。我猜这可以通过执行某种
这是我现在使用的(ksh)代码,或多或少:
git fetch
,然后对远程分支的本地副本进行查询来实现,但我的git技能还不足以胜任这项工作。这是我现在使用的(ksh)代码,或多或少:
git pull -v # pulls all the commits from remote --- bad!
# gets information about only the last commit pulled -- bad!
author="$(git log HEAD^..HEAD --pretty=format:"%an <%ae>")"
logfile=$(mktemp)
git log HEAD^..HEAD --pretty=format:"%s%n%b%n" > $logfile
# add all new files to darcs and record a patchset. this part is OK
darcs add -q --umask=0002 -r .
darcs record -a -A "$author" --logfile="$logfile"
darcs push -a
rm -f $logfile
我的想法是:
- 尝试使用
git fetch
命令获取远程分支的本地副本(不确定需要哪些参数)。 - 以某种方式查询本地副本,以获取自上次镜像操作以来的每个提交的哈希值(我不知道如何实现这一点)。
- 循环遍历所有哈希值,仅拉取该提交并记录相关的补丁集(如果有哈希值,我相信我知道如何做到这一点)。
我欢迎您对上述情况进行详细阐述或提出其他建议。
有什么想法吗?