简体   繁体   English

即使在清理结账后,git-svn也无法拒绝

[英]git-svn fails to dcommit, even after clean checkout

I'm trying to use git-svn with the following project: 我正在尝试将git-svn用于以下项目:

https://svn.apache.org/repos/asf/commons/sandbox/gsoc/2010/scxml-js/trunk/ https://svn.apache.org/repos/asf/commons/sandbox/gsoc/2010/scxml-js/trunk/

Which I've checked out using the standard git svn clone https://svn.apache.org/repos/asf/commons/sandbox/gsoc/2010/scxml-js/trunk/ -T trunk -b branches -t tags invocation. 我已经使用标准git svn clone https://svn.apache.org/repos/asf/commons/sandbox/gsoc/2010/scxml-js/trunk/ -T trunk -b branches -t tags检查了git svn clone https://svn.apache.org/repos/asf/commons/sandbox/gsoc/2010/scxml-js/trunk/ -T trunk -b branches -t tags调用。

I started having trouble using git-svn dcommit with git-svn after branching with git checkout -b and not git svn branch , and then merging that local branch back into master, and trying to dcommit. 在使用git checkout -b而不是git svn branch ,我开始在使用git-svn dcommit与git-svn时遇到麻烦,然后将该本地分支合并回master,并尝试dcommit。 Now, strangely, even after doing a clean checkout, I am still having errors when I attempt to dcommit. 现在,奇怪的是,即使在做了干净的结账之后,当我试图拒绝时,我仍然有错误。

The following rather long trace is representative of my current workflow with git-svn: 以下相当长的跟踪代表了我当前使用git-svn的工作流程:

jacob@jacob-laptop:~/workspace/gsoc2010/scxml-js$ git svn dcommit
Committing to https://jbeard@svn.apache.org/repos/asf/commons/sandbox/gsoc/2010/scxml-js/trunk ...
        M       build-common.xml
        M       src/xslt/backends/js/StateTableStatechartGenerator.xsl
        M       src/xslt/backends/js/SwitchyardStatechartGenerator.xsl
        M       src/xslt/ir-compiler/appendTransitionInformation.xsl
        M       src/xslt/ir-compiler/copyEnumeratedEventTransitions.xsl
        M       src/xslt/ir-compiler/flattenTransitions.xsl
        M       src/xslt/ir-compiler/nameTransitions.xsl
        M       src/xslt/ir-compiler/numberStatesAndTransitions.xsl
        M       src/xslt/ir-compiler/splitTransitionTargets.xsl
        M       src/xslt/util/language-frontend-module-generators/sh-from-topo-sort-list-generator.xsl
        M       src/xslt/util/topo-sort.xsl
Committed r1037491
W: 502073c202cb1fbe089f0e8b7100304f0aa74729 and refs/remotes/trunk differ, using rebase:
:100644 100644 7930fd690be01a5716490704b5556e2b5cab5ba6 51047f2c8cf1daaa94ae44433a9aa2acc222ae43 M      build-common.xml
:040000 040000 59251941b33bda1376881b33bb2263ea87b1b947 2f5e2586e26bc7d05def065cfcf05327982b81d7 M      src
Current branch master is up to date.
# of revisions changed
before:
 39c6f7e2d7b82cc782b8770d1ddb0ecb4f86e780
c5f360feb3a6bdaab2fb2f48d05e8691824e3231

after:
 502073c202cb1fbe089f0e8b7100304f0aa74729
39c6f7e2d7b82cc782b8770d1ddb0ecb4f86e780
c5f360feb3a6bdaab2fb2f48d05e8691824e3231
 If you are attempting to commit  merges, try running:
         git rebase --interactive --preserve-merges  refs/remotes/trunk
Before dcommitting
jacob@jacob-laptop:~/workspace/gsoc2010/scxml-js$ git svn rebase
        M       build-common.xml
        M       src/xslt/ir-compiler/nameTransitions.xsl
        M       src/xslt/ir-compiler/copyEnumeratedEventTransitions.xsl
        M       src/xslt/ir-compiler/appendTransitionInformation.xsl
        M       src/xslt/ir-compiler/flattenTransitions.xsl
        M       src/xslt/ir-compiler/numberStatesAndTransitions.xsl
        M       src/xslt/ir-compiler/splitTransitionTargets.xsl
        M       src/xslt/backends/js/SwitchyardStatechartGenerator.xsl
        M       src/xslt/backends/js/StateTableStatechartGenerator.xsl
        M       src/xslt/util/language-frontend-module-generators/sh-from-topo-sort-list-generator.xsl
        M       src/xslt/util/topo-sort.xsl
