Permalink
Browse files

added multiple project support

  • Loading branch information...
schacon committed Mar 22, 2008
1 parent c1c3407 commit 083e620ade8b05402a63d1026692dcf1286eaffd
Showing with 27 additions and 23 deletions.
  1. +9 −7 lib/ticgit/base.rb
  2. +1 −1 lib/ticgit/cli.rb
  3. +3 −3 lib/ticgit/ticket.rb
  4. +14 −12 note/TODO
View
@@ -15,9 +15,11 @@ def initialize(git_dir, opts = {})
@git = Git.open(git_dir)
@logger = opts[:logger] || Logger.new(STDOUT)
+ proj = Ticket.clean_string(@git.dir.path)
+
@tic_dir = opts[:tic_dir] || '~/.ticgit'
- @tic_working = opts[:working_directory] || File.expand_path(File.join(@tic_dir, 'working'))
- @tic_index = opts[:index_file] || File.expand_path(File.join(@tic_dir, 'index'))
+ @tic_working = opts[:working_directory] || File.expand_path(File.join(@tic_dir, proj, 'working'))
+ @tic_index = opts[:index_file] || File.expand_path(File.join(@tic_dir, proj, 'index'))
# load config file
@config_file = File.expand_path(File.join(@tic_dir, 'config.yml'))
@@ -27,7 +29,7 @@ def initialize(git_dir, opts = {})
@config = {}
end
- @state = File.expand_path(File.join(@tic_dir, 'state'))
+ @state = File.expand_path(File.join(@tic_dir, proj, 'state'))
if File.exists?(@state)
load_state
@@ -217,7 +219,7 @@ def load_tickets
@tickets = {}
bs = git.lib.branches_all.map { |b| b[0] }
- init_ticgit_branch if !bs.include?('ticgit')
+ init_ticgit_branch if !(bs.include?('ticgit') && File.directory?(@tic_working))
tree = git.lib.full_tree('ticgit')
tree.each do |t|
@@ -235,15 +237,15 @@ def load_tickets
def init_ticgit_branch
puts 'creating ticgit repo branch'
- in_branch do
+ in_branch(true) do
new_file('.hold', 'hold')
git.add
git.commit('creating the ticgit branch')
end
end
# temporarlily switches to ticgit branch for tic work
- def in_branch
+ def in_branch(no_checkout = false)
needs_checkout = false
if !File.directory?(@tic_working)
FileUtils.mkdir_p(@tic_working)
@@ -255,7 +257,7 @@ def in_branch
git.lib.change_head_branch('ticgit')
git.with_index(@tic_index) do
git.with_working(@tic_working) do |wd|
- git.lib.checkout('ticgit') if needs_checkout
+ git.lib.checkout('ticgit') if needs_checkout && !no_checkout
yield wd
end
end
View
@@ -277,7 +277,7 @@ def handle_ticket_new
tags = tags.split(',').map { |t| t.strip }
end
if message.size > 0
- comment = message.join("\n")
+ comment = message.join("")
end
ticket_show(@tic.ticket_new(title, :comment => comment, :tags => tags))
else
View
@@ -65,8 +65,8 @@ def self.open(base, ticket_name, ticket_hash, options = {})
def self.parse_ticket_name(name)
- epoch, title, rand = name.split('-')
- title = title.gsub('_', ' ')
+ epoch, title, rand = name.split('_')
+ title = title.gsub('-', ' ')
return [title, Time.at(epoch.to_i)]
end
@@ -190,7 +190,7 @@ def assigned_name
end
def self.create_ticket_name(title)
- [Time.now.to_i.to_s, Ticket.clean_string(title), rand(999).to_i.to_s].join('-')
+ [Time.now.to_i.to_s, Ticket.clean_string(title), rand(999).to_i.to_s].join('_')
end
View
@@ -1,25 +1,27 @@
+link to another ticket (child tickets)
-Recent (use git-log)
+Merge
+
+link to a git object
+
+Web UI
+
+TicGit goes up directories until it finds .git dir
+
+Ticket
+- remove ticket ( git.remove(ticket_dir, :recursive => true) )
+
+Color Output + Paging long results
Attachments
- add
- download
Milestones
-Merge
-
Tags
* show all tags
* rename tag
* delete tag
* tag multiple tics
-
-Ticket
- - remove ticket ( git.remove(ticket_dir, :recursive => true) )
-
-Color Output + Paging long results
-
-TicGit goes up directories until it finds .git dir
-
-Web UI
+

0 comments on commit 083e620

Please sign in to comment.