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

[PATCH] (Resend) Expand using the correct Revision for cat

From: Chris Foote <Chris.Foote_at_xtra.co.nz>
Date: 2003-07-10 00:27:30 CEST

I'm re-submitting this as I didn't get any reply. I'm attaching the patch taken from
rev 6424.

> "Chris Foote" <Chris.Foote@xtra.co.nz> writes:
> >"Ben Collins-Sussman" <sussman@collab.net> writes:
> > What bug are you seeing with 'svn cat'? You never explain in your
> > email. The code in cat.c looks correct to me.
>
> The problem with cat is that the LastChanged* keywords show the props from the
> revision from the cmdline (or HEAD) when it should be getting the props from
> the revision that the file last changed in.
>
> E:\svn-head>svn cat -r 6330 tools\hook-scripts\mailer.py | head
> #!/usr/bin/env python2
> #
> # mailer.py: send email describing a commit
> #
> # $HeadURL: http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/mailer.py $
> # $LastChangedDate: 2003-06-24 17:41:03 +0100 (Tue, 24 Jun 2003) $
> # $LastChangedBy: xela $
> # $LastChangedRevision: 6330 $
> #
> # USAGE: mailer.py REPOS-DIR REVISION [CONFIG-FILE]
>
> This gives the keywords expanded with the props from revision 6330, but
> this file actually last changed in revision 6253.
>
> E:\svn-head>svn info tools\hook-scripts\mailer.py
> Path: tools/hook-scripts/mailer.py
> Name: mailer.py
> Url: http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/mailer.py
> Revision: 6330
> Node Kind: file
> Schedule: normal
> Last Changed Author: cmpilato
> Last Changed Rev: 6253
> Last Changed Date: 2003-06-16 15:59:19 +0100 (Mon, 16 Jun 2003)
> Text Last Updated: 2003-06-19 21:20:24 +0100 (Thu, 19 Jun 2003)
> Properties Last Updated: 2003-06-19 21:20:24 +0100 (Thu, 19 Jun 2003)
> Checksum: 257a0631a2108b460ec9e68fb04e0bf5
>
> As you can see the Author, Rev and Date are completely different using cat and info
> but they should be the same.
>
> > "Ben Collins-Sussman" <sussman@collab.net> writes:
> > > Chris Foote" <Chris.Foote@xtra.co.nz> writes:
> > > * subversion/libsvn_client/cat.c:
> > > (svn_client_cat): Get the keyword values from the entry props.
> >
> > This is not so good. See below.
> >
> > > Index: subversion/libsvn_client/cat.c
> > > ===================================================================
> > > --- subversion/libsvn_client/cat.c (revision 6309)
> > > +++ subversion/libsvn_client/cat.c (working copy)
> > > @@ -128,25 +128,24 @@
> > >
> > > if (keywords)
> > > {
> > > - svn_string_t *date, *author;
> > > - apr_hash_t *revprops;
> > > + svn_string_t *cmt_rev, *cmt_date, *cmt_author;
> > > apr_time_t when = 0;
> > >
> > > - SVN_ERR (ra_lib->rev_proplist(session, rev, &revprops, pool));
> > > -
> > > - date = apr_hash_get (revprops, SVN_PROP_REVISION_DATE,
> > > - APR_HASH_KEY_STRING);
> > > - author = apr_hash_get (revprops, SVN_PROP_REVISION_AUTHOR,
> > > - APR_HASH_KEY_STRING);
> > > - if (date)
> > > - SVN_ERR (svn_time_from_cstring (&when, date->data, pool));
> > > + cmt_rev = apr_hash_get (props, SVN_PROP_ENTRY_COMMITTED_REV,
> > > + APR_HASH_KEY_STRING);
> > > + cmt_date = apr_hash_get (props, SVN_PROP_ENTRY_COMMITTED_DATE,
> > > + APR_HASH_KEY_STRING);
> > > + cmt_author = apr_hash_get (props, SVN_PROP_ENTRY_LAST_AUTHOR,
> >
> > Yeah.... so... 'svn cat' operates on a URL. If you pass it a wc path,
> > it just converts it into a URL. There's no guarantee that a working
> > copy is present, and thus no guarantee that entry-props will exist.
> >
> > So we *always* need to do get the revision's proplist from the server,
> > which is what the code was doing.
>
> I don't see any problems here. The ra_lib->get_file() function always goes to the
> repository to get the file and returns all props, including these three,
> as the doc says it does.
>
> >From svn_ra.h (line 370)
> /** Fetch the contents and properties of file @a path at @a revision.
> * Interpret @a path relative to the url in @a session_baton. Use
> * @a pool for all allocations.
> 8<--snip--
> * If @a props is non @c NULL, set @a *props to contain the properties of
> * the file. This means *all* properties: not just ones controlled by
> * the user and stored in the repository fs, but non-tweakable ones
> * generated by the SCM system itself (e.g. 'wcprops', 'entryprops',
> * etc.) The keys are <tt>const char *</tt>, values are
> * <tt>@c svn_string_t *</tt>.
>
> I did it this way since get_file has already returned all the props that I needed
and
> it avoids another round trip to the server.
>
> I have tried it with local,dav and svn access and they all return the correct
> LastChanged* keywords.
> i.e.
> E:\svn-head>Debug\subversion\clients\cmdline\svn.exe cat -r 6330
> tools\hook-scripts\mailer.py | head
> #!/usr/bin/env python2
> #
> # mailer.py: send email describing a commit
> #
> # $HeadURL: http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/mailer.py $
> # $LastChangedDate: 2003-06-16 15:59:19 +0100 (Mon, 16 Jun 2003) $
> # $LastChangedBy: cmpilato $
> # $LastChangedRevision: 6253 $
> #
> # USAGE: mailer.py REPOS-DIR REVISION [CONFIG-FILE]
>
> Hope this helps.
>
> Chris

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

  • application/octet-stream attachment: cat.diff
Received on Thu Jul 10 00:28:54 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.