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 47
47
"watch:css" : " npm run build:css -- -w"
48
48
},
49
49
"dependencies" : {
50
+ "date-fns" : " ^2.8.1" ,
50
51
"minimatch" : " ^3.0.4" ,
51
52
"original-fs" : " ^1.0.0" ,
52
53
"semver" : " ^6.0.0" ,
Original file line number Diff line number Diff line change 1
1
import { createHash } from "crypto" ;
2
+ import { formatDistanceToNow } from "date-fns" ;
2
3
import * as path from "path" ;
3
4
import {
4
5
commands ,
@@ -219,12 +220,18 @@ export function getCommitIcon(
219
220
return gravatar ;
220
221
}
221
222
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
+
222
230
export 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>" ;
226
233
}
227
- return ` ${ commitMsg } • r ${ commit . revision } ` ;
234
+ return commit . msg . split ( / \r ? \n / , 1 ) [ 0 ] ;
228
235
}
229
236
230
237
export function getCommitToolTip ( commit : ISvnLogEntry ) : string {
Original file line number Diff line number Diff line change @@ -29,7 +29,8 @@ import {
29
29
LogTreeItemKind ,
30
30
openDiff ,
31
31
openFileRemote ,
32
- transform
32
+ transform ,
33
+ getCommitDescription
33
34
} from "./common" ;
34
35
35
36
export class ItemLogProvider
@@ -156,6 +157,7 @@ export class ItemLogProvider
156
157
if ( element . kind === LogTreeItemKind . Commit ) {
157
158
const commit = element . data as ISvnLogEntry ;
158
159
ti = new TreeItem ( getCommitLabel ( commit ) , TreeItemCollapsibleState . None ) ;
160
+ ti . description = getCommitDescription ( commit ) ;
159
161
ti . iconPath = getCommitIcon ( commit . author ) ;
160
162
ti . tooltip = getCommitToolTip ( commit ) ;
161
163
ti . contextValue = "diffable" ;
@@ -182,6 +184,7 @@ export class ItemLogProvider
182
184
const fname = path . basename ( this . currentItem . svnTarget . fsPath ) ;
183
185
const ti = new TreeItem ( fname , TreeItemCollapsibleState . Expanded ) ;
184
186
ti . tooltip = path . dirname ( this . currentItem . svnTarget . fsPath ) ;
187
+ ti . description = path . dirname ( this . currentItem . svnTarget . fsPath ) ;
185
188
ti . iconPath = getIconObject ( "icon-history" ) ;
186
189
const item = {
187
190
kind : LogTreeItemKind . TItem ,
Original file line number Diff line number Diff line change @@ -37,7 +37,8 @@ import {
37
37
openDiff ,
38
38
openFileRemote ,
39
39
SvnPath ,
40
- transform
40
+ transform ,
41
+ getCommitDescription
41
42
} from "./common" ;
42
43
43
44
function getActionIcon ( action : string ) {
@@ -377,6 +378,7 @@ export class RepoLogProvider
377
378
getCommitLabel ( commit ) ,
378
379
TreeItemCollapsibleState . Collapsed
379
380
) ;
381
+ ti . description = getCommitDescription ( commit ) ;
380
382
ti . tooltip = getCommitToolTip ( commit ) ;
381
383
ti . iconPath = getCommitIcon ( commit . author ) ;
382
384
ti . contextValue = "commit" ;
@@ -385,6 +387,7 @@ export class RepoLogProvider
385
387
const pathElem = element . data as ISvnLogEntryPath ;
386
388
const basename = path . basename ( pathElem . _ ) ;
387
389
ti = new TreeItem ( basename , TreeItemCollapsibleState . None ) ;
390
+ ti . description = path . dirname ( pathElem . _ ) ;
388
391
const cached = this . getCached ( element ) ;
389
392
const nm = cached . repo . getPathNormalizer ( ) ;
390
393
ti . tooltip = nm . parse ( pathElem . _ ) . relativeFromBranch ;
You can’t perform that action at this time.
0 commit comments