From 7388386fab4fb12c36e6eeb7d19eaa4e4b16b853 Mon Sep 17 00:00:00 2001 From: Bruno Santos <bmfs@eksperimental.net> Date: Sat, 13 Mar 2010 15:16:30 +0000 Subject: [PATCH] * Implemented 'ti sync' The ticgit repository needs to be remote and tracked. In the original repository do something like: 1) ti # to create the ticgit branch 2) git push origin ticgit # to push it to remote 3) git branch -D ticgit 4) git checkout --track -b ticgit origin/ticgit 5) git checkout master # in my case is branch I usually work on 6) use ticgit normally and call 'ti sync' when you want to sync with the remote repository When you colaborate you do something like: 1) git clone git://(...) # clone the repository you want 2) git checkout --trac -b ticgit origin/ticgit 3) git checkout master # in my case is branch I usually work on 4) use ticgit normally and call 'ti sync' when you want to sync with the remote repository --- lib/ticgit/base.rb | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/lib/ticgit/base.rb b/lib/ticgit/base.rb index 3075a79b..5b450256 100644 --- a/lib/ticgit/base.rb +++ b/lib/ticgit/base.rb @@ -195,7 +195,7 @@ def ticket_recent(ticket_id = nil) def ticket_revparse(ticket_id) if ticket_id ticket_id = ticket_id.strip - + if /^[0-9]*$/ =~ ticket_id if t = @last_tickets[ticket_id.to_i - 1] return t @@ -267,30 +267,12 @@ def tic_states ['open', 'resolved', 'invalid', 'hold'] end - def sync_tickets - #Dir.chdir "../tidyapp_bugs" - bs = git.lib.branches_all.map{|b| b.first } - - #unless bs.include?('ticgit') && File.directory?(@tic_working) - # init_ticgit_branch(bs.include?('ticgit')) - #end - - puts "checking out ticgit" - #in_branch(bs.include?('ticgit')) do - #puts git.branch('ticgit').checkout() - # puts git.pull('origin','origin/ticgit') - #puts git.branch('master').checkout() - #end - - in_branch(bs.include?('ticgit')) do - #puts git.add('.') - #puts git.commit('tickets update') - puts git.pull('origin','origin/ticgit') - puts git.push('origin','ticgit') - puts + def sync_tickets + in_branch(false) do + git.pull('origin','origin/ticgit') + git.push('origin', 'ticgit:ticgit') puts "Tickets synchronized." end - end def load_tickets