如何跳过 svnsync 同步中的初始修订(以修复损坏的存储库)

发布于 2024-10-19 10:26:18 字数 595 浏览 5 评论 0原文

我想使用(通常)序列从中等大型 SVN 存储库中同步/复制单个项目

  svnadmin create %mirror%
  rem make insecure dummy hook
  echo rem dummy > %mirror%\hooks\pre-revprop-change.bat
  svnsync init %mirror_url% http://svn/original/...
  svnsync sync %mirror_url%

这可以工作,但需要很长时间,请参阅 相关问题。事实上,在 r=17830 之前我不需要任何修改。真正的问题是原始存储库在此修订之前似乎已损坏,我无法将其转换为 hg,所以我尝试解决方法...

问题: 有没有办法伪造新创建的存储库(在第 4 行之后),以便它“相信”它已经具有修订版 17830 并继续更新版本。 (也许有一些道具魔法?)在该修订之前,项目/文件夹没有任何变化。

I want to sync/copy a single project out of a moderate large SVN repo using the (usual) sequence

  svnadmin create %mirror%
  rem make insecure dummy hook
  echo rem dummy > %mirror%\hooks\pre-revprop-change.bat
  svnsync init %mirror_url% http://svn/original/...
  svnsync sync %mirror_url%

This works but takes long time, see related question. In fact I do not need any revisions prior to e.g. r=17830. And the real problem is that the original repo seems to be corrupt before this revision and I can't convert it to hg, so I try to workaround ...

Question:
Is there a way to fake the newly created repo (after 4th line) so it "believes" it has revision 17830 already and continues with newer ones. (Maybe some propset magic?) There are no changes in the project/folder before that revision.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

仄言 2024-10-26 10:26:19

svnsync 将根据(目标存储库的)“当前”文件中的值以及 svnsync revprop 0 文件中的条目(表明哪个是最后复制的修订版)来复制修订版。初始化 svnsync,然后将这两个数字修改为您想要的版本,它应该按您想要的方式工作。

svnsync will copy revisions based on value in the 'current' file (of the destination repo), and the entry in the svnsync revprop 0 file that says which is the last revision copied. Initialise svnsync, then fudge both of these numbers to your desired revision and it should work as you want.

番薯 2024-10-26 10:26:19

这是可能的。

您需要在文件夹 \db\revprops\0\db\revs\0 中创建虚拟 rev 文件,这样就不会出现错误 没有修订版 17830

This is possible.

You need to create dummy rev files in the folders \db\revprops\0 and \db\revs\0 so that you don't get the error there is no revision 17830.

追风人 2024-10-26 10:26:19

SVN 邮件列表对此主题有一个答案;请参阅http://svn.haxx.se/dev/archive-2010- 02/0114.shtml

The SVN mailing list has an answer to that topic; see http://svn.haxx.se/dev/archive-2010-02/0114.shtml

长安忆 2024-10-26 10:26:19

从我基于答案和帮助的实验来看,我相信这是不可能的。

From my experiments based and helped by the answers, I believe this is not possible.

楠木可依 2024-10-26 10:26:19

试试这个,(刚刚弄清楚)

1)检查您正在同步到的存储库的工作副本

2a)使用 svn diff -rcurrent:next 从源存储库生成补丁
(所以 current 是当前版本,next 是下一个被破坏的版本)
然而,我发现大多数 svn diff 仍然有效

2b) 或者,将一个虚拟文件添加到您要同步的存储库并标记它(这样您就可以
可以检查一些东西)

3)执行 svn ci -m 'syncfix' 这将改变你正在同步的存储库

4)在此之后,svnsync 同步将在大部分时间继续

5)有时它会抱怨 HEAD 是其中的一个修订未来。要解决这个问题
转到/db/revprops/0
编辑0文件,
chmod +w 0
修改版本,

....

svn:sync-last-merged-rev
V 4
8499 <--- this one, add one to it so 8500 in this example 
END

6) 之后,svnsync 同步将继续

7) 下面是我刚刚为克服这些障碍而编写的脚本,
最终的结果可能并不完美,但它会包含大部分内容。
然后您可以通过从存储库的 HEAD 导出来修复最终结果
您正在同步。

set -x

SYNC_REPO=/repo/reelbox.org-sync

SRC_WD=/src/Multimedia/Reelbox/reelbox.org
SYNC_WD=/src/Multimedia/Reelbox/reelbox.org-sync

