piston 2.0.7 → 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
1
  ---
2
- :minor: 0
3
- :patch: 7
2
+ :patch: 8
4
3
  :major: 2
4
+ :minor: 0
5
+ :build:
@@ -46,7 +46,22 @@ Feature: Import remote repository into a Git repository
46
46
  And I should find a libcalc/libcalc.rb file
47
47
  And I should find a libcalc/.piston.yml file
48
48
 
49
- Scenario: Importing into a specific folder when the parent folders doesn't exist succeeds
49
+ Given I committed
50
+ When I check the status
51
+ Then I should see an empty status report for "libcalc"
52
+
53
+ When I check the status with "--show-updates"
54
+ Then I should see an empty status report for "libcalc"
55
+
56
+ Given a file named libfix.rb with content "a\nb\nc" in remote libcalc project
57
+ When I check the status
58
+ Then I should see an empty status report for "libcalc"
59
+
60
+ When I check the status with "--show-updates"
61
+ Then I should see a change for "libcalc"
62
+ And I should see a remote change for "libcalc"
63
+
64
+ Scenario: Importing into a specific folder when the parent folder doesn't exist succeeds
50
65
  Given a newly created Git project
51
66
  And a remote Subversion project named libcalc using the classic layout
52
67
  And a file named libcalc.rb with content "a\nb\nc" in remote libcalc project
@@ -1,3 +1,9 @@
1
+ # Git's UI changes between revisions... Have to support more formats, or
2
+ # maybe find a better way to determine what's going on
3
+ #
4
+ # TODO: Maybe use Grit to determine repository validity?
5
+ GIT_COMMIT_RE = /Created (?:initial )?commit [a-fA-F0-9]+|\[[-\w]+ (?:\(root-commit\) )?[a-fA-F0-9]{7,40}\]/
6
+
1
7
  Given /^a newly created Git project$/ do
2
8
  @wcdir = Tmpdir.where(:wc)
3
9
  @wcdir.mkpath
@@ -6,7 +12,7 @@ Given /^a newly created Git project$/ do
6
12
  touch :README
7
13
  git :add, "."
8
14
  @stdout = git :commit, "--message", "first commit"
9
- @stdout.should =~ /Created (?:initial )?commit [a-fA-F0-9]+/
15
+ @stdout.should =~ GIT_COMMIT_RE
10
16
  end
11
17
  end
12
18
 
@@ -26,7 +32,7 @@ Given /^a remote Git project named (\w+)$/ do |name|
26
32
  touch :README
27
33
  git :add, "."
28
34
  @stdout = git :commit, "--message", "initial commit"
29
- @stdout.should =~ /Created (?:initial )?commit [a-fA-F0-9]+/
35
+ @stdout.should =~ GIT_COMMIT_RE
30
36
  end
31
37
  end
32
38
 
@@ -50,7 +56,7 @@ Given /^a file named ([^\s]+) was deleted in remote (\w+) project$/ do |filename
50
56
  if (@remotewcdir + ".git").directory? then
51
57
  git :rm, filename
52
58
  @stdout = git :commit, "--message", "removing #{filename}"
53
- @stdout.should =~ /Created (?:initial )?commit [a-fA-F0-9]+/
59
+ @stdout.should =~ GIT_COMMIT_RE
54
60
  else
55
61
  svn :rm, filename
56
62
  @stdout = svn :commit, "--message", "removing #{filename}"
@@ -66,7 +72,7 @@ Given /^a file named ([^\s]+) with content "([^"]+)" in remote (\w+) project$/ d
66
72
  if (@remotewcdir + ".git").directory? then
67
73
  git :add, "."
68
74
  @stdout = git :commit, "--message", "adding #{filename}"
69
- @stdout.should =~ /Created (?:initial )?commit [a-fA-F0-9]/
75
+ @stdout.should =~ GIT_COMMIT_RE
70
76
  else
71
77
  svn :add, filename
72
78
  @stdout = svn :commit, "--message", "adding #{filename}"
@@ -80,7 +86,7 @@ Given /^a file named ([^\s]+) was renamed to ([^\s]+) in remote (\w+) project$/
80
86
  if (@remotewcdir + ".git").directory? then
81
87
  git :mv, from, to
82
88
  @stdout = git :commit, "--message", "moved #{from} to #{to}"
83
- @stdout.should =~ /Created (?:initial )?commit [a-fA-F0-9]/
89
+ @stdout.should =~ GIT_COMMIT_RE
84
90
  else
85
91
  svn :mv, from, to
86
92
  @stdout = svn :commit, "--message", "moved #{from} to #{to}"
