@@ -36,7 +36,7 @@ public object ViewContent
36
36
set => SetProperty ( ref _viewContent , value ) ;
37
37
}
38
38
39
- public FileHistoriesSingleRevision ( Repository repo , string file , Models . Commit revision , bool prevIsDiffMode )
39
+ public FileHistoriesSingleRevision ( string repo , string file , Models . Commit revision , bool prevIsDiffMode )
40
40
{
41
41
_repo = repo ;
42
42
_file = file ;
@@ -49,7 +49,7 @@ public FileHistoriesSingleRevision(Repository repo, string file, Models.Commit r
49
49
50
50
public async Task < bool > ResetToSelectedRevisionAsync ( )
51
51
{
52
- return await new Commands . Checkout ( _repo . FullPath )
52
+ return await new Commands . Checkout ( _repo )
53
53
. FileWithRevisionAsync ( _file , $ "{ _revision . SHA } ")
54
54
. ConfigureAwait ( false ) ;
55
55
}
@@ -59,13 +59,13 @@ public async Task OpenWithDefaultEditorAsync()
59
59
if ( _viewContent is not FileHistoriesRevisionFile { CanOpenWithDefaultEditor : true } )
60
60
return ;
61
61
62
- var fullPath = Native . OS . GetAbsPath ( _repo . FullPath , _file ) ;
62
+ var fullPath = Native . OS . GetAbsPath ( _repo , _file ) ;
63
63
var fileName = Path . GetFileNameWithoutExtension ( fullPath ) ?? "" ;
64
64
var fileExt = Path . GetExtension ( fullPath ) ?? "" ;
65
65
var tmpFile = Path . Combine ( Path . GetTempPath ( ) , $ "{ fileName } ~{ _revision . SHA . AsSpan ( 0 , 10 ) } { fileExt } ") ;
66
66
67
67
await Commands . SaveRevisionFile
68
- . RunAsync ( _repo . FullPath , _revision . SHA , _file , tmpFile )
68
+ . RunAsync ( _repo , _revision . SHA , _file , tmpFile )
69
69
. ConfigureAwait ( false ) ;
70
70
71
71
Native . OS . OpenWithDefaultEditor ( tmpFile ) ;
@@ -81,7 +81,7 @@ private void RefreshViewContent()
81
81
82
82
Task . Run ( async ( ) =>
83
83
{
84
- var objs = await new Commands . QueryRevisionObjects ( _repo . FullPath , _revision . SHA , _file )
84
+ var objs = await new Commands . QueryRevisionObjects ( _repo , _revision . SHA , _file )
85
85
. GetResultAsync ( )
86
86
. ConfigureAwait ( false ) ;
87
87
@@ -100,31 +100,31 @@ private async Task<object> GetRevisionFileContentAsync(Models.Object obj)
100
100
{
101
101
if ( obj . Type == Models . ObjectType . Blob )
102
102
{
103
- var isBinary = await new Commands . IsBinary ( _repo . FullPath , _revision . SHA , _file ) . GetResultAsync ( ) . ConfigureAwait ( false ) ;
103
+ var isBinary = await new Commands . IsBinary ( _repo , _revision . SHA , _file ) . GetResultAsync ( ) . ConfigureAwait ( false ) ;
104
104
if ( isBinary )
105
105
{
106
106
var imgDecoder = ImageSource . GetDecoder ( _file ) ;
107
107
if ( imgDecoder != Models . ImageDecoder . None )
108
108
{
109
- var source = await ImageSource . FromRevisionAsync ( _repo . FullPath , _revision . SHA , _file , imgDecoder ) . ConfigureAwait ( false ) ;
109
+ var source = await ImageSource . FromRevisionAsync ( _repo , _revision . SHA , _file , imgDecoder ) . ConfigureAwait ( false ) ;
110
110
var image = new Models . RevisionImageFile ( _file , source . Bitmap , source . Size ) ;
111
111
return new FileHistoriesRevisionFile ( _file , image , true ) ;
112
112
}
113
113
114
- var size = await new Commands . QueryFileSize ( _repo . FullPath , _file , _revision . SHA ) . GetResultAsync ( ) . ConfigureAwait ( false ) ;
114
+ var size = await new Commands . QueryFileSize ( _repo , _file , _revision . SHA ) . GetResultAsync ( ) . ConfigureAwait ( false ) ;
115
115
var binaryFile = new Models . RevisionBinaryFile ( ) { Size = size } ;
116
116
return new FileHistoriesRevisionFile ( _file , binaryFile , true ) ;
117
117
}
118
118
119
- var contentStream = await Commands . QueryFileContent . RunAsync ( _repo . FullPath , _revision . SHA , _file ) . ConfigureAwait ( false ) ;
119
+ var contentStream = await Commands . QueryFileContent . RunAsync ( _repo , _revision . SHA , _file ) . ConfigureAwait ( false ) ;
120
120
var content = await new StreamReader ( contentStream ) . ReadToEndAsync ( ) ;
121
121
var lfs = Models . LFSObject . Parse ( content ) ;
122
122
if ( lfs != null )
123
123
{
124
124
var imgDecoder = ImageSource . GetDecoder ( _file ) ;
125
125
if ( imgDecoder != Models . ImageDecoder . None )
126
126
{
127
- var combined = new RevisionLFSImage ( _repo . FullPath , _file , lfs , imgDecoder ) ;
127
+ var combined = new RevisionLFSImage ( _repo , _file , lfs , imgDecoder ) ;
128
128
return new FileHistoriesRevisionFile ( _file , combined , true ) ;
129
129
}
130
130
@@ -138,7 +138,7 @@ private async Task<object> GetRevisionFileContentAsync(Models.Object obj)
138
138
139
139
if ( obj . Type == Models . ObjectType . Commit )
140
140
{
141
- var submoduleRoot = Path . Combine ( _repo . FullPath , _file ) ;
141
+ var submoduleRoot = Path . Combine ( _repo , _file ) ;
142
142
var commit = await new Commands . QuerySingleCommit ( submoduleRoot , obj . SHA ) . GetResultAsync ( ) . ConfigureAwait ( false ) ;
143
143
var message = commit != null ? await new Commands . QueryCommitFullMessage ( submoduleRoot , obj . SHA ) . GetResultAsync ( ) . ConfigureAwait ( false ) : null ;
144
144
var module = new Models . RevisionSubmodule ( )
@@ -156,10 +156,10 @@ private async Task<object> GetRevisionFileContentAsync(Models.Object obj)
156
156
private void SetViewContentAsDiff ( )
157
157
{
158
158
var option = new Models . DiffOption ( _revision , _file ) ;
159
- ViewContent = new DiffContext ( _repo . FullPath , option , _viewContent as DiffContext ) ;
159
+ ViewContent = new DiffContext ( _repo , option , _viewContent as DiffContext ) ;
160
160
}
161
161
162
- private Repository _repo = null ;
162
+ private string _repo = null ;
163
163
private string _file = null ;
164
164
private Models . Commit _revision = null ;
165
165
private bool _isDiffMode = false ;
@@ -186,7 +186,7 @@ public DiffContext ViewContent
186
186
set => SetProperty ( ref _viewContent , value ) ;
187
187
}
188
188
189
- public FileHistoriesCompareRevisions ( Repository repo , string file , Models . Commit start , Models . Commit end )
189
+ public FileHistoriesCompareRevisions ( string repo , string file , Models . Commit start , Models . Commit end )
190
190
{
191
191
_repo = repo ;
192
192
_file = file ;
@@ -204,28 +204,28 @@ public void Swap()
204
204
public async Task < bool > SaveAsPatch ( string saveTo )
205
205
{
206
206
return await Commands . SaveChangesAsPatch
207
- . ProcessRevisionCompareChangesAsync ( _repo . FullPath , _changes , _startPoint . SHA , _endPoint . SHA , saveTo )
207
+ . ProcessRevisionCompareChangesAsync ( _repo , _changes , _startPoint . SHA , _endPoint . SHA , saveTo )
208
208
. ConfigureAwait ( false ) ;
209
209
}
210
210
211
211
private void RefreshViewContent ( )
212
212
{
213
213
Task . Run ( async ( ) =>
214
214
{
215
- _changes = await new Commands . CompareRevisions ( _repo . FullPath , _startPoint . SHA , _endPoint . SHA , _file ) . ReadAsync ( ) . ConfigureAwait ( false ) ;
215
+ _changes = await new Commands . CompareRevisions ( _repo , _startPoint . SHA , _endPoint . SHA , _file ) . ReadAsync ( ) . ConfigureAwait ( false ) ;
216
216
if ( _changes . Count == 0 )
217
217
{
218
218
Dispatcher . UIThread . Post ( ( ) => ViewContent = null ) ;
219
219
}
220
220
else
221
221
{
222
222
var option = new Models . DiffOption ( _startPoint . SHA , _endPoint . SHA , _changes [ 0 ] ) ;
223
- Dispatcher . UIThread . Post ( ( ) => ViewContent = new DiffContext ( _repo . FullPath , option , _viewContent ) ) ;
223
+ Dispatcher . UIThread . Post ( ( ) => ViewContent = new DiffContext ( _repo , option , _viewContent ) ) ;
224
224
}
225
225
} ) ;
226
226
}
227
227
228
- private Repository _repo = null ;
228
+ private string _repo = null ;
229
229
private string _file = null ;
230
230
private Models . Commit _startPoint = null ;
231
231
private Models . Commit _endPoint = null ;
@@ -264,7 +264,7 @@ public object ViewContent
264
264
private set => SetProperty ( ref _viewContent , value ) ;
265
265
}
266
266
267
- public FileHistories ( Repository repo , string file , string commit = null )
267
+ public FileHistories ( string repo , string file , string commit = null )
268
268
{
269
269
if ( ! string . IsNullOrEmpty ( commit ) )
270
270
Title = $ "{ file } @ { commit } ";
@@ -282,7 +282,7 @@ public FileHistories(Repository repo, string file, string commit = null)
282
282
. Append ( " -- " )
283
283
. Append ( file . Quoted ( ) ) ;
284
284
285
- var commits = await new Commands . QueryCommits ( _repo . FullPath , argsBuilder . ToString ( ) , false )
285
+ var commits = await new Commands . QueryCommits ( _repo , argsBuilder . ToString ( ) , false )
286
286
. GetResultAsync ( )
287
287
. ConfigureAwait ( false ) ;
288
288
@@ -311,7 +311,18 @@ public FileHistories(Repository repo, string file, string commit = null)
311
311
312
312
public void NavigateToCommit ( Models . Commit commit )
313
313
{
314
- _repo . NavigateToCommit ( commit . SHA ) ;
314
+ var launcher = App . GetLauncher ( ) ;
315
+ if ( launcher != null )
316
+ {
317
+ foreach ( var page in launcher . Pages )
318
+ {
319
+ if ( page . Data is Repository repo && repo . FullPath . Equals ( _repo , StringComparison . Ordinal ) )
320
+ {
321
+ repo . NavigateToCommit ( commit . SHA ) ;
322
+ break ;
323
+ }
324
+ }
325
+ }
315
326
}
316
327
317
328
public string GetCommitFullMessage ( Models . Commit commit )
@@ -320,12 +331,12 @@ public string GetCommitFullMessage(Models.Commit commit)
320
331
if ( _fullCommitMessages . TryGetValue ( sha , out var msg ) )
321
332
return msg ;
322
333
323
- msg = new Commands . QueryCommitFullMessage ( _repo . FullPath , sha ) . GetResult ( ) ;
334
+ msg = new Commands . QueryCommitFullMessage ( _repo , sha ) . GetResult ( ) ;
324
335
_fullCommitMessages [ sha ] = msg ;
325
336
return msg ;
326
337
}
327
338
328
- private readonly Repository _repo = null ;
339
+ private readonly string _repo = null ;
329
340
private bool _isLoading = true ;
330
341
private bool _prevIsDiffMode = true ;
331
342
private List < Models . Commit > _commits = null ;
0 commit comments