File tree Expand file tree Collapse file tree 5 files changed +49
-29
lines changed Expand file tree Collapse file tree 5 files changed +49
-29
lines changed Original file line number Diff line number Diff line change 4747 "watch:css" : " npm run build:css -- -w"
4848 },
4949 "dependencies" : {
50+ "date-fns" : " ^2.8.1" ,
5051 "minimatch" : " ^3.0.4" ,
5152 "original-fs" : " ^1.0.0" ,
5253 "semver" : " ^6.0.0" ,
Original file line number Diff line number Diff line change 11import { createHash } from "crypto" ;
2+ import { formatDistanceToNow } from "date-fns" ;
23import * as path from "path" ;
34import {
45 commands ,
@@ -219,12 +220,18 @@ export function getCommitIcon(
219220 return gravatar ;
220221}
221222
223+ export function getCommitDescription ( commit : ISvnLogEntry ) : string {
224+ const relativeDate = formatDistanceToNow ( Date . parse ( commit . date ) , {
225+ addSuffix : true
226+ } ) ;
227+ return `r${ commit . revision } , ${ relativeDate } by ${ commit . author } ` ;
228+ }
229+
222230export function getCommitLabel ( commit : ISvnLogEntry ) : string {
223- let commitMsg = "<blank>" ;
224- if ( commit . msg ) {
225- commitMsg = commit . msg . split ( / \r ? \n / , 1 ) [ 0 ] ;
231+ if ( ! commit . msg ) {
232+ return "<blank>" ;
226233 }
227- return ` ${ commitMsg } • r ${ commit . revision } ` ;
234+ return commit . msg . split ( / \r ? \n / , 1 ) [ 0 ] ;
228235}
229236
230237export function getCommitToolTip ( commit : ISvnLogEntry ) : string {
Original file line number Diff line number Diff line change @@ -29,7 +29,8 @@ import {
2929 LogTreeItemKind ,
3030 openDiff ,
3131 openFileRemote ,
32- transform
32+ transform ,
33+ getCommitDescription
3334} from "./common" ;
3435
3536export class ItemLogProvider
@@ -156,6 +157,7 @@ export class ItemLogProvider
156157 if ( element . kind === LogTreeItemKind . Commit ) {
157158 const commit = element . data as ISvnLogEntry ;
158159 ti = new TreeItem ( getCommitLabel ( commit ) , TreeItemCollapsibleState . None ) ;
160+ ti . description = getCommitDescription ( commit ) ;
159161 ti . iconPath = getCommitIcon ( commit . author ) ;
160162 ti . tooltip = getCommitToolTip ( commit ) ;
161163 ti . contextValue = "diffable" ;
@@ -182,6 +184,7 @@ export class ItemLogProvider
182184 const fname = path . basename ( this . currentItem . svnTarget . fsPath ) ;
183185 const ti = new TreeItem ( fname , TreeItemCollapsibleState . Expanded ) ;
184186 ti . tooltip = path . dirname ( this . currentItem . svnTarget . fsPath ) ;
187+ ti . description = path . dirname ( this . currentItem . svnTarget . fsPath ) ;
185188 ti . iconPath = getIconObject ( "icon-history" ) ;
186189 const item = {
187190 kind : LogTreeItemKind . TItem ,
Original file line number Diff line number Diff line change @@ -37,7 +37,8 @@ import {
3737 openDiff ,
3838 openFileRemote ,
3939 SvnPath ,
40- transform
40+ transform ,
41+ getCommitDescription
4142} from "./common" ;
4243
4344function getActionIcon ( action : string ) {
@@ -377,6 +378,7 @@ export class RepoLogProvider
377378 getCommitLabel ( commit ) ,
378379 TreeItemCollapsibleState . Collapsed
379380 ) ;
381+ ti . description = getCommitDescription ( commit ) ;
380382 ti . tooltip = getCommitToolTip ( commit ) ;
381383 ti . iconPath = getCommitIcon ( commit . author ) ;
382384 ti . contextValue = "commit" ;
@@ -385,6 +387,7 @@ export class RepoLogProvider
385387 const pathElem = element . data as ISvnLogEntryPath ;
386388 const basename = path . basename ( pathElem . _ ) ;
387389 ti = new TreeItem ( basename , TreeItemCollapsibleState . None ) ;
390+ ti . description = path . dirname ( pathElem . _ ) ;
388391 const cached = this . getCached ( element ) ;
389392 const nm = cached . repo . getPathNormalizer ( ) ;
390393 ti . tooltip = nm . parse ( pathElem . _ ) . relativeFromBranch ;
You can’t perform that action at this time.
0 commit comments