1
1
using System ;
2
+ using System . Collections . Generic ;
2
3
using System . Linq ;
3
4
using UnityEditor ;
4
5
using UnityEngine ;
@@ -27,13 +28,6 @@ class ChangesView : Subview
27
28
[ SerializeField ] private Vector2 horizontalScroll ;
28
29
[ SerializeField ] private CacheUpdateEvent lastCurrentBranchChangedEvent ;
29
30
[ SerializeField ] private CacheUpdateEvent lastStatusChangedEvent ;
30
- [ SerializeField ] private ChangesetTreeView tree = new ChangesetTreeView ( ) ;
31
-
32
- public override void InitializeView ( IView parent )
33
- {
34
- base . InitializeView ( parent ) ;
35
- tree . InitializeView ( this ) ;
36
- }
37
31
38
32
public override void OnEnable ( )
39
33
{
@@ -64,7 +58,7 @@ public override void OnGUI()
64
58
{
65
59
GUILayout . BeginHorizontal ( ) ;
66
60
{
67
- EditorGUI . BeginDisabledGroup ( tree . Entries . Count == 0 ) ;
61
+ EditorGUI . BeginDisabledGroup ( false ) ;
68
62
{
69
63
if ( GUILayout . Button ( SelectAllButton , EditorStyles . miniButtonLeft ) )
70
64
{
@@ -80,23 +74,18 @@ public override void OnGUI()
80
74
81
75
GUILayout . FlexibleSpace ( ) ;
82
76
83
- GUILayout . Label (
84
- tree . Entries . Count == 0
85
- ? NoChangedFilesLabel
86
- : tree . Entries . Count == 1
87
- ? OneChangedFileLabel
88
- : String . Format ( ChangedFilesLabel , tree . Entries . Count ) , EditorStyles . miniLabel ) ;
77
+ // GUILayout.Label(
78
+ // tree.Entries.Count == 0
79
+ // ? NoChangedFilesLabel
80
+ // : tree.Entries.Count == 1
81
+ // ? OneChangedFileLabel
82
+ // : String.Format(ChangedFilesLabel, tree.Entries.Count), EditorStyles.miniLabel);
89
83
}
90
84
GUILayout . EndHorizontal ( ) ;
91
85
92
86
horizontalScroll = GUILayout . BeginScrollView ( horizontalScroll ) ;
93
- GUILayout . BeginHorizontal ( ) ;
94
- GUILayout . BeginVertical ( Styles . CommitFileAreaStyle ) ;
95
87
{
96
- tree . OnGUI ( ) ;
97
88
}
98
- GUILayout . EndVertical ( ) ;
99
- GUILayout . EndHorizontal ( ) ;
100
89
GUILayout . EndScrollView ( ) ;
101
90
102
91
// Do the commit details area
@@ -156,8 +145,6 @@ private void MaybeUpdateData()
156
145
if ( currentStatusHasUpdate )
157
146
{
158
147
currentStatusHasUpdate = false ;
159
- var gitStatus = Repository . CurrentStatus ;
160
- tree . UpdateEntries ( gitStatus . Entries . Where ( x => x . Status != GitFileStatus . Ignored ) . ToList ( ) ) ;
161
148
}
162
149
}
163
150
@@ -186,7 +173,8 @@ private void OnCommitDetailsAreaGUI()
186
173
GUILayout . Space ( Styles . CommitAreaPadding ) ;
187
174
188
175
// Disable committing when already committing or if we don't have all the data needed
189
- EditorGUI . BeginDisabledGroup ( isBusy || string . IsNullOrEmpty ( commitMessage ) || ! tree . CommitTargets . Any ( t => t . Any ) ) ;
176
+ //EditorGUI.BeginDisabledGroup(isBusy || string.IsNullOrEmpty(commitMessage) || !tree.CommitTargets.Any(t => t.Any));
177
+ EditorGUI . BeginDisabledGroup ( isBusy || string . IsNullOrEmpty ( commitMessage ) ) ;
190
178
{
191
179
GUILayout . BeginHorizontal ( ) ;
192
180
{
@@ -212,48 +200,48 @@ private void OnCommitDetailsAreaGUI()
212
200
213
201
private void SelectAll ( )
214
202
{
215
- for ( var index = 0 ; index < tree . CommitTargets . Count ; ++ index )
216
- {
217
- tree . CommitTargets [ index ] . All = true ;
218
- }
203
+ // for (var index = 0; index < tree.CommitTargets.Count; ++index)
204
+ // {
205
+ // tree.CommitTargets[index].All = true;
206
+ // }
219
207
}
220
208
221
209
private void SelectNone ( )
222
210
{
223
- for ( var index = 0 ; index < tree . CommitTargets . Count ; ++ index )
224
- {
225
- tree . CommitTargets [ index ] . All = false ;
226
- }
211
+ // for (var index = 0; index < tree.CommitTargets.Count; ++index)
212
+ // {
213
+ // tree.CommitTargets[index].All = false;
214
+ // }
227
215
}
228
216
229
217
private void Commit ( )
230
218
{
231
219
// Do not allow new commits before we have received one successful update
232
- isBusy = true ;
233
-
234
- var files = Enumerable . Range ( 0 , tree . Entries . Count )
235
- . Where ( i => tree . CommitTargets [ i ] . All )
236
- . Select ( i => tree . Entries [ i ] . Path )
237
- . ToList ( ) ;
238
-
239
- ITask addTask ;
240
-
241
- if ( files . Count == tree . Entries . Count )
242
- {
243
- addTask = Repository . CommitAllFiles ( commitMessage , commitBody ) ;
244
- }
245
- else
246
- {
247
- addTask = Repository . CommitFiles ( files , commitMessage , commitBody ) ;
248
- }
249
-
250
- addTask
251
- . FinallyInUI ( ( b , exception ) =>
252
- {
253
- commitMessage = "" ;
254
- commitBody = "" ;
255
- isBusy = false ;
256
- } ) . Start ( ) ;
220
+ // isBusy = true;
221
+ //
222
+ // var files = Enumerable.Range(0, tree.Entries.Count)
223
+ // .Where(i => tree.CommitTargets[i].All)
224
+ // .Select(i => tree.Entries[i].Path)
225
+ // .ToList();
226
+ //
227
+ // ITask addTask;
228
+ //
229
+ // if (files.Count == tree.Entries.Count)
230
+ // {
231
+ // addTask = Repository.CommitAllFiles(commitMessage, commitBody);
232
+ // }
233
+ // else
234
+ // {
235
+ // addTask = Repository.CommitFiles(files, commitMessage, commitBody);
236
+ // }
237
+ //
238
+ // addTask
239
+ // .FinallyInUI((b, exception) =>
240
+ // {
241
+ // commitMessage = "";
242
+ // commitBody = "";
243
+ // isBusy = false;
244
+ // }).Start();
257
245
}
258
246
259
247
public override bool IsBusy
0 commit comments