git-topic 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 2
4
- :patch: 2
4
+ :patch: 3
5
5
  :build:
@@ -24,12 +24,13 @@ module GitTopic::Completion
24
24
  end.compact
25
25
  end
26
26
 
27
- def my_reject_review_and_local_wip_branches
27
+ def my_reject_review_and_all_wip_branches
28
28
  branches.map do |b|
29
29
  b =~ %r{^(wip)/#{user}/(.*)} ||
30
30
  b =~ %r{^remotes/origin/(rejected)/#{user}/(.*)} ||
31
31
  b =~ %r{^remotes/origin/(review)/#{user}/(.*)}
32
- suggestion = [$1,$2].compact.join("/")
32
+ b =~ %r{^remotes/origin/(wip)/(\S*?)/(.*)}
33
+ suggestion = [$1,($2 unless $2 == user), $3].compact.join("/")
33
34
  suggestion unless suggestion.strip.empty?
34
35
  end.compact
35
36
  end
@@ -44,7 +45,7 @@ module GitTopic::Completion
44
45
  when "done"
45
46
  # nothing
46
47
  when "work-on"
47
- my_reject_review_and_local_wip_branches
48
+ my_reject_review_and_all_wip_branches
48
49
  when "review"
49
50
  others_review_branches
50
51
  end || []
@@ -10,8 +10,11 @@ module GitTopic::Naming
10
10
  "backup/#{user}/#{strip_namespace topic}"
11
11
  end
12
12
 
13
- def wip_branch( topic )
14
- "wip/#{user}/#{strip_namespace topic}"
13
+ def wip_branch( ref )
14
+ parts = topic_parts( ref )
15
+ wip_user = parts[:user] || user
16
+ topic = parts[:topic]
17
+ "wip/#{wip_user}/#{topic}"
15
18
  end
16
19
 
17
20
  def rejected_branch( topic )
@@ -62,9 +65,10 @@ module GitTopic::Naming
62
65
  parts = ref.split( '/' )
63
66
  case parts.size
64
67
  when 3
65
- _, p[:user], p[:topic] = parts
68
+ p[:namespace], p[:user], p[:topic] = parts
66
69
  when 2
67
- p[:user], p[:topic] = parts
70
+ first_part = (parts.first =~ /(wip|review|rejected)/) ? :namespace : :user
71
+ p[ first_part ], p[:topic] = parts
68
72
  when 1
69
73
  p[:topic] = parts.first
70
74
  else
@@ -31,7 +31,9 @@ describe GitTopic do
31
31
 
32
32
  @output.clear
33
33
  GitTopic.status
34
- @output.should_not =~ %r{ninja-basic}
34
+ @output.should =~ %r{^\s*(#.*)}m
35
+ status_output = $1
36
+ status_output.should_not =~ %r{ninja-basic}
35
37
  end
36
38
 
37
39
  it "
@@ -7,9 +7,7 @@ describe GitTopic do
7
7
 
8
8
  share_examples_for "#work_on general cases" do
9
9
 
10
- it "
11
- should trim namespaces from args and output a warning
12
- ".oneline do
10
+ it "should trim namespaces for a user's wip branch".oneline do
13
11
 
14
12
  git_branch.should_not == "wip/#{@user}/topic"
15
13
  GitTopic.work_on "wip/#{@user}/topic"
@@ -62,6 +60,14 @@ describe GitTopic do
62
60
 
63
61
  it_should_behave_like "#work_on general cases"
64
62
 
63
+
64
+ it "should trim namespaces for a different user's wip branch" do
65
+
66
+ git_branch.should_not == "wip/user24601/pirates-with-hooks"
67
+ GitTopic.work_on "wip/user24601/pirates-with-hooks"
68
+ git_branch.should == "wip/user24601/pirates-with-hooks"
69
+ end
70
+
65
71
  it "should switch to (rather than create) an existing topic branch" do
66
72
  git_branches.should include( "wip/#{@user}/zombie-basic" )
67
73
  lambda{ GitTopic.work_on 'zombie-basic' }.should_not raise_error
@@ -113,8 +113,12 @@ Rspec.configure do |c|
113
113
  $stdout.stub!( :write ) { |*args| @output.<<( *args )}
114
114
  $stderr.stub!( :write ) { |*args| @err.<<( *args )}
115
115
  end
116
-
117
116
  c.after( :each ) { Dir.chdir @starting_dir }
117
+
118
+
119
+ c.before( :each ) do
120
+ GitTopic::global_opts[:verbose] = true
121
+ end
118
122
  end
119
123
 
120
124
 
@@ -0,0 +1 @@
1
+ 331d827fd47fb234af54e3a4bbf8c6705e9116cc
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 2
9
- version: 0.2.2
8
+ - 3
9
+ version: 0.2.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - David J. Hamilton
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-07-23 00:00:00 -07:00
17
+ date: 2010-07-26 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -261,6 +261,7 @@ files:
261
261
  - spec/template/origin/refs/heads/wip/USER/pirates-advanced
262
262
  - spec/template/origin/refs/heads/wip/USER/zombie-basic
263
263
  - spec/template/origin/refs/heads/wip/prevent-ff
264
+ - spec/template/origin/refs/heads/wip/user24601/pirates-with-hooks
264
265
  - bin/git-topic
265
266
  - bin/git-topic-completion
266
267
  has_rdoc: true