From: Dmitry Ivankov <divanorama@gmail.com>
To: git@vger.kernel.org
Cc: Jonathan Nieder <jrnieder@gmail.com>,
David Barr <davidbarr@google.com>,
Dmitry Ivankov <divanorama@gmail.com>
Subject: [PATCH 8/8] vcs-svn: allow to disable 'progress' lines
Date: Sun, 3 Jul 2011 23:57:57 +0600 [thread overview]
Message-ID: <1309715877-13814-9-git-send-email-divanorama@gmail.com> (raw)
In-Reply-To: <1309715877-13814-1-git-send-email-divanorama@gmail.com>
vcs-svn/ writes a progress line after each processed revision. It
is too noisy for big imports. That's a stress for a terminal and
any other output can be lost or scrolled away among these lines.
For now just add a switch to turn progress lines off:
$ svn-fe --no-progress ...
Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
---
contrib/svn-fe/svn-fe.c | 6 +++++-
contrib/svn-fe/svn-fe.txt | 3 +++
test-svn-fe.c | 2 +-
vcs-svn/fast_export.c | 7 +++++--
vcs-svn/fast_export.h | 2 +-
vcs-svn/svndump.c | 4 ++--
vcs-svn/svndump.h | 2 +-
7 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/contrib/svn-fe/svn-fe.c b/contrib/svn-fe/svn-fe.c
index 32755b1..792ffad 100644
--- a/contrib/svn-fe/svn-fe.c
+++ b/contrib/svn-fe/svn-fe.c
@@ -15,8 +15,12 @@ static const char * const svn_fe_usage[] = {
static const char *url;
static const char *ref = "refs/heads/master";
static int backflow_fd = 3;
+static int progress = 1;
static struct option svn_fe_options[] = {
+ OPT_BIT(0, "progress", &progress,
+ "write a progress line after each commit",
+ 1),
OPT_STRING(0, "git-svn-id-url", &url, "url",
"append git-svn metadata line to commit messages"),
OPT_STRING(0, "ref", &ref, "dst_ref",
@@ -38,7 +42,7 @@ int main(int argc, const char **argv)
url = argv[0];
} else if (argc)
usage_with_options(svn_fe_usage, svn_fe_options);
- if (svndump_init(NULL, url, ref, backflow_fd))
+ if (svndump_init(NULL, url, ref, backflow_fd, progress))
return 1;
svndump_read();
svndump_deinit();
diff --git a/contrib/svn-fe/svn-fe.txt b/contrib/svn-fe/svn-fe.txt
index a7ad368..f1a459e 100644
--- a/contrib/svn-fe/svn-fe.txt
+++ b/contrib/svn-fe/svn-fe.txt
@@ -39,6 +39,9 @@ OPTIONS
Integer number of file descriptor from which
responses to 'ls' and 'cat-blob' requests will come.
Default is fd=3.
+--[no-]progress::
+ Write 'progress' lines to fast-import stream. These
+ can be displayed by fast-import.
INPUT FORMAT
------------
diff --git a/test-svn-fe.c b/test-svn-fe.c
index 7885eb1..e4bfda0 100644
--- a/test-svn-fe.c
+++ b/test-svn-fe.c
@@ -62,7 +62,7 @@ int main(int argc, const char *argv[])
return apply_delta(argc, argv);
if (argc == 1) {
- if (svndump_init(argv[0], NULL, ref, backflow_fd))
+ if (svndump_init(argv[0], NULL, ref, backflow_fd, 1))
return 1;
svndump_read();
svndump_deinit();
diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c
index cfb0f2b..a8b8603 100644
--- a/vcs-svn/fast_export.c
+++ b/vcs-svn/fast_export.c
@@ -19,6 +19,7 @@ static uint32_t first_commit_done;
static struct line_buffer postimage = LINE_BUFFER_INIT;
static struct line_buffer report_buffer = LINE_BUFFER_INIT;
static struct strbuf ref_name = STRBUF_INIT;
+static int print_progress;
/* NEEDSWORK: move to fast_export_init() */
static int init_postimage(void)
@@ -30,9 +31,10 @@ static int init_postimage(void)
return buffer_tmpfile_init(&postimage);
}
-void fast_export_init(int fd, const char *dst_ref)
+void fast_export_init(int fd, const char *dst_ref, int progress)
{
first_commit_done = 0;
+ print_progress = progress;
strbuf_reset(&ref_name);
strbuf_addstr(&ref_name, dst_ref);
if (buffer_fdinit(&report_buffer, fd))
@@ -112,7 +114,8 @@ void fast_export_begin_commit(uint32_t revision, const char *author,
void fast_export_end_commit(uint32_t revision)
{
- printf("progress Imported commit %"PRIu32".\n\n", revision);
+ if (print_progress)
+ printf("progress Imported commit %"PRIu32".\n\n", revision);
}
static void ls_from_rev(uint32_t rev, const char *path)
diff --git a/vcs-svn/fast_export.h b/vcs-svn/fast_export.h
index d7eb7cc..7cab7b3 100644
--- a/vcs-svn/fast_export.h
+++ b/vcs-svn/fast_export.h
@@ -4,7 +4,7 @@
struct strbuf;
struct line_buffer;
-void fast_export_init(int fd, const char *dst_ref);
+void fast_export_init(int fd, const char *dst_ref, int progress);
void fast_export_deinit(void);
void fast_export_reset(void);
diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c
index c52faf1..5e3a44d 100644
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -452,11 +452,11 @@ void svndump_read(void)
end_revision();
}
-int svndump_init(const char *filename, const char *url, const char *dst_ref, int report_fileno)
+int svndump_init(const char *filename, const char *url, const char *dst_ref, int report_fileno, int progress)
{
if (buffer_init(&input, filename))
return error("cannot open %s: %s", filename, strerror(errno));
- fast_export_init(report_fileno, dst_ref);
+ fast_export_init(report_fileno, dst_ref, progress);
strbuf_init(&dump_ctx.uuid, 4096);
strbuf_init(&dump_ctx.url, 4096);
strbuf_init(&rev_ctx.log, 4096);
diff --git a/vcs-svn/svndump.h b/vcs-svn/svndump.h
index 85c82c5..becea11 100644
--- a/vcs-svn/svndump.h
+++ b/vcs-svn/svndump.h
@@ -1,7 +1,7 @@
#ifndef SVNDUMP_H_
#define SVNDUMP_H_
-int svndump_init(const char *filename, const char *url, const char *dst_ref, int report_fileno);
+int svndump_init(const char *filename, const char *url, const char *dst_ref, int report_fileno, int progress);
void svndump_read(void);
void svndump_deinit(void);
void svndump_reset(void);
--
1.7.3.4
next prev parent reply other threads:[~2011-07-03 17:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-03 17:57 [PATCH 0/8] vcs-svn, svn-fe: add a couple of options Dmitry Ivankov
2011-07-03 17:57 ` [PATCH 1/8] vcs-svn: move url parameter from _read to _init Dmitry Ivankov
2011-07-03 17:57 ` [PATCH 2/8] svn-fe: add man target to Makefile Dmitry Ivankov
2011-07-03 17:57 ` [PATCH 3/8] svn-fe: add EXTLIBS needed for parse-options Dmitry Ivankov
2011-07-03 17:57 ` [PATCH 4/8] svn-fe: add usage and unpositional arguments versions Dmitry Ivankov
2011-07-03 17:57 ` [PATCH 5/8] test-svn-fe: use parse-options Dmitry Ivankov
2011-07-03 17:57 ` [PATCH 6/8] vcs-svn: allow to specify dump destination ref Dmitry Ivankov
2011-07-03 17:57 ` [PATCH 7/8] vcs-svn: convert REPORT_FILENO to an option Dmitry Ivankov
2011-07-06 10:09 ` Ramkumar Ramachandra
2011-07-03 17:57 ` Dmitry Ivankov [this message]
2011-07-06 8:25 ` [PATCH 8/8] vcs-svn: allow to disable 'progress' lines Ramkumar Ramachandra
2011-07-06 10:14 ` Dmitry Ivankov
2011-07-06 11:40 ` Ramkumar Ramachandra
2011-07-04 11:06 ` [PATCH 0/8] vcs-svn, svn-fe: add a couple of options Sverre Rabbelier
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=1309715877-13814-9-git-send-email-divanorama@gmail.com \
--to=divanorama@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).