feature request: git merge proposal refs/pull (github) or refs/changes (gerrit) function

Bug #1771357 reported by Scott Moser
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Launchpad itself
Triaged
Low
Unassigned

Bug Description

Hi,

Often times when reviewing merge proposals I want to see the difference between two versions.
Example:
a.) user pushes initial code
b.) reviewer reviews and requests changes
c.) user pushes ammended changes

'c' is easy enough if the user just added commits on top of 'a'. Often
times, though, the developer does 'git commit --amend'.

The launchpad seems to have access to the older tip, and with the selection
box you can flip between the versions, but It would be nice to be able
to see those commits locally.

As example:
https://code.launchpad.net/~larsks/cloud-init/+git/cloud-init/+merge/345113
there, the developer Lars has several different versions of the merge proposal
and those can be selected via 'Preview Diff'
but there is no way I can get the old version from a 'git fetch'.
I want access to see what dd61338 looked like (or 74671dc or 288fbfe).
All I can currently get is the most recent commit (68c2ca5).
gitweb can still see the old commits:
   https://git.launchpad.net/~larsks/cloud-init/tree/?id=dd61338 ?

So this is a feature request really for two things:
a.) some namespace that contains merge proposals for a project (like github's
refs/pull/NUMBER) this makes it easy to fetch merge proposals for reviewing
locally with a git config like:
  [remote "myproject"]
    url = https://github.com/myproject/myproject.git
    fetch = +refs/heads/*:refs/remotes/myproject
    fetch = +refs/pull/*:refs/remotes/myproject/pr/*

b.) access to different versions of the merge request.
I can't find a way to get this info from github, but gerrit does have it.
As an example:
  https://review.openstack.org/#/c/400883/8

$ git ls-remote | grep 83/400883
From https://git.openstack.org/openstack/nova
51f005cdc012d36f54fb6357266f1955f4999827 refs/changes/83/400883/1
e3abbee44f24523cb6492fcda193cd5c91f5d7ca refs/changes/83/400883/2
705db9879a201147fcea3faff44e8573248002b9 refs/changes/83/400883/3
0d1f9b4d9d160b4da0bbf0a801f7553188ca4410 refs/changes/83/400883/4
0892c10388b35bb3eb2e2ce5b93b31dae5c9e0a3 refs/changes/83/400883/5
b3bb055ffdd0ed0b27111652e5ce297792ad7402 refs/changes/83/400883/6
f347852f355d4b248e8e6b863535845b151043ed refs/changes/83/400883/7
f559be35a03f5801f527355895a97c89cdc3c336 refs/changes/83/400883/8

So comparing two different versions of the change there is just
  git diff refs/changes/83/400883/7..refs/changes/83/400883/8

function like is available in gerrit, but seemingly not available in github

Colin Watson (cjwatson)
tags: added: feature git lp-code
Changed in launchpad:
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Scott Moser (smoser) wrote :

I came across another use case for this (or at least a related feature).

Often times a user will make a merge proposal, the code gets reviewed,
'Approved', and then the commits in the MP are squashed and rebased before
being added to trunk.

At that point, the requester has a branch that contains more "rich" history
than the master branch. If the user ever deletes that branch, then the history
is not available to anyone outside of the launchpad UI.

I came to this when looking at a ubuntu-git merge proposal:
 https://code.launchpad.net/~paelzer/ubuntu/+source/open-iscsi/+git/open-iscsi/+merge/346739

Because Christian's branch was still available I was able to rebase his commits
(originally done on ubuntu/devel onto a stable release branch
ubuntu/xenial-devel). This would not have been possible if Christian had
deleted his branch in a house-cleaning.

Heres what I did:

 # create the branch and set its HEAD to christian's MP branch.
 # then make it track a Stable release branch.
 $ git branch $BRANCH paelzer/cosmic-fix-1755858-socket-activation
 $ git branch --set-upstream-to=pkg/ubuntu/xenial-devel $BRANCH

 # checkout branch and rebase.
 $ git checkout $BRANCH
 $ git rebase -i pkg/import/2.0.874-5ubuntu2

If 'refs/changes/' like branches were available I could have substituted
  refs/changes/346739/FINAL
for paelzer/cosmic-fix-1755858-socket-activation above.

Revision history for this message
Drew Freiberger (afreiberger) wrote :

I will note that the only way that one can identify whether changes were resubmitted in a squashed/ammended commit is in the diff drop-down where it shows the various commits and dates of the diffs, otherwise, there's no way to tell that a change has been resubmitted or a commit has updated.

The amended commit shows the original commit's date in launchpad (see: https://code.launchpad.net/~ballot/charm-graylog/+git/charm-graylog/+merge/391046) where the latest amended commit still shows date of 2020-09, but the diff generated for that new commit number was 2021-01.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.