[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] 'svn st -v' looks weird on an empty repository (Issue:708)

From: Shlomi Fish <shlomif_at_vipe.stud.technion.ac.il>
Date: 2003-07-19 17:32:03 CEST

On Tue, 15 Jul 2003, Jilles Oldenbeuving wrote:

> Hello Everyone,
>
> Some questions about issue 708. In order to detect if the repository is
> empty, I use the HEAD revision (if > 0 then rep != empty). In the code this
> is HEAD revision is known as the variable 'youngest'. This is only filled
> out if the the -u option is given.
>
> This gives us two options to resolve this issue: either only add an extra
> comment to the status output if also the -u option is given, or internally,
> allways figure out the HEAD revision. I'm _guessing_ that the latter option
> involves network traffic, which is why i am posting this patch to the
> dev-list. What route should I follow?
>
> Then there is still the issue of having had some files in your repository,
> but you have deleted them all (e.g. repostiry contains no files/directories,
> but the HEAD revision is > 0). How should i go about and handle that case?
>

You can use the ra ls command to list the files in the root directory. If
there are no entries, then the repository is empty.

Regards,

        Shlomi Fish

> Anyway, typical output with this patch looks like:
>
> jilles@lorien:~/empty_reptest$ ./svn st
> jilles@lorien:~/empty_reptest$ ./svn st -v
> 0 ? ? .
> jilles@lorien:~/empty_reptest$ ./svn st -u
> Head revision: 0
> No commits in repository.
> jilles@lorien:~/empty_reptest$ ./svn st -uv
> 0 ? ? .
> Head revision: 0
> No commits in repository.
> jilles@lorien:~/empty_reptest$
>
> Below is the patch + log message for the first option (e.g. only provide an
> extra comment when the -u option is passed along). Please reject if the I
> need to follow the other route.
>
> LOG:
>
> Fix issue #708: 'svn st -v' looks weird on an empty repository
>
> * status.c
> (svn_cl__print_status_list): Fixed issue #708. If the repository
> is empty do not show the "0 ? ?" but print a message for
> the user pointing out that the repository is empty. (This works,
> provided that the update option (-u) is passed to the client.)
>
> Index: subversion/clients/cmdline/status.c
> ===================================================================
> --- subversion/clients/cmdline/status.c (revision 6484)
> +++ subversion/clients/cmdline/status.c (working copy)
> @@ -181,8 +181,20 @@
> detailed, show_last_committed, status);
> }
>
> - /* If printing in detailed format, we might have a head revision to
> - print as well. */
> - if (detailed && (youngest != SVN_INVALID_REVNUM))
> - printf ("Head revision: %6" SVN_REVNUM_T_FMT "\n", youngest);
> + if (detailed)
> + {
> + /* If printing in detailed format, we might have a head revision to
> + print as well */
> + if (youngest != SVN_INVALID_REVNUM)
> + {
> + printf ("Head revision: %6" SVN_REVNUM_T_FMT "\n", youngest);
> +
> + /* If no commits are present (youngest is either
> + 0) in the repository, say so if we are printing
> + in detailed format. (Only if the update (-u) option
> + is passed to the client) */
> + if (youngest == 0)
> + printf ("No commits in repository.\n");
> + }
> + }
> }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
>

----------------------------------------------------------------------
Shlomi Fish shlomif@vipe.technion.ac.il
Home Page: http://t2.technion.ac.il/~shlomif/

An apple a day will keep a doctor away. Two apples a day will keep two
doctors away.

        Falk Fish

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Jul 19 17:33:11 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.