Re: [PATCH 8/8] vcs-svn: allow to disable 'progress' lines
- From
Ramkumar Ramachandra <artagnon@gmail.com>
- Date
- Jul 6, 2011, 08:25 UTC
- Message-ID
- <CALkWK0nWSVrrtzwE2ePucK=XTnSHWuojxhoayRSUbZmk1We9Fg@mail.gmail.com>
- In-Reply-To
- <1309715877-13814-9-git-send-email-divanorama@gmail.com>
Hi Dmitry,
Dmitry Ivankov writes:
Show 6 quoted lines
> 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 ...
Agreed. Sounds like a good change.
Show 10 quoted lines
> 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 > @@ -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))
You're modifying the svndump_init API for every new option that's added. This'll clearly break down when you have many options -- how about wrapping it up in an options structure and then passing that?
Show 11 quoted lines
> 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.
Hm, this will make it a little too silent for the end-user. What do you feel about printing something minimalistic like a '.' for each imported revision? Atleast it won't look like it's hung. Also, how does this interact with the 'progress' option of fast-import protocol?
Show 24 quoted lines
> 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;Show 9 quoted lines
> @@ -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;The only reason you're modifying the API of fast_export_init is so that it can set a global static variable? Also, this change seems more absurd because progress reporting isn't directly related to fast_export_init. How about having a dedicated function for option parsing that sets all the global statics?
I'm sorry I haven't been more involved with this project. Still, I hope this review helps.
-- Ram