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

Re: tarball download

From: SVN User <svn.user_at_gmail.com>
Date: 2006-03-28 15:57:29 CEST

I was looking at the websvn's dl.php, It creates a tarball using php I
guess. Since we have php installed on the server could we some how use the
same code to create a tarball on the servers file system and then move the
file to another environment.

Thanks

Here's the code
 // Get the name of the directory being archived
   $arcname = substr($path, 0, -1);
   $arcname = basename($arcname);
   if (empty($arcname))
      $arcname = $rep->name;

   $svnrep->exportDirectory($path, $tmpname.DIRECTORY_SEPARATOR.$arcname,
$rev);

   // Create the tar file
   chdir($tmpname);
   exec($config->tar." -cf $arcname.tar $arcname");

   // ZIP it up
   exec($config->gzip." $arcname.tar");
   $size = filesize("$arcname.tar.gz");

   // Give the file to the browser

   if ($fp = @fopen("$arcname.tar.gz","rb"))
   {
      header("Content-Type: application/x-gzip");
      header("Content-Length: $size");
      header("Content-Disposition: attachment;
filename=\"".$rep->name."-$arcname.tar.gz\"");
      // Use a loop to transfer the data 4KB at a time.
      while(!feof($fp))
      {
         echo fread($fp, 4096);
         ob_flush();
      }
   }

On 3/28/06, Nick Thompson <nickthompson@agere.com> wrote:
>
> Well I've only been thinking about it so far. The viewvc python code
> looks simple enough, but tar source code is much more complex. I
> haven't looked at svn's export implementation yet - so, still at the
> stage of scoping the work. But I expect the command would look
> something like
>
> svntar -cvf release5.tar svn://localhost/repos/projectname
>
> Or for my purposes, exporting to stdout tar:
>
> svntar -cvf - svn://localhost/repos/projectname
>
> Anyway, like I said, its just an idea I have :-)
>
> Nick.
>
> On Tuesday 28 March 2006 14:33, SVN User wrote:
> > Nick,
> > What is the command to export and convert it to a tarball at the
> > same time. will the command look like this??
> > tar -vccf release5.tar svn export svn://localhost/repos/projectname
> >
> > Thanks
> >
> > On 3/28/06, Nick Thompson <nickthompson@agere.com> wrote:
> > > On Tuesday 28 March 2006 14:11, Andy Levy wrote:
> > > > On 3/28/06, SVN User <svn.user@gmail.com> wrote:
> > > > > Hello Group,
> > > > > How can I make a tarball out of the source code in the Tags
> > > > > folder. If I try checking oout/Export the source code, it
> > > > > takes along while for the files to transfer.
> > > > > I wanted to know if there was a svn command to create a
> > > > > tarball of the tag folders.
> > > >
> > > > Not that I've seen.
> > > >
> > > > This command would need to do an export of the files in the
> > > > first place anyway.
> > >
> > > Yes and no :-) It would be possible to take the code from
> > > "export" and meld it with the code from "tar". As the data comes
> > > in from the repo, you can then write it straight out to a tar
> > > file, rather than to individual files.
> > >
> > > viewvc seems to do exactly this - with python code, using the
> > > python bindings. I've been thinking about writing something
> > > similar in C. viewvc for me fails, because it doesn't support
> > > authz. I like WebSVN, but its tarball feature is broken in
> > > several ways. An svntar command, would make WebSVN tarball
> > > download much better.
> > >
> > > Regards,
> > > --
> > >
> > > > Nick Thompson
> > >
> > > -----------------------------------------------------------------
> > >---- To unsubscribe, e-mail:
> > > users-unsubscribe@subversion.tigris.org For additional commands,
> > > e-mail: users-help@subversion.tigris.org
>
> --
> > Nick Thompson
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>
Received on Tue Mar 28 15:58:47 2006

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

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