You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Jilles Oldenbeuving <oj...@hotmail.com> on 2003/07/15 18:48:46 UTC

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

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?

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

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

Posted by Shlomi Fish <sh...@vipe.stud.technion.ac.il>.
On Mon, 21 Jul 2003, Jilles Oldenbeuving wrote:

> Shlomi Fish wrote:
>
>
> > 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.
>
> Hmm, didn't think of that. Will change the patch to use ra ls command.
> Just have to fingure it all out.
>
> Thanx Shlomi!
>

You're welcome.

Regards,

	Shlomi Fish

>
>
> ---------------------------------------------------------------------
> 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

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

Posted by Jilles Oldenbeuving <oj...@hotmail.com>.
Shlomi Fish wrote:


> 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.

Hmm, didn't think of that. Will change the patch to use ra ls command. 
Just have to fingure it all out.

Thanx Shlomi!



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

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

Posted by Shlomi Fish <sh...@vipe.stud.technion.ac.il>.
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

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

Posted by Paul Lussier <pl...@lanminds.com>.

Added a reference to this in issue 708:

	http://subversion.tigris.org/issues/show_bug.cgi?id=708
-- 

Seeya,
Paul



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org