X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=GitRepo.vala;h=7ec4f4189cf36b6cef38b385b3e3d3511f75e9bd;hb=9d62e97e5ecab71cdff5536e049eb2e06827e7d0;hp=6108c1eebf7dbd66f0fe24e2c129515917d3c2f3;hpb=55d94ffcc22b705da1d4149afd5d4cfb453136ba;p=gitlive diff --git a/GitRepo.vala b/GitRepo.vala index 6108c1ee..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,14 +261,14 @@ 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.. var notification = new Notify.Notification( @@ -366,36 +369,43 @@ 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) { GitMonitor.gitmonitor.pauseError(ee.message); return false; } - + this.push(); } else { try { string[] cmd = { "checkout", "-b" , branchname }; this.git(cmd); + + this.push(); } catch(Error ee) { GitMonitor.gitmonitor.pauseError(ee.message); return false; @@ -412,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; @@ -579,7 +588,7 @@ public class GitRepo : Object public string push () throws Error, SpawnError { // should - return this.git({ "push", "origin", "HEAD" }); + return this.git({ "push", "--all" }); }