TicGit-ng 1.0.1.3 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ticgit-ng/base.rb +11 -11
- data/lib/ticgit-ng/cli.rb +3 -2
- data/lib/ticgit-ng/command/comment.rb +1 -1
- data/lib/ticgit-ng/command/new.rb +5 -8
- data/lib/ticgit-ng/ticket.rb +8 -2
- data/lib/ticgit-ng/version.rb +1 -1
- data/lib/ticgit-ng.rb +20 -1
- metadata +4 -5
data/lib/ticgit-ng/base.rb
CHANGED
@@ -205,10 +205,10 @@ module TicGitNG
|
|
205
205
|
def ticket_revparse(ticket_id)
|
206
206
|
if ticket_id
|
207
207
|
ticket_id = ticket_id.strip
|
208
|
-
|
208
|
+
|
209
209
|
if /^[0-9]*$/ =~ ticket_id
|
210
210
|
if t = @last_tickets[ticket_id.to_i - 1]
|
211
|
-
|
211
|
+
return t
|
212
212
|
end
|
213
213
|
else # partial or full sha
|
214
214
|
regex = /^#{Regexp.escape(ticket_id)}/
|
@@ -281,15 +281,15 @@ module TicGitNG
|
|
281
281
|
puts "Fetching #{repo}" if verbose
|
282
282
|
@git.fetch(repo)
|
283
283
|
puts "Syncing tickets with #{repo}" if verbose
|
284
|
-
remote_branches=@git.branches.remote.map{|b|
|
285
|
-
b.full.gsub('remotes/', '')[Regexp.new("^#{Regexp.escape(repo)}/.*")]
|
284
|
+
remote_branches=@git.branches.remote.map{|b|
|
285
|
+
b.full.gsub('remotes/', '')[Regexp.new("^#{Regexp.escape(repo)}/.*")]
|
286
286
|
}.compact
|
287
287
|
remote_branches.include?("#{repo}/ticgit-ng") ? r_ticgit='ticgit-ng' : r_ticgit='ticgit'
|
288
|
-
in_branch(false) do
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
288
|
+
in_branch(false) do
|
289
|
+
repo_g=git.remote(repo)
|
290
|
+
git.pull(repo_g, repo+'/'+r_ticgit)
|
291
|
+
git.push(repo_g, "#{which_branch?}:"+r_ticgit ) if push
|
292
|
+
puts "Tickets synchronized." if verbose
|
293
293
|
end
|
294
294
|
end
|
295
295
|
|
@@ -302,7 +302,7 @@ module TicGitNG
|
|
302
302
|
|
303
303
|
bs = git.lib.branches_all.map{|b| b.first }
|
304
304
|
|
305
|
-
unless (bs.include?(which_branch?) || bs.include?(which_branch?)) &&
|
305
|
+
unless (bs.include?(which_branch?) || bs.include?(which_branch?)) &&
|
306
306
|
File.directory?(@tic_working)
|
307
307
|
init_ticgitng_branch(bs.include?(which_branch?))
|
308
308
|
end
|
@@ -356,7 +356,7 @@ module TicGitNG
|
|
356
356
|
git.lib.change_head_branch(which_branch?)
|
357
357
|
git.with_index(@tic_index) do
|
358
358
|
git.with_working(@tic_working) do |wd|
|
359
|
-
git.lib.checkout(which_branch?) if needs_checkout &&
|
359
|
+
git.lib.checkout(which_branch?) if needs_checkout &&
|
360
360
|
branch_exists
|
361
361
|
yield wd
|
362
362
|
end
|
data/lib/ticgit-ng/cli.rb
CHANGED
@@ -78,8 +78,9 @@ module TicGitNG
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
def get_editor_message(
|
82
|
-
message_file = Tempfile.new('ticgitng_message').path
|
81
|
+
def get_editor_message(comments = nil)
|
82
|
+
message_file = Tempfile.new('ticgitng_message').path
|
83
|
+
File.open(message_file, 'w') { |f| f.puts comments } if comments
|
83
84
|
|
84
85
|
editor = ENV["EDITOR"] || 'vim'
|
85
86
|
system("#{editor} #{message_file}");
|
@@ -13,14 +13,11 @@ module TicGitNG
|
|
13
13
|
ticket_show(tic.ticket_new(title, options.to_hash))
|
14
14
|
else
|
15
15
|
# interactive
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
f.puts "# if you would like to add initial tags, put them on the 'tags:' line, comma delim"
|
22
|
-
end
|
23
|
-
if message = get_editor_message(message_file)
|
16
|
+
comment = "\n# ---\ntags:\n"
|
17
|
+
comment += "# first line will be the title of the tic, the rest will be the first comment\n"
|
18
|
+
comment += "# if you would like to add initial tags, put them on the 'tags:' line, comma delim"
|
19
|
+
|
20
|
+
if message = get_editor_message(comment)
|
24
21
|
title = message.shift
|
25
22
|
if title && title.chomp.length > 0
|
26
23
|
title = title.chomp
|
data/lib/ticgit-ng/ticket.rb
CHANGED
@@ -7,8 +7,14 @@ module TicGitNG
|
|
7
7
|
attr_accessor :comments, :tags, :attachments # arrays
|
8
8
|
|
9
9
|
def initialize(base, options = {})
|
10
|
-
|
11
|
-
|
10
|
+
# FIXME: what/where/who/how changed config to hash?
|
11
|
+
if (cfg = base.git.config).is_a? Hash
|
12
|
+
options[:user_name] ||= cfg["user.name"]
|
13
|
+
options[:user_email] ||= cfg["user.email"]
|
14
|
+
else
|
15
|
+
options[:user_name] ||= cfg("user.name")
|
16
|
+
options[:user_email] ||= cfg("user.email")
|
17
|
+
end
|
12
18
|
|
13
19
|
@base = base
|
14
20
|
@opts = options || {}
|
data/lib/ticgit-ng/version.rb
CHANGED
data/lib/ticgit-ng.rb
CHANGED
@@ -13,9 +13,28 @@ $:.unshift(File.dirname(__FILE__)) unless
|
|
13
13
|
require 'rubygems'
|
14
14
|
# requires git >= 1.0.5
|
15
15
|
require 'git'
|
16
|
+
|
17
|
+
#Only redefine if we are not using 1.9
|
18
|
+
unless Config::CONFIG["ruby_version"][/^\d\.9/]
|
19
|
+
# FIXME: Monkeypatch git until fixed upstream
|
20
|
+
module Git
|
21
|
+
class Lib
|
22
|
+
def config_get(name)
|
23
|
+
do_get = lambda do |name|
|
24
|
+
command('config', ['--get', name])
|
25
|
+
end
|
26
|
+
if @git_dir
|
27
|
+
Dir.chdir(@git_dir, &do_get)
|
28
|
+
else
|
29
|
+
build_list.call
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
16
36
|
require 'ticgit-ng/base'
|
17
37
|
require 'ticgit-ng/cli'
|
18
|
-
|
19
38
|
module TicGitNG
|
20
39
|
autoload :VERSION, 'ticgit-ng/version'
|
21
40
|
autoload :Comment, 'ticgit-ng/comment'
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: TicGit-ng
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
|
11
|
-
version: 1.0.1.3
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- Scott Chacon
|
@@ -17,7 +16,7 @@ autorequire:
|
|
17
16
|
bindir: bin
|
18
17
|
cert_chain: []
|
19
18
|
|
20
|
-
date: 2011-
|
19
|
+
date: 2011-04-02 00:00:00 -04:00
|
21
20
|
default_executable:
|
22
21
|
dependencies:
|
23
22
|
- !ruby/object:Gem::Dependency
|