@@ -96,7 +102,7 @@ Given /^a file named ([^\s]+) was updated with "([^"]+)" in remote (\w+) project
96
102
  if (@remotewcdir + ".git").directory? then
97
103
  git :add, "."
98
104
  @stdout = git :commit, "--message", "updating #{filename}"
99
- @stdout.should =~ /Created (?:initial )?commit [a-fA-F0-9]/
105
+ @stdout.should =~ GIT_COMMIT_RE
100
106
  else
101
107
  @stdout = svn :commit, "--message", "updating #{filename}"
102
108
  @stdout.should =~ /Committed revision \d+/
@@ -111,7 +117,7 @@ Given /^I changed ([\w\/.]+) to "([^"]+)"$/ do |filename, content|
111
117
  if (@wcdir + ".git").directory? then
112
118
  git :add, "."
113
119
  @stdout = git :commit, "--message", "adding #{filename}"
114
- @stdout.should =~ /Created (?:initial )?commit [a-fA-F0-9]/
120
+ @stdout.should =~ GIT_COMMIT_RE
115
121
  else
116
122
  @stdout = svn :commit, "--message", "adding #{filename}"
117
123
  @stdout.should =~ /Committed revision \d+/
@@ -126,7 +132,7 @@ Given /^an existing ([\w\/]+) folder$/ do |name|
126
132
  Dir.chdir(@wcdir) do
127
133
  git :add, "."
128
134
  @stdout = git :commit, "--message", "registered #{name}/"
129
- @stdout.should =~ /Created (?:initial )?commit [a-fA-F0-9]+/
135
+ @stdout.should =~ GIT_COMMIT_RE
130
136
  end
131
137
  else
132
138
  svn :mkdir, @wcdir + name
@@ -158,7 +164,7 @@ When /^I committed$/ do
158
164
  if (@wcdir + ".git").directory?
159
165
  Dir.chdir(@wcdir) do
160
166
  @stdout = git :commit, "--message", "commit", "--all"
161
- @stdout.should =~ /Created (?:initial )?commit [a-fA-F0-9]+/
167
+ @stdout.should =~ GIT_COMMIT_RE
162
168
  end
163
169
  else
164
170
  @stdout = svn(:commit, "--message", "commit", @wcdir)
@@ -233,3 +239,28 @@ When /^I import the "([^\"]+)" branch of ([^ ]+)(?: into ([\w\/]+))?$/ do |branc
233
239
  STDERR.puts @stdout if $DEBUG
234
240
  end
235
241
  end
242
+
243
+ When /^I check the status(?: with "([^"]+)")?$/ do |args|
244
+ Dir.chdir(@wcdir) do
245
+ cmd = "#{Tmpdir.piston} status --verbose 5"
246
+ cmd << " #{args}" if args
247
+ STDERR.puts cmd.inspect if $DEBUG
248
+ @stdout = `#{cmd}`
249
+ STDERR.puts @stdout if $DEBUG
250
+ end
251
+ end
252
+
253
+ Then /^I should see an empty status report for "([^"]+)"$/ do |project|
254
+ @stdout.should =~ /^\s+(?:\/private)?#{Regexp.escape(@wcdir + project)} \(file:\/\/#{Regexp.escape(@remotereposdir)}\)/
255
+ end
256
+
257
+ Then /^I should see a (?:(local|remote) )?change for "([^\"]*)"$/ do |local_remote, project|
258
+ case local_remote
259
+ when nil, ""
260
+ @stdout.should =~ /^[ M]{2}\s+(?:\/private)?#{Regexp.escape(@wcdir + project)} \(file:\/\/#{Regexp.escape(@remotereposdir)}\)/
261
+ when "local"
262
+ @stdout.should =~ /^M \s+(?:\/private)?#{Regexp.escape(@wcdir + project)} \(file:\/\/#{Regexp.escape(@remotereposdir)}\)/
263
+ when "remote"
264
+ @stdout.should =~ /^ M\s+(?:\/private)?#{Regexp.escape(@wcdir + project)} \(file:\/\/#{Regexp.escape(@remotereposdir)}\)/
265
+ end
266
+ end
@@ -1,4 +1,3 @@
1
- require 'cucumber/formatters/unicode' # Comment out this line if you don't want Cucumber Unicode support
2
1
  require "pathname"
3
2
  require "fileutils"
4
3
  require File.dirname(__FILE__) + "/svn"
@@ -1,5 +1,5 @@
1
1
  require "log4r"
2
- require "activesupport"
2
+ require "active_support"
3
3
  require "piston/version"
4
4
  require "optparse"
5
5
 
@@ -6,30 +6,19 @@ module Piston
6
6
  def run(wcdir)
