@@ -290,22 +290,38 @@ public static bool MergeBranchIntoActive(string branch)
290
290
291
291
public static bool IsUpToDateWithRemote ( string remote , string branch , out bool yes )
292
292
{
293
+ // check for changes not in sync
293
294
yes = true ;
294
295
bool isUpToDate = true ;
295
- var stdCallback = new StdCallbackMethod ( delegate ( string line )
296
+ var stdCallback_log = new StdCallbackMethod ( delegate ( string line )
296
297
{
297
- //var match = Regex.Match(line, @"Your branch is ahead of '(.*)' by (\d*) commit.");
298
298
var match = Regex . Match ( line , @"commit (.*)" ) ;
299
299
if ( match . Success ) isUpToDate = false ;
300
300
} ) ;
301
-
302
- //var result = Tools.RunExe("git", "status", stdCallback:stdCallback);
303
- var result = Tools . RunExe ( "git" , string . Format ( "log {0}/{1}..{1}" , remote , branch ) , stdCallback : stdCallback ) ;
301
+
302
+ var result = Tools . RunExe ( "git" , string . Format ( "log {0}/{1}..{1}" , remote , branch ) , stdCallback : stdCallback_log ) ;
304
303
lastResult = result . Item1 ;
305
304
lastError = result . Item2 ;
306
-
307
305
yes = isUpToDate ;
306
+ //if (!string.IsNullOrEmpty(lastError)) return false;
307
+ //else if (!isUpToDate) return true;
308
308
return string . IsNullOrEmpty ( lastError ) ;
309
+
310
+ // if git log doesn't pick up anything try status
311
+ /*var stdCallback_status = new StdCallbackMethod(delegate(string line)
312
+ {
313
+ var match = Regex.Match(line, @"Your branch is ahead of '(.*)' by (\d*) commit.");
314
+ if (match.Success) isUpToDate = false;
315
+
316
+ match = Regex.Match(line, @"Your branch is behind '(.*)' by (\d*) commits");
317
+ if (match.Success) isUpToDate = false;
318
+ });
319
+
320
+ result = Tools.RunExe("git", "status", stdCallback:stdCallback_status);
321
+ lastResult = result.Item1;
322
+ lastError = result.Item2;
323
+ yes = isUpToDate;
324
+ return string.IsNullOrEmpty(lastError);*/
309
325
}
310
326
}
311
327
}
0 commit comments