Edgewall Software
Modify

Opened 10 years ago

Last modified 7 months ago

#11439 new enhancement

Git changeset "Branches" property should link to branch logs

Reported by: ethan.jucovy@… Owned by:
Priority: normal Milestone: next-stable-1.6.x
Component: version control/changeset view Version: 1.0
Severity: normal Keywords:
Cc: Jun Omae Branch:
Release Notes:
API Changes:
Internal Changes:

Description

When viewing a Git changeset like [d19b3083d40b9237e8dbffa91dfa9f2f3b65e2ad/rjollos.git], the "Branches" property (showing the list of branches which contain this changeset) generates a link for each branch. Currently, the generated link is a "changeset" view of the branch's tip, so (e.g.) clicking on "trunk" in that list will show you the most recent changeset on the "trunk" branch.

This seems confusing. When I click on a branch in that list, seeing a changeset view makes me feel like I've lost my place in navigating around the repository. (This is exacerbated by the fact that the URL in the address bar and the <h1> on the page both reference the SHA of the branch tip, and there's no visual indicator that I'm viewing a particular branch tip.)

When I click on a branch in that list, I expect to go somewhere that contextualizes the branch somehow. I think the "log" view for that branch is the most sensible place to land.

Attachments (0)

Change History (10)

comment:1 by ethan.jucovy@…, 10 years ago

The following patch changes the "Branches" links to go to the log view of the branch's tip:

  • tracopt/versioncontrol/git/git_fs.py

    diff --git a/tracopt/versioncontrol/git/git_fs.py b/tracopt/versioncontrol/git/git_fs.py
    index 4cbb2f2..1b059f8 100644
    a b class CsetPropertyRenderer(Component):  
    306306            branches = props[name]
    307307
    308308            # simple non-merge commit
    309             return tag(*intersperse(', ', (sha_link(rev, label)
    310                                            for label, rev in branches)))
     309            href = context.href
     310            reponame = context.resource.parent.id
     311            return tag(*intersperse(', ',
     312                                    (tag.a(label, href=href.log(reponame, rev=rev))
     313                                     for label, rev in branches)))
    311314
    312315        elif name in ('Parents', 'Children'):
    313316            revs = props[name] # list of commit ids

It might be preferable (for reasons described in #11437) to instead generate a "non-normalized" link to the branch name itself, rather than to the SHA of its current tip; the following patch would do that:

  • tracopt/versioncontrol/git/git_fs.py

    diff --git a/tracopt/versioncontrol/git/git_fs.py b/tracopt/versioncontrol/git/git_fs.py
    index 4cbb2f2..1b059f8 100644
    a b class CsetPropertyRenderer(Component):  
    306306            branches = props[name]
    307307
    308308            # simple non-merge commit
    309             return tag(*intersperse(', ', (sha_link(rev, label)
    310                                            for label, rev in branches)))
     309            href = context.href
     310            reponame = context.resource.parent.id
     311            return tag(*intersperse(', ',
     312                                    (tag.a(label, href=href.log(reponame, rev=label))
     313                                     for label, rev in branches)))
    311314
    312315        elif name in ('Parents', 'Children'):
    313316            revs = props[name] # list of commit ids

comment:2 by ethan.jucovy@…, 10 years ago

This would be problematic in some cases:

  • User has CHANGESET_VIEW permission but does not have LOG_VIEW permission
  • Environment has trac.versioncontrol.web_ui.changeset.ChangesetModule component enabled but has trac.versioncontrol.web_ui.log.LogModule component disabled

Perhaps in those cases the link should revert to its current behavior. Or maybe these are reasons to wontfix and/or implement in a plugin.

in reply to:  description comment:3 by Ryan J Ollos, 10 years ago

Replying to ethan.jucovy@…:

When I click on a branch in that list, I expect to go somewhere that contextualizes the branch somehow. I think the "log" view for that branch is the most sensible place to land.

I'll have to think about it some more, but navigating to the log view seems more intuitive to me as well.

comment:4 by Jun Omae, 10 years ago

Cc: Jun Omae added
Milestone: next-stable-1.0.x
Version: 1.0

I think we should add browser view and log view links for revision to the changeset view, not only git property renderer. It would be useful. Thoughts?

comment:5 by Ryan J Ollos, 10 years ago

It sounds like a useful aid for navigation. Where would the browser view and log view links be placed?

Last edited 10 years ago by Ryan J Ollos (previous) (diff)

comment:6 by Ryan J Ollos, 7 years ago

Milestone: next-stable-1.0.xnext-stable-1.2.x

Moved ticket assigned to next-stable-1.0.x since maintenance of 1.0.x is coming to a close. Please move the ticket back if it's critical to fix on 1.0.x.

comment:7 by strk@…, 6 years ago

Very useful change (I came to see if a ticket existed to record a "default branch" to show in browser, but found this to be also useful to have)

comment:8 by Peter Suter, 6 years ago

we should add browser view and log view links for revision to the changeset view

Where would the browser view and log view links be placed?

I would expect something like this:

diff -r ec566f6d999f trac/versioncontrol/web_ui/changeset.py
@@ -367,6 +373,11 @@
                 prevnext_nav(req, _('Previous Change'), _('Next Change'))
             else:
                 prevnext_nav(req, _('Previous Changeset'), _('Next Changeset'))
+            add_ctxtnav(req, _('Revision Log'),
+                        href=req.href.log(reponame, new_path, rev=new))
+            add_ctxtnav(req, _('View Revision'),
+                        href=req.href.browser(reponame, new_path, rev=new))
+
         else:
             rev_href = req.href.changeset(old, full_old_path,
                                           old=new, old_path=full_new_path)

There are already similar links from the browser to the log and from the log to the browser.

comment:9 by Ryan J Ollos, 4 years ago

Milestone: next-stable-1.2.xnext-stable-1.4.x

comment:10 by Ryan J Ollos, 7 months ago

Milestone: next-stable-1.4.xnext-stable-1.6.x

Milestone renamed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


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