Edgewall Software
Modify

Opened 21 years ago

Closed 19 years ago

Last modified 16 years ago

#238 closed enhancement (fixed)

Support for downloading tarballs from the repository

Reported by: cathelijne@… Owned by: Christian Boos
Priority: normal Milestone: 0.10
Component: version control/browser Version: 0.6
Severity: minor Keywords: objectstore tracdiff
Cc: Alec Thomas Branch:
Release Notes:
API Changes:
Internal Changes:

Description

It would be cool to be able to browse the repository and download a tarball of a branch or tag.

Attachments (0)

Change History (26)

comment:1 by daniel, 20 years ago

While presumable a cool feature, it'll possibly take up a lot of resources and bandwidth.

If done though, adding a "download directory as tar/zip-ball" feature to the Browser would suffice.

comment:2 by daniel, 20 years ago

Milestone: 0.8
Priority: normallowest

comment:3 by daniel, 20 years ago

Milestone: 0.80.9
Summary: Support for extracting tarballs from the repositorySupport for downloading tarballs from the repository

comment:4 by Christopher Lenz, 20 years ago

#814 marked as duplicate of this ticket.

comment:5 by Christopher Lenz, 20 years ago

Keywords: helpwanted added

This shouldn't be so hard… have a look at the zip file support in Changeset.py for an example of how to package up files in a ZIP file.

comment:6 by Christopher Lenz, 20 years ago

#1504 has been marked as duplicate of this ticket (although it limits the request to files as opposed to whole directories). It also contains a patch for enabling this.

comment:7 by Christian Boos, 20 years ago

Note that this feature would also solve #763.

comment:8 by Christian Boos, 19 years ago

Owner: changed from Jonas Borgström to Christian Boos
Status: newassigned

This is implemented in the TracDiff branch.

comment:9 by Christian Boos, 19 years ago

Milestone: 0.91.0
Priority: lowestnormal
Severity: normalminor

This will be post-poned to 1.0, as this is part of the TracDiff branch.

comment:10 by Christian Boos, 19 years ago

This ticket depends on #2028. Go there for the patches against 0.9.x.

comment:11 by Christian Boos, 19 years ago

mgood suggested that this feature could put some load on the server. While that's certainly not an issue with small repositories, that can be a problem for big repositories, so it should be possible to disable this feature:

[browser]
download_archive = false

However, a better solution might be to allow the download of some selected paths and cache the corresponding .zip files:

[browser]
restrict_download = tags/trac-0.8.1, tags/trac-0.8.4, tags/trac-0.9b1

Of course, the revision should be taken into account, which may complicate matters (e.g. cache a maximum of 5 different revisions for each specified path).

comment:12 by Christian Boos, 19 years ago

Keywords: tracdiff added

comment:13 by ttest, 19 years ago

I don't know if it would be a good idea to restrict the downloadable directories in the configuration file, since than you would have information in there about the structure of your repository. IMHO it would be better to put the information which directories are downloadable/not downloadable in the repo. itself. Properties would be perfect for this.

comment:14 by Christian Boos, 19 years ago

Milestone: 1.00.10

answering ttest: not every VersioningSystemBackend has support for properties (e.g. Mercurial doesn't)

comment:15 by anonymous, 19 years ago

Priority: normalhigh

comment:16 by anonymous, 19 years ago

Priority: highnormal

comment:17 by Christian Boos, 19 years ago

Note that the feature is now available in trunk. I leave this open until there's some consensus about the form that should take the "control" of this feature. What we have so far:

  • usage of properties is ruled out because that would be specific to TracSubversion
  • some possible TracIni settingss:
    • enable_download for enabling or not that feature
    • restrict_download using a glob pattern to define the paths where a download is possible. e.g.
      • "*":: everywhere
      • "tags/*":: only below the tags folder
      • "":: nowhere

comment:18 by Christian Boos, 19 years ago

Implementation of the previous idea (list of glob patterns)

Index: trac/versioncontrol/web_ui/browser.py
===================================================================
--- trac/versioncontrol/web_ui/browser.py	(revision 3006)
+++ trac/versioncontrol/web_ui/browser.py	(working copy)
@@ -17,6 +17,8 @@
 
 import re
 import urllib
+import os.path
+from fnmatch import fnmatchcase
 
 from trac import util
 from trac.util import sorted
@@ -154,7 +156,10 @@
 
         req.hdf['browser.items'] = info
         req.hdf['browser.changes'] = changes
-        if node.path != '':
+        patterns = self.config.get('browser', 'downloadable_paths')
+        if node.path and patterns and \
+               filter(None, [fnmatchcase(node.path, p) for p in
+                             patterns.split(os.path.pathsep)]):
             zip_href = self.env.href.changeset(rev, node.path, old=rev,
                                                old_path='/', # special case #238
                                                format='zip')

Of course, the most difficult here is to find a sensible configuration setting name and a sensible default:

  • "*": all folders are downloadable
  • "": none are downloadable

comment:19 by Alec Thomas, 19 years ago

Cc: Alec Thomas added

This would be incredibly useful for TracHacks!

comment:20 by sid, 19 years ago

This feature will probably be used most in root level directories (trunk, branches/0.x-stable, tags/…), not all over the place. In the case where it might be used in a broader fashion (e.g. TrackHacks), it means there are probably a lot of smaller projects and less overhead to create new archives as needed.

I think the globbing is overkill.

How about:

[browser]
enable_archive_download = true

comment:21 by Christian Boos, 19 years ago

The problem is that there are no fixed rules for identifying what is a root level directory…

E.g. you would like to make each release (/tags/release-x.y.z) downloadable, but certainly not the whole /tags folder, which might contain dozens of releases…

Other example, in Trac hacks, the glob pattern would be /*/*, i.e. anything at the second level, like /authformplugin/0.9 but not /authformplugin itself.

IMHO, a global yes/no flag is useless… Sure you may want to disable the feature completely, but when you want to have it, you want to have some reasonable control over it, as examplified above.

With the glob patterns, complete disabling is very easy, simply leave the option empty, and if control is needed, I can't think of a better compromise between simplicity and flexibility than a list of glob patterns…

comment:22 by Alec Thomas, 19 years ago

I agree, globs seem like an excellent choice. I certainly wouldn't want people downloading the entire TracHacks repository.

comment:23 by Christian Boos, 19 years ago

Resolution: fixed
Status: assignedclosed

Implemented in r3117.

comment:24 by Christian Boos, 19 years ago

Keywords: objectstore added; helpwanted removed

Note that in the future, it might be worth to use a cache for the zip files, as they can be costly to create.

comment:25 by Alec Thomas, 19 years ago

I've updated to trunk on TracHacks and this is working beautifully, thanks Christian :)

A cache would also be quite useful.

comment:26 by stepan@…, 16 years ago

Is it possible in a similar way to create "real" tar balls (not .zip files) instead?

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.