From: Dmitry Ivankov <divanorama@gmail.com>
To: git@vger.kernel.org
Cc: Jonathan Nieder <jrnieder@gmail.com>,
David Barr <davidbarr@google.com>,
Ramkumar Ramachandra <artagnon@gmail.com>,
Dmitry Ivankov <divanorama@gmail.com>
Subject: [PATCH v2 2/9] svn-fe: avoid error on no-op imports in remote-svn-alpha
Date: Wed, 13 Jul 2011 21:26:46 +0600 [thread overview]
Message-ID: <1310570813-16648-3-git-send-email-divanorama@gmail.com> (raw)
In-Reply-To: <1310570813-16648-1-git-send-email-divanorama@gmail.com>
Currently helpers' exit codes are not checked by transport_helper.
But a proper helper should check for all possible internal errors
anyway. svnrdump dump --incremental considers -rX:HEAD range as bad
if X is greater than the actual HEAD revision. And there is no option
to change this behavior.
One way to address this issue is to fire one more svn command to get
the HEAD value, but it is one more connection, one more tool (ok,
we can svnrdump HEAD but it looks slow) and possibly one more
password prompt, and maybe even a race condition (if we talk to a
svn servers farm frontend for example).
Another one is to patch svnrdump to report the revision, because
internally it asks svn for it anyway before doing a dump. Longer
term it looks nice, moreover it can be used to display percentage
progress.
Add a wrapper around svnrdump that captures stderr and exit code.
If stderr matches a hardcoded "LOWER cannot be greater than UPPER."
and the exit code is non-zero, don't produce any dump and emulate
exit 0, otherwise the wrapper is transparent. The only side effect
is dup2-ing stdout to fd=6, ugly but fine as only standard
descriptors are used currently.
Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
---
contrib/svn-fe/git-remote-svn-alpha | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/contrib/svn-fe/git-remote-svn-alpha b/contrib/svn-fe/git-remote-svn-alpha
index 61c9b07..2eac7d4 100755
--- a/contrib/svn-fe/git-remote-svn-alpha
+++ b/contrib/svn-fe/git-remote-svn-alpha
@@ -12,10 +12,25 @@ usage () {
exit 129
}
+svnrdump_wrap () {
+ exec 6<&1 &&
+
+ EX=$(
+ (svnrdump dump --non-interactive --username=Guest --password= \
+ --quiet "$1" "$2" >&6) 2>&1; test $? -ne 0 || echo Success
+ ) &&
+ if test "z$EX" != "zSuccess"; then
+ if test "z$EX" = "zLOWER cannot be greater than UPPER."; then
+ return 0
+ fi
+ echo "$EX" >&2
+ return 1
+ fi
+}
+
do_import () {
revs=$1 url=$2
- (svnrdump dump --non-interactive --username=Guest --password= \
- -r"$revs" "$url" --quiet | svn-fe) 3<&0 || die "FAILURE"
+ (svnrdump_wrap "$url" -r"$revs" | svn-fe) 3<&0 || die "FAILURE"
exec 1>&-
}
--
1.7.3.4
next prev parent reply other threads:[~2011-07-13 15:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-13 15:26 [GSoC'11] [PATCH/RFC v2 0/9] remote-svn-alpha updates Dmitry Ivankov
2011-07-13 15:26 ` [PATCH v2 1/9] svn-fe: use svnrdump --quiet in remote-svn-alpha Dmitry Ivankov
2011-07-13 15:26 ` Dmitry Ivankov [this message]
2011-07-13 15:26 ` [PATCH v2 3/9] svn-fe: allow svnadmin instead of svnrdump " Dmitry Ivankov
2011-07-13 15:26 ` [PATCH v2 4/9] svn-fe: add a test for remote-svn-alpha Dmitry Ivankov
2011-07-13 15:26 ` [PATCH v2 5/9] svn-fe: use svn-fe --no-progress in remote-svn-alpha Dmitry Ivankov
2011-07-13 15:26 ` [PATCH v2 6/9] svn-fe: use proper refspec " Dmitry Ivankov
2011-07-13 15:26 ` [PATCH v2 7/9] svn-fe: write svnrev notes " Dmitry Ivankov
2011-07-13 15:26 ` [PATCH v2 8/9] svn-fe: import incrementally in svn-remote-alpha Dmitry Ivankov
2011-07-13 15:26 ` [PATCH v2 9/9] svn-fe: reuse import-marks in remote-svn-alpha Dmitry Ivankov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1310570813-16648-3-git-send-email-divanorama@gmail.com \
--to=divanorama@gmail.com \
--cc=artagnon@gmail.com \
--cc=davidbarr@google.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).