abdulkadir75 / gitiles

Automatically exported from code.google.com/p/gitiles
0 stars 0 forks source link

Display annotated "blame" version of a file #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Annotate the lines of a file with the revision they came from using the blame 
algorithm.

JGit blame is not identical to git-core's blame algorithm. Its a close 
approximation, but there are some differences in how JGit tracks the scoreboard 
and what annotations it can find.

Use /+blame/revision/path as the URL.

Because annotation is slow, results might want to be cached, and the page might 
want to use AJAX to feed down hunks of blame as they are discovered by the 
algorithm. This would be like the incremental blame display visible in git 
gui's blame window.

Original issue reported on code.google.com by dborowitz@google.com on 11 Nov 2012 at 11:25

GoogleCodeExporter commented 9 years ago
I thought about this a bit over the holiday and got a bit frustrated by the 
fact that JGit has no way to cache common blame info between successive 
revisions of the same blob, let a lone across multiple requests. Obviously all 
blame information for deadbeef^:foo is identical to deadbeef:foo except for 
what was actually modified by foo. Caching one revision's worth of blame is an 
obvious optimization, but someone clicking back through the blame history one 
revision at a time would be recomputing huge chunks of identical blame data.

Fixing this, I think, would require substantial changes to JGit's blame 
internals.

Original comment by dborowitz@google.com on 26 Dec 2012 at 7:37

GoogleCodeExporter commented 9 years ago
Chromium wants this sooner rather than later. Incremental caching and AJAX 
support may not be blockers.

Original comment by dborowitz@google.com on 23 Jan 2014 at 9:50

GoogleCodeExporter commented 9 years ago
For our timeline, it would be wonderful to have the first pass on this around 
Valentine's day. We just need something to show to the other Chrome devs so we 
can focus on other aspects of the git migration. Is that at all feasible? If 
not, is there a different date you can give us that will let us put our minds 
and schedules at ease?

Original comment by aga...@chromium.org on 27 Jan 2014 at 7:29

GoogleCodeExporter commented 9 years ago
Got a rough version of this working today, but found a bug in upstream JGit's 
blame implementation that may make the results...unsatisfying:

$ ~/c/jgit/org.eclipse.jgit.pgm/target/jgit blame -L 25,35 
61dcc102242e00d3b0061405d5c909564ebbd819 
gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java
d2fa1fdb (Shawn O. Pearce 2012-06-05 08:49:52 -0700 25) import static 
org.eclipse.jgit.transport.ReceiveCommand.Result.REJECTED_OTHER_REASON;
06cb1d25 (Dave Borowitz   2012-02-29 11:39:00 -0800 26) 
c545c090 (Shawn O. Pearce 2012-07-27 16:38:55 -0700 27) import 
com.google.common.base.Function;
e6298f72 (Shawn O. Pearce 2012-07-26 12:36:55 -0700 28) import 
com.google.common.base.Predicate;
         (                                          29) import com.google.common.base.Splitter;
0795c58a (Shawn Pearce    2013-02-24 15:13:27 -0800 30) import 
com.google.common.base.Strings;
         (                                          31) import com.google.common.collect.ArrayListMultimap;
         (                                          32) import com.google.common.collect.BiMap;
         (                                          33) import com.google.common.collect.HashBiMap;
5972e244 (Bruce Zu        2013-05-28 11:12:16 +0800 34) import 
com.google.common.collect.HashMultimap;

Original comment by dborowitz@google.com on 29 Jan 2014 at 1:32

GoogleCodeExporter commented 9 years ago
Submitted: 
https://gerrit-review.googlesource.com/#/q/project:gitiles+topic:blame,n,z

JGit bug still exists so results may not be totally accurate, but you can get 
some idea of the UI. Should be live on *.googlesource.com later this week.

Original comment by dborowitz@google.com on 30 Jan 2014 at 12:50

GoogleCodeExporter commented 9 years ago
This might be the upstream JGit bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=374382

Doesn't look like anybody has attempted to fix it, but at least there's a 
better description than "blame doesn't work sometimes."

Original comment by dborowitz@google.com on 3 Feb 2014 at 11:49