#8919 closed defect (fixed)
[PATCH] Condition for zip download of dir
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | high | Milestone: | 1.0.2 |
Component: | version control/changeset view | Version: | 0.12dev |
Severity: | normal | Keywords: | review zip |
Cc: | Thijs Triemstra | Branch: | |
Release Notes: |
Downloading directories from the TracBrowser works more reliably, especially for version control systems other than Subversion which had issues with that feature. |
||
API Changes: | |||
Internal Changes: |
Description
source:trunk/trac/versioncontrol/web_ui/changeset.py@8899#L311 activates special behaviour for old_path == '/'
.
Other tests in that same method treat '/'
and ''
as equivalent, e.g.
source:trunk/trac/versioncontrol/web_ui/changeset.py@8899#L249
has new_path not in ('', '/')
.
I think that it would be consistent to include the case of old_path == ''
in that special case for the zip file name as well. It would help in addressing one aspect of an issue with the VersioningSystemBackend trac-bzr which has been reported in LP #394204.
Attachments (2)
Change History (24)
follow-up: 2 comment:1 by , 15 years ago
follow-up: 3 comment:2 by , 15 years ago
Milestone: | → 2.0 |
---|
Replying to Martin.vGagern@…:
… On the whole I feel that this approach to dir downloads as changesets is a bit of a hack,
True.
In my opinion it would be cleaner to walk repository nodes in order to generate the list of files present in a given revision. Any chance you'll implement this?
Maybe… The odds change dramatically depending on whether you provide a patch or not ;-)
comment:3 by , 15 years ago
Replying to cboos:
The odds change dramatically depending on whether you provide a patch or not ;-)
So let's see them change. How about trac-0.13? Or maybe even earlier?
You might wish to move all this stuff for turning an iterable of nodes into a zip into some method to be used by both browser and changeset. I'll leave a proper location for it to you. I suggest you base it on my method, which supports empty directories, symlinks, executable files as well as standards-compliant flagging of non-ascii file names. You could add things like a customizable root_name (i.e. top level path inside the ZIP) and similar.
comment:4 by , 15 years ago
That's a very good start indeed :-)
I'll need some time to digest the code and refactor it along the lines you suggested, but 0.12 sounds plausible now ;-)
by , 15 years ago
Attachment: | ChangesetEmptyPath.diff added |
---|
Unify treatment of ''
and '/'
in ChangesetModule
comment:5 by , 15 years ago
And this patch should address the issues that I actually considered broken in changeset.py. Although it's now far less likely that one encounters one of these problems, they should be fixed nonetheless. I also got rid of the download special case, as I assume you'll apply my zip download patch in one form or another.
How about changing the milestone to 0.12 so you won't forget this ticket?
comment:6 by , 15 years ago
Milestone: | 2.0 → 0.12 |
---|---|
Owner: | set to |
I can't resist to so much enthusiasm :-)
Assigning to cboos, as he's much more familiar with that part of the code than I am.
comment:7 by , 15 years ago
Milestone: | 0.12 → next-minor-0.12.x |
---|---|
Priority: | normal → high |
Severity: | trivial → normal |
comment:8 by , 14 years ago
Cc: | added |
---|---|
Keywords: | review added |
Summary: | Condition for zip download of dir → [PATCH] Condition for zip download of dir |
This is a patch that needs a review.
comment:10 by , 14 years ago
If you're aiming for 0.13 with this, you might consider making it less dependent on SVN. Currently the patch attached here relies on properties like svn:special and svn:executable. This isn't very portable for other repository backends. I would suggest adding interface methods for is_executable and is_symlink, so that backends can deal with this in their own way.
comment:11 by , 14 years ago
Cc: | added; removed |
---|
comment:12 by , 14 years ago
Keywords: | zip added |
---|
comment:13 by , 13 years ago
Ping? You've had the patches for 17 months now. Care to review them, and either commit them or ask for some specific improvement?
comment:14 by , 13 years ago
comment:17 by , 12 years ago
Three years have passed since I first posted my patch. There were at least three other tickets which could probably be resolved along with this one here. Any chances of eventually including this into the codebase? Do you need detailed explanations for any part of my patch?
comment:18 by , 12 years ago
Milestone: | next-stable-1.0.x → 1.0.2 |
---|---|
Status: | new → assigned |
Nobody got around addressing the concerns in comment:10 … but now that I look again at the patch, that doesn't seem to be a really blocking factor.
comment:19 by , 12 years ago
It might be easier to address those issues from comment:10 in another patch, once this one here has been merged. If you want me to, I can file a separate ticket for that, so you won't loose track of that room for improvement. The only reason why I added this comment here was that I thought a major release might be a good opportunity to introduce this kind of change.
comment:20 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
A case study in slacking, this one ;-)
- [11743] committed part of ChangesetEmptyPath.diff (fumbled on the ticket ref in this one)
- [11744] committed a reworked version of ZipDownload.patch
- [11745] implemented suggestion from comment:3
There are a few more follow-ups expected, as the download a zip in the changeset module doesn't work as expected for git and hg. Nothing new, though, and not related to these changes.
comment:21 by , 12 years ago
Owner: | changed from | to
---|
comment:22 by , 12 years ago
Release Notes: | modified (diff) |
---|
There is another piece of code which treats
'/'
and''
differently: source:trunk/trac/versioncontrol/web_ui/changeset.py@8899#L278 checksif not old_path
which evaluates to True as an empty string is treated as boolean False. Therefore old_path will be set to new_path, resulting in an equal diff between identical versions. Therefore the result will likely be an empty ZIP file.On the whole I feel that this approach to dir downloads as changesets is a bit of a hack, and therefore likely to cause trouble with backends other than svn. This is true in particular because the dirs to be compared are not related by a rename or similar, so calculating their diferences might be expensive or completely unsupported. In my opinion it would be cleaner to walk repository nodes in order to generate the list of files present in a given revision. Any chance you'll implement this?