@@ -72,6 +72,7 @@ public static BranchState[] GetNonActiveBranches(bool getRemotes)
72
72
73
73
public static bool Checkout ( BranchState branch )
74
74
{
75
+ bool success = true ;
75
76
try
76
77
{
77
78
if ( activeBranch . name != branch . name )
@@ -81,17 +82,17 @@ public static bool Checkout(BranchState branch)
81
82
else
82
83
{
83
84
Debug . LogError ( "Already on branch: " + branch . name , true ) ;
84
- return false ;
85
+ success = false ;
85
86
}
86
87
}
87
88
catch ( Exception e )
88
89
{
89
90
Debug . LogError ( "BranchManager.Checkout Failed: " + e . Message , true ) ;
90
- return false ;
91
+ success = false ;
91
92
}
92
93
93
94
RepoManager . Refresh ( ) ;
94
- return true ;
95
+ return success ;
95
96
}
96
97
97
98
public static MergeResults MergeBranchIntoActive ( BranchState srcBranch )
@@ -108,7 +109,7 @@ public static MergeResults MergeBranchIntoActive(BranchState srcBranch)
108
109
catch ( Exception e )
109
110
{
110
111
Debug . LogError ( "BranchManager.Merge Failed: " + e . Message , true ) ;
111
- return MergeResults . Error ;
112
+ mergeResult = MergeResults . Error ;
112
113
}
113
114
114
115
RepoManager . Refresh ( ) ;
@@ -117,6 +118,7 @@ public static MergeResults MergeBranchIntoActive(BranchState srcBranch)
117
118
118
119
public static bool CheckoutNewBranch ( string branchName , string remoteName = null )
119
120
{
121
+ bool success = true ;
120
122
try
121
123
{
122
124
// create branch
@@ -138,77 +140,81 @@ public static bool CheckoutNewBranch(string branchName, string remoteName = null
138
140
catch ( Exception e )
139
141
{
140
142
Debug . LogError ( "Add new Branch Error: " + e . Message , true ) ;
141
- return false ;
143
+ success = false ;
142
144
}
143
145
144
146
RepoManager . Refresh ( ) ;
145
- return true ;
147
+ return success ;
146
148
}
147
149
148
150
public static bool DeleteNonActiveBranch ( BranchState branch )
149
151
{
152
+ bool success = true ;
150
153
try
151
154
{
152
155
if ( ! Repository . DeleteBranch ( branch . name ) ) throw new Exception ( Repository . lastError ) ;
153
156
}
154
157
catch ( Exception e )
155
158
{
156
159
Debug . LogError ( "Delete new Branch Error: " + e . Message , true ) ;
157
- return false ;
160
+ success = false ;
158
161
}
159
162
160
163
RepoManager . Refresh ( ) ;
161
- return true ;
164
+ return success ;
162
165
}
163
166
164
167
public static bool RenameActiveBranch ( string newBranchName )
165
168
{
169
+ bool success = true ;
166
170
try
167
171
{
168
172
if ( ! Repository . RenameActiveBranch ( newBranchName ) ) throw new Exception ( Repository . lastError ) ;
169
173
}
170
174
catch ( Exception e )
171
175
{
172
176
Debug . LogError ( "Rename new Branch Error: " + e . Message , true ) ;
173
- return false ;
177
+ success = false ;
174
178
}
175
179
176
180
RepoManager . Refresh ( ) ;
177
- return true ;
181
+ return success ;
178
182
}
179
183
180
184
public static bool CopyTracking ( BranchState srcRemoteBranch )
181
185
{
186
+ bool success = true ;
182
187
try
183
188
{
184
189
if ( ! Repository . SetActiveBranchTracking ( srcRemoteBranch . fullname ) ) throw new Exception ( Repository . lastError ) ;
185
190
}
186
191
catch ( Exception e )
187
192
{
188
193
Debug . LogError ( "Add/Update tracking Branch Error: " + e . Message , true ) ;
189
- return false ;
194
+ success = false ;
190
195
}
191
196
192
197
RepoManager . Refresh ( ) ;
193
- return true ;
198
+ return success ;
194
199
}
195
200
196
201
public static bool RemoveTracking ( )
197
202
{
198
203
if ( ! activeBranch . isTracking ) return true ;
199
204
205
+ bool success = true ;
200
206
try
201
207
{
202
208
if ( ! Repository . RemoveActiveBranchTracking ( ) ) throw new Exception ( Repository . lastError ) ;
203
209
}
204
210
catch ( Exception e )
205
211
{
206
212
Debug . LogError ( "Remove Branch Error: " + e . Message , true ) ;
207
- return false ;
213
+ success = false ;
208
214
}
209
215
210
216
RepoManager . Refresh ( ) ;
211
- return true ;
217
+ return success ;
212
218
}
213
219
214
220
public static bool IsUpToDateWithRemote ( out bool yes )
0 commit comments