@@ -290,22 +290,38 @@ public static bool MergeBranchIntoActive(string branch)
290290
291291 public static bool IsUpToDateWithRemote ( string remote , string branch , out bool yes )
292292 {
293+ // check for changes not in sync
293294 yes = true ;
294295 bool isUpToDate = true ;
295- var stdCallback = new StdCallbackMethod ( delegate ( string line )
296+ var stdCallback_log = new StdCallbackMethod ( delegate ( string line )
296297 {
297- //var match = Regex.Match(line, @"Your branch is ahead of '(.*)' by (\d*) commit.");
298298 var match = Regex . Match ( line , @"commit (.*)" ) ;
299299 if ( match . Success ) isUpToDate = false ;
300300 } ) ;
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 ) ;
304303 lastResult = result . Item1 ;
305304 lastError = result . Item2 ;
306-
307305 yes = isUpToDate ;
306+ //if (!string.IsNullOrEmpty(lastError)) return false;
307+ //else if (!isUpToDate) return true;
308308 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);*/
309325 }
310326 }
311327}
0 commit comments