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

Re: svnversion weirdness with svn:externals

From: C. Michael Pilato <cmpilato_at_collab.net>
Date: 2003-11-05 07:40:59 CET

"C. Michael Pilato" <cmpilato@collab.net> writes:

> "Steven Brown" <swbrown@ucsd.edu> writes:
>
> > Hello, I recently moved to 0.32.1 from 0.27, and now 'svnversion .' in a
> > working copy that has a svn:externals directory pulled in reports the
> > version of the external and the version of the working copy like a mixed
> > copy, e.g., '106:429'. It used to ignore the external and report '429'.
> > This new behavior seems horribly wrong, and I assume is a bug.
>
> It's a bug. svnversion uses svn_client_status() under-the-hood, and
> in the newer Subversion, the status operation has learned about
> svn:externals. For svnversion to work correctly, svn_client_status()
> should take a boolean flag for including/ignoring svn:externals (which
> is set to "ignore" when called by svnversion).

Steven, would you mind testing the following patch to see if it fixes
this problem for you?

----------

Start ignoring statuses at the first sign of those pesky
svn:externals. They will taint our version range calculation.

* subversion/svnversion/main.c
  (struct status_baton): add 'ignore' parameter.
  (analyze_status): Return immediately if we're told to ignore
    statuses.
  (notify): New.
  (main): Populate the baton's new 'ignore' parameter, and register
    the new notification function and baton.

Index: subversion/svnversion/main.c
===================================================================
--- subversion/svnversion/main.c (revision 7634)
+++ subversion/svnversion/main.c (working copy)
@@ -30,6 +30,7 @@
   svn_boolean_t modified; /* is anything modified? */
   const char *wc_path; /* path whose URL we're looking for. */
   const char *wc_url; /* URL for the path whose URL we're looking for. */
+ svn_boolean_t ignore; /* ignore status until further notice. */
   apr_pool_t *pool; /* pool in which to store alloc-needy things. */
 };
 
@@ -42,6 +43,9 @@
                 svn_wc_status_t *status)
 {
   struct status_baton *sb = baton;
+
+ if (sb->ignore)
+ return;
 
   if (! status->entry)
     return;
@@ -70,7 +74,26 @@
     sb->wc_url = apr_pstrdup (sb->pool, status->entry->url);
 }
 
+
+/* This implements `svn_wc_notify_func_t'. */
 static void
+notify (void *baton,
+ const char *path,
+ svn_wc_notify_action_t action,
+ svn_node_kind_t kind,
+ const char *mime_type,
+ svn_wc_notify_state_t content_state,
+ svn_wc_notify_state_t prop_state,
+ svn_revnum_t revision)
+{
+ struct status_baton *sb = baton;
+ if ((action == svn_wc_notify_status_external)
+ || (action == svn_wc_notify_status_completed))
+ sb->ignore = TRUE;
+}
+
+
+static void
 usage(void)
 {
   fprintf(stderr,
@@ -168,8 +191,15 @@
   sb.max_rev = SVN_INVALID_REVNUM;
   sb.wc_path = wc_path;
   sb.wc_url = NULL;
+ sb.ignore = FALSE;
   sb.pool = pool;
   rev.kind = svn_opt_revision_unspecified;
+
+ /* Setup the notification callback, and its baton (which is shared
+ with the status function). */
+ ctx.notify_func = notify;
+ ctx.notify_baton = &sb;
+
   SVN_INT_ERR (svn_client_status (&youngest, wc_path, &rev, analyze_status,
                                   &sb, TRUE, TRUE, FALSE, FALSE, &ctx, pool));
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Nov 5 07:42:12 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.