Edgewall Software

Ticket #4366 (closed enhancement: fixed)

Opened 2 years ago

Last modified 22 months ago

Provide additional radio button in log template

Reported by: Tim Hatch <trac@…> Owned by: cboos
Priority: normal Milestone: 0.11
Component: version control/log view Version: 0.10.2
Severity: normal Keywords: ranges
Cc:

Description

This is a little difficult to explain. r4431:4432 shows the log message for both, but the radio buttons don't allow selecting "Prior to This" as a source revision for a diff to actually get the net changes for the two.

Of course, this is only valid if the node existed prior to what's being displayed.

Here's a rough hack that keys off whether the last listed change is an 'add' or something else. If it's a 'something else' then allow diffing to that n-1th revision. Move or copy probably needs to be on the list of things that perhaps can't be diffed against. A true fix would delve more into the source and see if it actually exists at r(n-1).

Index: templates/revisionlog.html
===================================================================
--- templates/revisionlog.html  (revision 4434)
+++ templates/revisionlog.html  (working copy)
@@ -110,7 +110,7 @@
                 <tr class="$odd_even">
                   <td class="diff">
                     <input type="radio" name="old" value="${item.path}@${item.rev}"
-                           checked="${idx == (len(items) - 1) or None}" />
+                           checked="${len(items)==0 or (items[-1].change=='add' and idx==len(items)-1)}" />
                     <input type="radio" name="new" value="${item.path}@${item.rev}"
                            checked="${idx == 0 or None}" />
                   </td>
@@ -146,6 +146,14 @@
                 </tr>
               </py:with>
             </py:for>
+            <tr py:if="len(items) and items[-1].change != 'add'">
+              <td class="diff">
+                <input type="radio" name="old"
+                       value="${items[-1].path}@${items[-1].rev-1}"
+                       checked="checked" />
+              </td>
+              <td colspan="6">Prior State</td>
+            </tr>
           </tbody>
         </table>

Attachments

t4366b.diff (3.4 KB) - added by Tim Hatch <trac@…> 2 years ago.
Second try
revisionlog-t4366.diff (3.8 KB) - added by cboos 22 months ago.
show "separator" lines in the revision log, for being able to generate the correct range of differences
revisionlog-t4366.2.diff (3.8 KB) - added by cboos 22 months ago.
patch fixed, works when the first revision is an addition

Change History

Changed 2 years ago by Tim Hatch <trac@…>

  • summary changed from Provide additional ratio button in log template to Provide additional radio button in log template

typo'd in summary.

Changed 2 years ago by cboos

  • milestone set to 1.0

I see what you mean; yes, I already thought that this would be nice. However, the fix would rather be in the log.py file, simply stopping one rev later.

Granted the code in log.py is currently a bit arcane...

(setting to 1.0 to keep it on the radar)

Changed 2 years ago by Tim Hatch <trac@…>

+1 on the log.py comment. That's why I didn't touch it!

So basically when revs is specified, back up revs.pairs[0][0] by 1, and/or when limit is specified, increment by 1. When either of these is used, should a flag be set that keeps the changelog message from showing up in the log view? I don't want to confuse users into thinking too many are displayed... but if it hits the end of line and there isn't a previous, we want to display the last one normally.

Changed 2 years ago by cboos

Well, actually this might be much simpler than expected (in log.py): look for the "limit" related comments and the del info[-1]. Similar things could be done for stop_rev and in case of ranges, this should be done for each interval.

I agree with displaying just a blank line (besides the radio button) for the extraneous revisions. This will have the additional benefit of separating the intervals.

Changed 2 years ago by Tim Hatch <trac@…>

Second try

Changed 2 years ago by Tim Hatch <trac@…>

Here's another version which handles the few cases I'm able to test. I went ahead and left in the color block for the type of changeset, thinking that might be useful. Less hacking is added to the template, as the logic is pretty much all in log.py.

The peek_back flag is set whenever it's allowed to (it doesn't make any sense to peek if it's not going to be displayed with radio buttons!)

Changed 22 months ago by cboos

show "separator" lines in the revision log, for being able to generate the correct range of differences

Changed 22 months ago by cboos

  • status changed from new to assigned
  • milestone changed from 1.0 to 0.11

Here's my take at it, attachment:revisionlog-t4366.diff. Nothing fancy, but seems to do the job for normal views and revision ranges (single range or multiple ranges).

No separator is shown when an explicit stop rev is given. This enables one to go back and forth between a given revision range diff and its corresponding changeset view.

Changed 22 months ago by cboos

Of course, this is only valid if the node existed prior to what's being displayed.

He, I knew something was missing before I could commit that change ;)

Changed 22 months ago by cboos

patch fixed, works when the first revision is an addition

Changed 22 months ago by cboos

  • keywords ranges added
  • status changed from assigned to closed
  • resolution set to fixed

Ok, committed this one as r4712.

Add/Change #4366 (Provide additional radio button in log template)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from cboos. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.