r1037491 = e8d820cfdca882a57fbfa003b9673313be6c9621 (refs/remotes/trunk)
First, rewinding head to replay your work on top of it...
Applying: Changed some paths around so python fronend works.
Applying: Removed test_with_xsltproc.sh. This file no longer needed, as we now generate a bash backend module.
jacob@jacob-laptop:~/workspace/gsoc2010/scxml-js$ git svn dcommit
Committing to https://jbeard@svn.apache.org/repos/asf/commons/sandbox/gsoc/2010/scxml-js/trunk ...
        M       src/python/scxml/cgf/backends/js
        M       src/python/scxml/cgf/xslt
Committed r1037493
W: 8563b885bfca77ccb33a87f56f78e6323af022a9 and refs/remotes/trunk differ, using rebase:
:040000 040000 c33b3d66ecc6735af3241d7f9cee383d2736f614 59251941b33bda1376881b33bb2263ea87b1b947 M      src
Current branch master is up to date.
# of revisions changed
before:
 574e2e495fa12cf3d81004638a06e3315d0abba5

after:
 8563b885bfca77ccb33a87f56f78e6323af022a9
574e2e495fa12cf3d81004638a06e3315d0abba5
 If you are attempting to commit  merges, try running:
         git rebase --interactive --preserve-merges  refs/remotes/trunk
Before dcommitting

I basically need to do a git svn dcommit followed by a git svn rebase for every commit since the last dcommit. 我基本上需要做一个git svn dcommit然后是自上次dcommit以来每次提交的git svn rebase This usually works cleanly, but sometimes fails and requires more manual work. 这通常干净利落,但有时会失败,需要更多的手工操作。

What could be causing this problem with dcommit, such that even using a clean checkout does not resolve it? 使用dcommit可能导致此问题的原因是,即使使用干净的结帐也无法解决问题?

I just ran into this and finally figured out what's going on: When you access an SVN repository via HTTP and write-through proxying , the recommended post-commit hook runs svnsync in the background. 我刚刚遇到这个并最终弄明白发生了什么:当你通过HTTP和直写代理访问SVN存储库时,推荐的post-commit钩子在后台运行svnsync The commit via HTTP finishes as soon as the SVN server is done, but before the HTTP proxy you're reading through has been updated to the new revision. 一旦SVN服务器完成,通过HTTP提交就会完成,但在您阅读的HTTP代理之前已经更新到新版本。 git-svn does a commit quickly followed by a fetch and sees the stale HTTP proxy without the new revision. git-svn快速执行提交,然后执行提取,并在没有新修订的情况下查看过时的HTTP代理。 It assumes it got the new revision and diffs the tip of the remote with what it tried to commit and sees the conflict. 它假定它得到了新版本,并将远程提示与它尝试提交的内容区分开来并发现冲突。

If you control the SVN proxy configuration you can make the svnsync synchronous (this worked for me for a long time until someone surprised me with a config change). 如果您控制SVN代理配置,您可以使svnsync同步(这对我来说很长一段时间,直到有人对配置更改感到惊讶)。 Otherwise I think git-svn needs a retry mechanism: 否则我认为git-svn需要一个重试机制:

diff --git a/git-svn.perl b/git-svn.perl
index 09c4ca5..af9aea1 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -57,6 +57,7 @@ use File::Spec;
 use File::Find;
 use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/;
 use IPC::Open3;
+use Time::HiRes qw/usleep/;
 use Git;

 BEGIN {
@@ -574,7 +575,17 @@ sub cmd_dcommit {
                                $gs->{inject_parents_dcommit}->{$cmt_rev} =
                                                               $parents->{$d};
                        }
-                       $_fetch_all ? $gs->fetch_all : $gs->fetch;
+                       my $retry;
+                       fetch: for ($retry = 0; $retry < 30; ++$retry) {
+                           $_fetch_all ? $gs->fetch_all : $gs->fetch;
+                           last fetch if ($gs->rev_map_max >= $cmt_rev);
+                           # Asynchronous commit push not complete
+                           usleep(20000 * ($retry + 1));
+                       }
+                       if ($retry > 0 && $gs->rev_map_max < $cmt_rev) {
+                           fatal "New revision $cmt_rev did not appear",
+                                 "in repository after $retry retries.";
+                       }
                        $last_rev = $cmt_rev;
                        next if $_no_rebase;

$

If this still seems like a good idea tonight I'll submit a patch. 如果今晚这仍然是个好主意,我会提交补丁。

Update: While using this I ended up with: 更新:使用这个时,我最终得到:

Author: syncuser <syncuser@d3ff0b4f-3c2c-0410-a809-ba59474314df>

on one of my own commits. 在我自己的一个提交。 So there may still be a race condition where the script sees a partial sync. 因此,可能仍存在竞争条件,其中脚本看到部分同步。 This is annoying but not fatal. 这很烦人但不致命。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM