X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=GitRepo.vala;h=7ec4f4189cf36b6cef38b385b3e3d3511f75e9bd;hb=9d62e97e5ecab71cdff5536e049eb2e06827e7d0;hp=77a56f2fcf5bd1111ff05857a0cd00e94453c0f4;hpb=beb0b87544a81660c3e886c1130306bb54efb2cd;p=gitlive diff --git a/GitRepo.vala b/GitRepo.vala index 77a56f2f..7ec4f418 100644 --- a/GitRepo.vala +++ b/GitRepo.vala @@ -32,7 +32,7 @@ public class GitRepo : Object } return _GitRepo; } - + /** * index of.. matching gitpath.. */ @@ -179,6 +179,11 @@ public class GitRepo : Object { return !FileUtils.test(this.gitdir + "/.gitlive-disable-autocommit" , FileTest.EXISTS); } + + public bool is_auto_branch () + { + return FileUtils.test(this.gitdir + "/.gitlive-enable-auto-branch" , FileTest.EXISTS); + } public bool is_autopush () { return !FileUtils.test(this.gitdir + "/.gitlive-disable-autopush" , FileTest.EXISTS); @@ -247,9 +252,7 @@ public class GitRepo : Object } GitMonitor.gitmonitor.start(); } - - - + public bool doMerge(string action, string ticket_id, string commit_message) { @@ -258,13 +261,12 @@ public class GitRepo : Object var ret = ""; if (action == "CLOSE" || action == "LEAVE") { - try { - var oldbranch = this.currentBranch.name; - this.setActiveTicket(null, "master"); + var oldbranch = this.currentBranch.name; + this.setActiveTicket(null, "master"); string [] cmd = { "merge", "--squash", oldbranch }; this.git( cmd ); - cmd = { "commit", "--m", commit_message }; + cmd = { "commit", "-a" , "-m", commit_message }; this.git( cmd ); this.push(); this.loadBranches(); // updates lastrev.. @@ -367,23 +369,28 @@ public class GitRepo : Object } catch(Error e) { GitMonitor.gitmonitor.pauseError(e.message); return false; - } try { - string[] cmd = { "merge", "master" }; - this.git(cmd); + if (branchname != "master") { + string[] cmd = { "merge", "master" }; + this.git(cmd); + this.push(); + //cmd = { "commit", "-a" , "-m", "merge master changes" }; + //git chethis.git( cmd ); + } + } catch(Error e) { - try { - string[] cmd = { "mergetool" }; - this.git(cmd); - cmd = { "commit", "-m" , "Fix merge conflicts from master" }; - this.git(cmd); - } catch(Error ee) { - GitMonitor.gitmonitor.pauseError(ee.message); - return false; - } + string[] cmd = { "checkout", "master" }; + this.git(cmd); + GitMonitor.gitmonitor.pauseError( + "Use\n\na) git checkout %s\nb) git mergetool\nc) git commit\nd) git push\n d) stash pop \ne) start gitlive again\n".printf( + branchname) + + e.message + ); + return false; + } - try { + try { string[] cmd = { "stash", "pop" }; if (stash) { this.git(cmd); } } catch(Error ee) { @@ -398,7 +405,7 @@ public class GitRepo : Object string[] cmd = { "checkout", "-b" , branchname }; this.git(cmd); - this.push(); + this.push(); } catch(Error ee) { GitMonitor.gitmonitor.pauseError(ee.message); return false; @@ -415,8 +422,7 @@ public class GitRepo : Object notification.set_timeout(5); notification.show(); - - + this.loadBranches(); // update branch list... GitMonitor.gitmonitor.runQueue(); // commit any outstanding... return true;