7
7
  # Get the working copy handler to search pistonized folders inside it
8
8
  handler = guess_wc(wcdir).class
9
-
10
- # First, find the list of pistonized folders
11
- repos = Hash.new
12
- Pathname.glob(wcdir + '**/.piston.yml') do |path|
13
- repos[path.dirname] = Hash.new
14
- end
9
+ props = Hash.new
15
10
 
16
- # Then, get their properties
17
- repos.each_pair do |path, props|
18
- logger.debug {"Get info of #{path}"}
19
- working_copy = handler.new(path)
20
- working_copy.validate!
21
- props.update(working_copy.info)
22
- props[:locally_modified] = 'M' if working_copy.locally_modified
23
- props[:remotely_modified] = 'M' if show_updates and working_copy.remotely_modified
24
- end
11
+ # Then, get that repository's properties
12
+ logger.debug {"Get info of #{wcdir}"}
13
+ working_copy = handler.new(wcdir)
14
+ working_copy.validate!
15
+ props.update(working_copy.info)
16
+ props[:locally_modified] = 'M' if working_copy.locally_modified
17
+ props[:remotely_modified] = 'M' if show_updates && working_copy.remotely_modified
25
18
 
26
19
  # Display the results
27
- repos.each_pair do |path, props|
28
- printf "%1s%1s %6s %s (%s)\n", props[:locally_modified],
29
- props[:remotely_modified], props["lock"] ? 'locked' : '', path, props["repository_url"]
30
- end
31
-
32
- puts "No pistonized folders found in #{wcdir}" if repos.empty?
20
+ printf "%1s%1s %6s %s (%s)\n", props[:locally_modified],
21
+ props[:remotely_modified], props["lock"] ? 'locked' : '', wcdir.to_s, props["repository_url"]
33
22
  end
34
23
 
35
24
  def show_updates
@@ -37,7 +26,9 @@ module Piston
37
26
  end
38
27
 
39
28
  def start(*args)
40
- args.flatten.map {|d| Pathname.new(d).expand_path}.each do |wcdir|
29
+ paths = args.flatten.map {|d| Pathname.new(d).expand_path}
30
+ paths = find_local_piston_folders if paths.empty?
31
+ paths.each do |wcdir|
41
32
  begin
42
33
  run(wcdir)
43
34
  rescue Piston::WorkingCopy::NotWorkingCopy
@@ -45,6 +36,12 @@ module Piston
45
36
  end
46
37
  end
47
38
  end
39
+
40
+ private
41
+
42
+ def find_local_piston_folders
43
+ Pathname.glob(Pathname.new(Dir.pwd) + '**/.piston.yml').map {|path| path + ".."}.map(&:expand_path)
44
+ end
48
45
  end
49
46
  end
50
47
  end
@@ -80,7 +80,11 @@ module Piston
80
80
 
81
81
  def rename(renamed)
82
82
  Dir.chdir(path) do
83
- renamed.each { |from, to| git(:mv, from, to) }
83
+ renamed.each do |from, to|
84
+ target = path + File.dirname(to)
85
+ target.mkpath unless target.exist?
86
+ git(:mv, from, to)
87
+ end
84
88
  end
85
89
  end
86
90
 
@@ -1,21 +1,22 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{piston}
8
- s.version = "2.0.7"
8
+ s.version = "2.0.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Francois Beausoleil"]
12
- s.date = %q{2009-10-22}
12
+ s.date = %q{2010-01-12}
13
13
  s.default_executable = %q{piston}
14
14
  s.description = %q{Piston makes it easy to merge vendor branches into your own repository, without worrying about which revisions were grabbed or not. Piston will also keep your local changes in addition to the remote changes.}
15
15
  s.email = %q{francois@teksol.info}
16
16
  s.executables = ["piston"]
17
17
  s.extra_rdoc_files = [
18
- "README.txt"
18
+ "README.txt",
19
+ "TODO"
19
20
  ]
20
21
  s.files = [
21
22
  ".gitignore",
@@ -183,3 +184,4 @@ Gem::Specification.new do |s|
183
184
  s.add_dependency(%q<activesupport>, [">= 2.0.0"])
184
185
  end
185
186
  end
187
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: piston
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.7
4
+ version: 2.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francois Beausoleil
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-22 00:00:00 -04:00
12
+ date: 2010-01-12 00:00:00 -05:00
13
13
  default_executable: piston
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -60,6 +60,7 @@ extensions: []
60
60
 
61
61
  extra_rdoc_files:
62
62
  - README.txt
63
+ - TODO
63
64
  files:
64
65
  - .gitignore
65
66
  - History.txt