bumpRevision()
{
   SYNC_REPO_FILE=$SYNC_REPO/db/revprops/0/0

   cd $SYNC_WD
   svn update

   CUR_REV=`svn update | awk '{print $3}' | sed s/\.$//`

   echo $CUR_REV

   NEXT_REV=`expr $CUR_REV + 1`

   echo $NEXT_REV

   cd $SRC_WD

   echo svn diff -r$CUR_REV:$NEXT_REV, >>SYNCLOG
   svn diff -r$CUR_REV:$NEXT_REV 2>>SYNCLOG >$SYNC_WD/patch.in
   echo >>SYNCLOG

   LOG=`svn log -r$NEXT_REV`

   cd $SYNC_WD
   patch -p0 < patch.in

   RESULT=`svn diff`

   echo $LOG
   echo $RESULT

   if [ -n "$RESULT" ]; then
      echo patched
      svn ci -m "syncfix:$LOG"
  else
     echo not patched
     if [ ! -f FIXFILE ]; then
        echo $NEXT_REV > FIXFILE
         svn add FIXFILE
     else
        echo $NEXT_REV >> FIXFILE
     fi

     svn ci -m "syncfix:nothing patched:$LOG"
  fi
}

doSync()
{
   svnsync sync file://$SYNC_REPO

   STATUS=$?

   if [ $STATUS == 1 ]; then
      ECODE=`svnsync sync file://$SYNC_REPO 2>&1 | awk '{print $2}' | sed s/:$//`
      echo $ECODE
      case $ECODE in
         E000022)
           exit 1
         ;;
     esac
   fi

   return $STATUS
 }

 # bumpRevision

doSync
while [ $? == 1 ]; do
   bumpRevision   
   doSync
done

翁德雷·波普

Try this, (just figured this out)

1) check out a working copy of the repository you are syncing to

2a) generate a patch with svn diff -rcurrent:next from the source repository
(so current is the current revision, and next is the next one that is broken)
however, most of the I found svn diff still works

2b) or, add a dummy file to the repository you are syncing to and tag it (so you
can check in something)

3) do a svn ci -m 'syncfix' which will bump the repository you are syncing to

4) after this, svnsync sync will continue most of the time

5) sometimes it will complain the HEAD is one revision in the future. To fix this
go to /db/revprops/0
edit the 0 file,
chmod +w 0
bump the revision,

....

svn:sync-last-merged-rev
V 4
8499 <--- this one, add one to it so 8500 in this example 
END

6) after this, svnsync sync will continue

7) below is a script I just made to get over the bumps,
the end result will probably not be perfect but it will get most of the stuff in.
then you can fix the end result by exporting into it from the HEAD of the repository
you are syncing from.

set -x

SYNC_REPO=/repo/reelbox.org-sync

SRC_WD=/src/Multimedia/Reelbox/reelbox.org
SYNC_WD=/src/Multimedia/Reelbox/reelbox.org-sync

bumpRevision()
{
   SYNC_REPO_FILE=$SYNC_REPO/db/revprops/0/0

   cd $SYNC_WD
   svn update

   CUR_REV=`svn update | awk '{print $3}' | sed s/\.$//`

   echo $CUR_REV

   NEXT_REV=`expr $CUR_REV + 1`

   echo $NEXT_REV

   cd $SRC_WD

   echo svn diff -r$CUR_REV:$NEXT_REV, >>SYNCLOG
   svn diff -r$CUR_REV:$NEXT_REV 2>>SYNCLOG >$SYNC_WD/patch.in
   echo >>SYNCLOG

   LOG=`svn log -r$NEXT_REV`

   cd $SYNC_WD
   patch -p0 < patch.in

   RESULT=`svn diff`

   echo $LOG
   echo $RESULT

   if [ -n "$RESULT" ]; then
      echo patched
      svn ci -m "syncfix:$LOG"
  else
     echo not patched
     if [ ! -f FIXFILE ]; then
        echo $NEXT_REV > FIXFILE
         svn add FIXFILE
     else
        echo $NEXT_REV >> FIXFILE
     fi

     svn ci -m "syncfix:nothing patched:$LOG"
  fi
}

doSync()
{
   svnsync sync file://$SYNC_REPO

   STATUS=$?

   if [ $STATUS == 1 ]; then
      ECODE=`svnsync sync file://$SYNC_REPO 2>&1 | awk '{print $2}' | sed s/:$//`
      echo $ECODE
      case $ECODE in
         E000022)
           exit 1
         ;;
     esac
   fi

   return $STATUS
 }

 # bumpRevision

doSync
while [ $? == 1 ]; do
   bumpRevision   
   doSync
done

Ondrej Popp

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文