Opened 21 years ago
Closed 19 years ago
#199 closed enhancement (fixed)
Ability to diff between any 2 revisions of a file or directory
Reported by: | anonymous | Owned by: | Christian Boos |
---|---|---|---|
Priority: | high | Milestone: | 0.10 |
Component: | version control/changeset view | Version: | devel |
Severity: | major | Keywords: | tracdiff |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
Would be a very nice feature to be able to diff between any 2 revs of a file, as opposed to just the immediate previous changes
Attachments (7)
Change History (39)
comment:1 by , 21 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 21 years ago
Owner: | changed from | to
---|
comment:3 by , 21 years ago
Milestone: | → 0.8 |
---|---|
Priority: | normal → high |
comment:4 by , 20 years ago
Milestone: | 0.8 → 1.0 |
---|
comment:5 by , 20 years ago
Priority: | high → highest |
---|
comment:6 by , 20 years ago
Priority: | highest → normal |
---|
comment:7 by , 20 years ago
Crude hack to make this work for now. It reuses the changeset code to get and show the diff. No checking of variables, so you should probably use it in a closed environment only.
Apply the patches and browse the revision log of a file. Select the "A" and "B" revisions to be compared and use the submit button.
comment:8 by , 20 years ago
Summary: | Ability to diff between any 2 revs of a file → Ability to diff between any 2 revisions of a file or directory |
---|
Should work for directories too.
comment:9 by , 20 years ago
TracLinks syntax proposal for generalized diffs:
diff:trunk/trac#1550
: diff from revision 1550 to the headdiff:trunk/trac#1550:1560
: diff from revision 1550 to revision 1560diff:branches/cboos-dev/intertrac-branch
: diff from initial revision (add or copy) to the head (i.e. show the diffs accumulated on a branch since its creation)diff:branches/cboos-dev/intertrac-branch//trunk
: diff from latest revision on the first path to the latest rev on the second pathdiff:branches/cboos-dev/intertrac-branch#1500//trunk
: diff from revision 1500 on the first path to the latest rev on the second pathdiff:branches/cboos-dev/intertrac-branch#1500//trunk#1600
: diff from revision 1500 on the first path to the revision 1600 on the second path
comment:10 by , 20 years ago
The patches have a minor problem - the unified diff link at the bottom of the page does not work. The arguments 'a' and 'b' are not set for that call. Here's the python traceback:
Traceback (most recent call last):
File "/usr/lib/python2.3/site-packages/trac/ModPythonHandler.py", line 195, in handler
core.dispatch_request(mpr.path_info, args, mpr, env)
File "./core.py", line 442, in dispatch_request File "/usr/lib/python2.3/site-packages/trac/Module.py", line 46, in run
disp()
File "/usr/lib/python2.3/site-packages/trac/Anydiff.py", line 229, in display_diff
self.render_diffs(UnifiedDiffEditor)
File "/usr/lib/python2.3/site-packages/trac/Anydiff.py", line 200, in render_diffs
old_root = svn.fs.revision_root(self.fs_ptr, int(self.args.get('a')), self.pool)
ValueError: invalid literal for int():
args contains nothing on the call to render_diffs in this case (but the HTML diffs call contains the correct arguments).
comment:11 by , 19 years ago
Owner: | changed from | to
---|---|
Status: | assigned → new |
I'll have a try on this one, with a simple web interface in the log view, to begin with.
by , 19 years ago
Attachment: | diff_module_alpha1.diff added |
---|
For your testing pleasure, this is my initial attempt. It's not 100% robust, but it does show the new interface and ideas (see follow-up comment)
comment:12 by , 19 years ago
Priority: | normal → high |
---|---|
Status: | new → assigned |
An initial version of the Diff module has been attached.
The Diff module
It is a derivative of the Changeset module, and it operates in 3 modes:
- Path history mode: same as the normal Changeset view, but focusing on a given path. Handy for "scrolling" on the changes for a given file (TODO: in order to work correctly, should take the sequence of revisions from the history of that path).
- Diff between revisions: given a path, shows the changes occuring between two revisions
- Arbitrary diff': given two (path,revision) pairs, shows the diffs occuring between them
As the last two modes deal with more than a changeset, no changeset information is shown (except links to the old and new changesets).
The Web UI
For the Path History Mode
There's a Diff to previous link in the Browser View. Then, in the Diff View there are links for the Previous Diff and the Next Diff, so that one can easily examine the sequence of changes that happened on a given path.
For the Diff between Revisions
The Log View has a link Select for Diff, which expands the current log view with selectors for the old and new revisions.
Then, after selecting those revisions and clicking on Diff, the Diff View opens.
For the Arbitrary Diff
No UI yet, but I intend to give the possibility to remember the current path displayed in the Log View as a base for diffing against it.
P.S.: This is work in progress, mainly for getting early feedback
I'm not sure if the patch will apply cleanly, because I did a
svn copy trac/Changeset.py trac/Diff.py svn copy templates/changeset.cs templates/diff.cs
and those operations are apparently not marked as such in the .diff (svn 1.1.1 bug?). If this is a problem, simply create the initial version of the diff files by copying the changeset files.
comment:13 by , 19 years ago
Summary: | Ability to diff between any 2 revisions of a file or directory → recommended UI examples |
---|
This is a really essential feature in version control web browsers such as viewcvs and mediawiki.
For a UI, I would suggest the use of radio buttons like mediawiki. For example, Wikipedia Subversion History. All of the dynamic Javascript is not necessary—just the radio buttons and a "Diff" button.
I would not so much recommend the viewcvs UI. For example, Apache 1.3 README history. This is not as usable.
comment:14 by , 19 years ago
Summary: | recommended UI examples → Ability to diff between any 2 revisions of a file or directory |
---|
comment:15 by , 19 years ago
Actually, what I did is closer to the Wikipedia model (as the original patch did).
Here's the second iteration of the patch, which handles better additions and changes…
by , 19 years ago
Attachment: | diff_module_alpha2.diff added |
---|
Improved upon alpha1 — test this one, ignore the previous one
comment:16 by , 19 years ago
diff_module: alpha3
I added an UI for the Arbitrary Diff:
There's now a possibility to select the current Path/Revision in the Log View and to keep that selection in the session.
Then, in the Log View for another Path/Revision, one can Diff against the currently selected base.
Maybe I should add that Diff panel in the Browser View too, so that one is not forced to go to the Log View in order to perform a diff between branches…
by , 19 years ago
Attachment: | diff_module_alpha3.diff added |
---|
Third iteration, added the UI for arbitrary diff (attachment is there now)
comment:17 by , 19 years ago
diff_module: beta1
Things begin to look good, functionality wise.
- Added support for diff and zip format
- Added the possibility to select the base for diff in the browser too. This is very convenient.
- + various fixes
by , 19 years ago
Attachment: | diff_module_beta1.diff added |
---|
Things begin to look good (patch against [1756])
comment:18 by , 19 years ago
ok, noob question: how I do apply the .patch or .diff file(s) to my own trac install? :) and which ones do I apply?
comment:19 by , 19 years ago
$ cd <somewhere>/trac-trunk $ ls htdocs/ templates/ trac/ README ... # # Applying the patch # $ cp trac/Changeset.py trac/Diff.py $ cp templates/changeset.cs templates/diff.cs $ patch -p0 < diff_module_beta1.diff # # To install and run (with tracd) # $ python setup.py install --prefix=/opt/trac-0.9pre-diff-module $ export PYTHONPATH=/opt/trac-0.9pre-diff-module/lib/site-packages $ /opt/trac-0.9pre-diff-module/scripts/tracd -p 8008 $TRAC_ENV
comment:20 by , 19 years ago
Ok, work on this topic goes on there: source:branches/cboos-dev/anydiff-branch
The last patch (diff_module_beta1.diff) is available in [1761] as well.
comment:21 by , 19 years ago
I cannot diff against the previous version using the link provided named "Diff to previous" it throws this error. The good news is that if I go to the revision history of a file I can diff between those revisions using the radio buttons.
Traceback (most recent call last): File "/usr/lib/python2.3/site-packages/trac/web/modpython_frontend.py", line 265, in handler dispatch_request(mpr.path_info, mpr, env) File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 419, in dispatch_request dispatcher.dispatch(req) File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 283, in dispatch resp = chosen_handler.process_request(req) File "/usr/lib/python2.3/site-packages/trac/Diff.py", line 90, in process_request chgset = repos.get_changeset(rev) File "/usr/lib/python2.3/site-packages/trac/versioncontrol/cache.py", line 49, in get_changeset return CachedChangeset(rev, self.db, self.authz) File "/usr/lib/python2.3/site-packages/trac/versioncontrol/cache.py", line 130, in __init__ date, author, message = cursor.fetchone() TypeError: unpack non-sequence
comment:22 by , 19 years ago
Milestone: | 1.0 → 0.9 |
---|---|
Priority: | high → highest |
That's an expected error for the diff_module_beta1.diff patch. Since then, a lot of work has been done on the branch.
You should try against source:branches/cboos-dev/anydiff-branch (since revision [1777]), everything should work (see also the TracDiff page for the documentation).
comment:23 by , 19 years ago
I just installed from your anydiff-branch
[1803] and everything seems to be working. I caught your post on the mailing list about the "set base for diff" button holding state in the web pages.
I'll have to use this for a while before I weigh in with my thoughts. I'll keep you informed on the mailing list.
Cheers, Chris
comment:24 by , 19 years ago
Component: | browser → search system |
---|---|
Resolution: | → worksforme |
Status: | assigned → closed |
comment:25 by , 19 years ago
Component: | search system → browser |
---|---|
Resolution: | worksforme |
Status: | closed → reopened |
comment:26 by , 19 years ago
Component: | browser → changeset view |
---|---|
Milestone: | 0.9 → 1.0 |
Priority: | highest → normal |
Severity: | normal → major |
Version: | none → devel |
comment:28 by , 19 years ago
Perhaps this has already been addressed, but with the ability to fetch an arbitrary diff between files, it doesn't seem out of line to list the the user/revision of the line changes for the diff (and/or entire original file, in the case of a ViewCVS annotate-like functionality), when such things are applicable.
comment:30 by , 19 years ago
Keywords: | tracdiff added |
---|---|
Priority: | normal → high |
Please test and provide feedback for source:sandbox/trac-diff
comment:31 by , 19 years ago
Milestone: | 1.0 → 0.10 |
---|
comment:32 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Going to remove this from my plate for the time being. I may come back to this later on, but if not, its open for anyone else.