piston 1.4.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +24 -0
- data/License.txt +20 -0
- data/Manifest.txt +109 -0
- data/{README → README.txt} +14 -10
- data/VERSION.yml +4 -0
- data/bin/piston +3 -8
- data/lib/piston/cli.rb +121 -0
- data/lib/piston/commands/base.rb +44 -0
- data/lib/piston/commands/convert.rb +23 -71
- data/lib/piston/commands/diff.rb +14 -46
- data/lib/piston/commands/import.rb +48 -57
- data/lib/piston/commands/info.rb +24 -0
- data/lib/piston/commands/lock_unlock.rb +26 -0
- data/lib/piston/commands/status.rb +29 -54
- data/lib/piston/commands/update.rb +35 -122
- data/lib/piston/commands/upgrade.rb +26 -0
- data/lib/piston/commands.rb +4 -0
- data/lib/piston/git/client.rb +76 -0
- data/lib/piston/git/commit.rb +114 -0
- data/lib/piston/git/repository.rb +63 -0
- data/lib/piston/git/working_copy.rb +145 -0
- data/lib/piston/git.rb +13 -0
- data/lib/piston/repository.rb +61 -0
- data/lib/piston/revision.rb +83 -0
- data/lib/piston/svn/client.rb +88 -0
- data/lib/piston/svn/repository.rb +67 -0
- data/lib/piston/svn/revision.rb +112 -0
- data/lib/piston/svn/working_copy.rb +184 -0
- data/lib/piston/svn.rb +15 -0
- data/lib/piston/version.rb +9 -7
- data/lib/piston/working_copy.rb +334 -0
- data/lib/piston.rb +13 -64
- data/lib/subclass_responsibility_error.rb +2 -0
- data/test/integration_helpers.rb +36 -0
- data/test/spec_suite.rb +4 -0
- data/test/test_helper.rb +92 -0
- data/test/unit/git/commit/test_checkout.rb +31 -0
- data/test/unit/git/commit/test_each.rb +30 -0
- data/test/unit/git/commit/test_rememberance.rb +22 -0
- data/test/unit/git/commit/test_validation.rb +34 -0
- data/test/unit/git/repository/test_at.rb +23 -0
- data/test/unit/git/repository/test_basename.rb +12 -0
- data/test/unit/git/repository/test_branchanme.rb +15 -0
- data/test/unit/git/repository/test_guessing.rb +32 -0
- data/test/unit/git/working_copy/test_copying.rb +25 -0
- data/test/unit/git/working_copy/test_creation.rb +22 -0
- data/test/unit/git/working_copy/test_existence.rb +18 -0
- data/test/unit/git/working_copy/test_finalization.rb +15 -0
- data/test/unit/git/working_copy/test_guessing.rb +35 -0
- data/test/unit/git/working_copy/test_rememberance.rb +22 -0
- data/test/unit/svn/repository/test_at.rb +19 -0
- data/test/unit/svn/repository/test_basename.rb +24 -0
- data/test/unit/svn/repository/test_guessing.rb +45 -0
- data/test/unit/svn/revision/test_checkout.rb +28 -0
- data/test/unit/svn/revision/test_each.rb +22 -0
- data/test/unit/svn/revision/test_rememberance.rb +38 -0
- data/test/unit/svn/revision/test_validation.rb +50 -0
- data/test/unit/svn/working_copy/test_copying.rb +26 -0
- data/test/unit/svn/working_copy/test_creation.rb +16 -0
- data/test/unit/svn/working_copy/test_existence.rb +23 -0
- data/test/unit/svn/working_copy/test_externals.rb +56 -0
- data/test/unit/svn/working_copy/test_finalization.rb +17 -0
- data/test/unit/svn/working_copy/test_guessing.rb +18 -0
- data/test/unit/svn/working_copy/test_rememberance.rb +26 -0
- data/test/unit/test_info.rb +37 -0
- data/test/unit/test_lock_unlock.rb +47 -0
- data/test/unit/test_repository.rb +51 -0
- data/test/unit/test_revision.rb +31 -0
- data/test/unit/working_copy/test_guessing.rb +35 -0
- data/test/unit/working_copy/test_info.rb +14 -0
- data/test/unit/working_copy/test_rememberance.rb +42 -0
- data/test/unit/working_copy/test_validate.rb +63 -0
- metadata +132 -31
- data/CHANGELOG +0 -81
- data/LICENSE +0 -19
- data/Rakefile +0 -63
- data/contrib/piston +0 -43
- data/lib/core_ext/range.rb +0 -5
- data/lib/core_ext/string.rb +0 -9
- data/lib/piston/command.rb +0 -68
- data/lib/piston/command_error.rb +0 -6
- data/lib/piston/commands/lock.rb +0 -30
- data/lib/piston/commands/switch.rb +0 -139
- data/lib/piston/commands/unlock.rb +0 -29
- data/lib/transat/parser.rb +0 -189
metadata
CHANGED
@@ -1,57 +1,158 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: piston
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
platform:
|
4
|
+
version: 2.0.1
|
5
|
+
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francois Beausoleil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-04-01 00:00:00 -04:00
|
13
13
|
default_executable: piston
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: cucumber
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.1.16
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: main
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.8.3
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: log4r
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.0.5
|
44
|
+
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: activesupport
|
47
|
+
type: :runtime
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 2.0.0
|
54
|
+
version:
|
55
|
+
description: 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.
|
17
56
|
email: francois@teksol.info
|
18
57
|
executables:
|
19
58
|
- piston
|
20
59
|
extensions: []
|
21
60
|
|
22
|
-
extra_rdoc_files:
|
23
|
-
|
61
|
+
extra_rdoc_files:
|
62
|
+
- README.txt
|
24
63
|
files:
|
25
|
-
-
|
26
|
-
-
|
27
|
-
-
|
28
|
-
-
|
29
|
-
-
|
64
|
+
- History.txt
|
65
|
+
- License.txt
|
66
|
+
- Manifest.txt
|
67
|
+
- README.txt
|
68
|
+
- VERSION.yml
|
30
69
|
- bin/piston
|
31
|
-
- lib/core_ext
|
32
|
-
- lib/core_ext/string.rb
|
33
|
-
- lib/core_ext/range.rb
|
34
|
-
- lib/transat
|
35
|
-
- lib/transat/parser.rb
|
36
70
|
- lib/piston
|
71
|
+
- lib/piston/cli.rb
|
37
72
|
- lib/piston/commands
|
38
|
-
- lib/piston/commands/
|
39
|
-
- lib/piston/commands/lock.rb
|
73
|
+
- lib/piston/commands/base.rb
|
40
74
|
- lib/piston/commands/convert.rb
|
75
|
+
- lib/piston/commands/diff.rb
|
41
76
|
- lib/piston/commands/import.rb
|
42
|
-
- lib/piston/commands/
|
43
|
-
- lib/piston/commands/
|
77
|
+
- lib/piston/commands/info.rb
|
78
|
+
- lib/piston/commands/lock_unlock.rb
|
44
79
|
- lib/piston/commands/status.rb
|
45
|
-
- lib/piston/commands/
|
46
|
-
- lib/piston/
|
47
|
-
- lib/piston/
|
80
|
+
- lib/piston/commands/update.rb
|
81
|
+
- lib/piston/commands/upgrade.rb
|
82
|
+
- lib/piston/commands.rb
|
83
|
+
- lib/piston/git
|
84
|
+
- lib/piston/git/client.rb
|
85
|
+
- lib/piston/git/commit.rb
|
86
|
+
- lib/piston/git/repository.rb
|
87
|
+
- lib/piston/git/working_copy.rb
|
88
|
+
- lib/piston/git.rb
|
89
|
+
- lib/piston/repository.rb
|
90
|
+
- lib/piston/revision.rb
|
91
|
+
- lib/piston/svn
|
92
|
+
- lib/piston/svn/client.rb
|
93
|
+
- lib/piston/svn/repository.rb
|
94
|
+
- lib/piston/svn/revision.rb
|
95
|
+
- lib/piston/svn/working_copy.rb
|
96
|
+
- lib/piston/svn.rb
|
48
97
|
- lib/piston/version.rb
|
98
|
+
- lib/piston/working_copy.rb
|
49
99
|
- lib/piston.rb
|
50
|
-
|
51
|
-
|
100
|
+
- lib/subclass_responsibility_error.rb
|
101
|
+
- test/integration_helpers.rb
|
102
|
+
- test/spec_suite.rb
|
103
|
+
- test/test_helper.rb
|
104
|
+
- test/unit
|
105
|
+
- test/unit/git
|
106
|
+
- test/unit/git/commit
|
107
|
+
- test/unit/git/commit/test_checkout.rb
|
108
|
+
- test/unit/git/commit/test_each.rb
|
109
|
+
- test/unit/git/commit/test_rememberance.rb
|
110
|
+
- test/unit/git/commit/test_validation.rb
|
111
|
+
- test/unit/git/repository
|
112
|
+
- test/unit/git/repository/test_at.rb
|
113
|
+
- test/unit/git/repository/test_basename.rb
|
114
|
+
- test/unit/git/repository/test_branchanme.rb
|
115
|
+
- test/unit/git/repository/test_guessing.rb
|
116
|
+
- test/unit/git/working_copy
|
117
|
+
- test/unit/git/working_copy/test_copying.rb
|
118
|
+
- test/unit/git/working_copy/test_creation.rb
|
119
|
+
- test/unit/git/working_copy/test_existence.rb
|
120
|
+
- test/unit/git/working_copy/test_finalization.rb
|
121
|
+
- test/unit/git/working_copy/test_guessing.rb
|
122
|
+
- test/unit/git/working_copy/test_rememberance.rb
|
123
|
+
- test/unit/svn
|
124
|
+
- test/unit/svn/repository
|
125
|
+
- test/unit/svn/repository/test_at.rb
|
126
|
+
- test/unit/svn/repository/test_basename.rb
|
127
|
+
- test/unit/svn/repository/test_guessing.rb
|
128
|
+
- test/unit/svn/revision
|
129
|
+
- test/unit/svn/revision/test_checkout.rb
|
130
|
+
- test/unit/svn/revision/test_each.rb
|
131
|
+
- test/unit/svn/revision/test_rememberance.rb
|
132
|
+
- test/unit/svn/revision/test_validation.rb
|
133
|
+
- test/unit/svn/working_copy
|
134
|
+
- test/unit/svn/working_copy/test_copying.rb
|
135
|
+
- test/unit/svn/working_copy/test_creation.rb
|
136
|
+
- test/unit/svn/working_copy/test_existence.rb
|
137
|
+
- test/unit/svn/working_copy/test_externals.rb
|
138
|
+
- test/unit/svn/working_copy/test_finalization.rb
|
139
|
+
- test/unit/svn/working_copy/test_guessing.rb
|
140
|
+
- test/unit/svn/working_copy/test_rememberance.rb
|
141
|
+
- test/unit/test_info.rb
|
142
|
+
- test/unit/test_lock_unlock.rb
|
143
|
+
- test/unit/test_repository.rb
|
144
|
+
- test/unit/test_revision.rb
|
145
|
+
- test/unit/working_copy
|
146
|
+
- test/unit/working_copy/test_guessing.rb
|
147
|
+
- test/unit/working_copy/test_info.rb
|
148
|
+
- test/unit/working_copy/test_rememberance.rb
|
149
|
+
- test/unit/working_copy/test_validate.rb
|
150
|
+
has_rdoc: true
|
151
|
+
homepage: http://francois.github.com/piston
|
52
152
|
post_install_message:
|
53
|
-
rdoc_options:
|
54
|
-
|
153
|
+
rdoc_options:
|
154
|
+
- --inline-source
|
155
|
+
- --charset=UTF-8
|
55
156
|
require_paths:
|
56
157
|
- lib
|
57
158
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -69,9 +170,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
170
|
requirements: []
|
70
171
|
|
71
172
|
rubyforge_project: piston
|
72
|
-
rubygems_version:
|
173
|
+
rubygems_version: 1.3.1
|
73
174
|
signing_key:
|
74
175
|
specification_version: 2
|
75
|
-
summary:
|
176
|
+
summary: Ease your vendor branch management worries
|
76
177
|
test_files: []
|
77
178
|
|
data/CHANGELOG
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
*SVN*
|
2
|
-
|
3
|
-
2008-02-07 1.4.0
|
4
|
-
* New piston diff subcommand, implemented by Graeme Mathieson.
|
5
|
-
http://rubyforge.org/tracker/index.php?func=detail&aid=17116&group_id=2105&atid=8179
|
6
|
-
* Per http://rubyforge.org/tracker/?func=detail&atid=8179&aid=10717&group_id=2105
|
7
|
-
Don't set LC_ALL, but set LANGUAGE so that repositories with foreign
|
8
|
-
characters can be used. Thanks go to Per Wigren.
|
9
|
-
|
10
|
-
2007-03-22 1.3.3
|
11
|
-
* Repaired problems with import subcommand. Wrote specifications to prevent
|
12
|
-
the same failure mode again.
|
13
|
-
|
14
|
-
2007-03-09 1.3.2
|
15
|
-
* piston switch had a bad constant access which caused failures.
|
16
|
-
|
17
|
-
2007-03-09 1.3.1
|
18
|
-
* piston switch would fail if the branch from which we are reading had been
|
19
|
-
deleted.
|
20
|
-
* piston switch had a major bug. It did not update the piston:root property
|
21
|
-
to remember the new repository root. Reported and fixed by Graeme
|
22
|
-
Mathieson.
|
23
|
-
* piston switch errors out early if not provided with the right arguments.
|
24
|
-
Thanks to Graeme Mathieson for the info and patch.
|
25
|
-
* New internal command parser. No visible external changes.
|
26
|
-
|
27
|
-
2007-01-22 1.3.0
|
28
|
-
* Piston status shows the revision number of locked repositories. Thanks to
|
29
|
-
Chris Wanstrath <http://errtheblog.com/>.
|
30
|
-
* New piston switch subcommand to switch repository locations. Thanks to
|
31
|
-
Greg Spurrier for the prompt which resulted in finally implementing this.
|
32
|
-
|
33
|
-
2006-11-20 1.2.1
|
34
|
-
* Import subcommand would fail with a "svn: Explicit target required
|
35
|
-
('vendor/rails' interpreted as prop value)" error. This was a minor
|
36
|
-
error in the import code. Reported by Daniel N.
|
37
|
-
* The import subcommand could import another revision than what was intended,
|
38
|
-
if HEAD was updated while the import is in progress.
|
39
|
-
|
40
|
-
2006-11-17 1.2.0
|
41
|
-
* New status subcommand. Shows M if locally or remotely modified. Applies to
|
42
|
-
one, many, all folders. This subcommand *requires* the use of a Subversion
|
43
|
-
1.2.0 client. Thanks to Chris Wanstrath for the inspiration. His Rake
|
44
|
-
tasks are available at http://errtheblog.com/post/38.
|
45
|
-
* Minor patch by Miguel Ibero Carreras to make Subversion always use the
|
46
|
-
C locale, instead of the current one. This allows Piston to be used
|
47
|
-
with internationalized versions of Subversion. David Bittencourt later
|
48
|
-
reported the same problem. Thanks!
|
49
|
-
* Better handle how update finds it's latest local revision to prevent
|
50
|
-
conflicts. If you had never locally changed your vendor repositories,
|
51
|
-
this fix will change nothing for you. This helps prevent local conflicts
|
52
|
-
if you had ever applied a local patch.
|
53
|
-
*CAVEAT*: See the release announcement at
|
54
|
-
http://blog.teksol.info/articles/2006/11/17/piston-1-2-0-status-better-update
|
55
|
-
for a required local operation.
|
56
|
-
|
57
|
-
2006-08-30 1.1.1
|
58
|
-
* Add contrib/piston [Michael Schuerig]
|
59
|
-
* Non-recursively add the root directory of the managed folder then set Piston
|
60
|
-
properties before adding the contents of the managed folder. This is to
|
61
|
-
help ease work along if an inconsistent EOL is encountered during the
|
62
|
-
import. The user can finish the import by svn add'ing the rest of the
|
63
|
-
folder until all files are added. Piston properties will already have been
|
64
|
-
set.
|
65
|
-
|
66
|
-
2006-08-26 1.1.0
|
67
|
-
* New 'convert' subcommand converts existing svn:externals to Piston managed
|
68
|
-
folders. Thanks to Dan Kubb for the idea.
|
69
|
-
* update now recursively finds the folders to process. It bases it's search
|
70
|
-
on the presence or absence of the piston:root property.
|
71
|
-
* Changed lock and unlock messages to be more detailed.
|
72
|
-
|
73
|
-
2006-08-24 1.0.1
|
74
|
-
* Corrected minor bug where the core extensions were in core_ext/core_ext
|
75
|
-
instead of being in core_ext.
|
76
|
-
* Require the parent working copy path be at HEAD before importing / updating.
|
77
|
-
* Don't do unnecessary merges if the file had not changed prior to the update.
|
78
|
-
* During the update, if adding a folder, do an svn mkdir instead of a cp_r.
|
79
|
-
|
80
|
-
2006-08-24 1.0.0
|
81
|
-
* Initial version
|
data/LICENSE
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
Copyright (c) 2006 Francois Beausoleil <francois@teksol.info>
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
of this software and associated documentation files (the "Software"), to deal
|
5
|
-
in the Software without restriction, including without limitation the rights
|
6
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
copies of the Software, and to permit persons to whom the Software is
|
8
|
-
furnished to do so, subject to the following conditions:
|
9
|
-
|
10
|
-
The above copyright notice and this permission notice shall be included in
|
11
|
-
all copies or substantial portions of the Software.
|
12
|
-
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
THE SOFTWARE.
|
data/Rakefile
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake/gempackagetask'
|
3
|
-
require 'rake/contrib/rubyforgepublisher'
|
4
|
-
require 'spec/rake/spectask'
|
5
|
-
require File.join(File.dirname(__FILE__), 'lib', 'piston', 'version')
|
6
|
-
|
7
|
-
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
|
8
|
-
PKG_NAME = 'piston'
|
9
|
-
PKG_VERSION = Piston::VERSION::STRING + PKG_BUILD
|
10
|
-
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
11
|
-
|
12
|
-
RELEASE_NAME = "REL #{PKG_VERSION}"
|
13
|
-
|
14
|
-
RUBY_FORGE_PROJECT = "piston"
|
15
|
-
RUBY_FORGE_USER = "fbos"
|
16
|
-
|
17
|
-
task :default => :specs
|
18
|
-
|
19
|
-
# Create compressed packages
|
20
|
-
dist_dirs = [ "lib", "spec"]
|
21
|
-
|
22
|
-
spec = Gem::Specification.new do |s|
|
23
|
-
s.name = PKG_NAME
|
24
|
-
s.version = PKG_VERSION
|
25
|
-
s.summary = "Piston is a utility that enables merge tracking of remote repositories."
|
26
|
-
s.description = %q{This is similar to svn:externals, except you have a local copy of the files, which you can modify at will. As long as the changes are mergeable, you should have no problems.}
|
27
|
-
|
28
|
-
s.bindir = "bin" # Use these for applications.
|
29
|
-
s.executables = ["piston"]
|
30
|
-
s.default_executable = "piston"
|
31
|
-
|
32
|
-
s.files = [ "CHANGELOG", "README", "LICENSE", "Rakefile" ] + FileList["{contrib,bin,spec,lib}/**/*"].to_a
|
33
|
-
|
34
|
-
s.require_path = 'lib'
|
35
|
-
s.has_rdoc = false
|
36
|
-
|
37
|
-
s.author = "Francois Beausoleil"
|
38
|
-
s.email = "francois@teksol.info"
|
39
|
-
s.homepage = "http://piston.rubyforge.org/"
|
40
|
-
s.rubyforge_project = "piston"
|
41
|
-
end
|
42
|
-
|
43
|
-
Rake::GemPackageTask.new(spec) do |p|
|
44
|
-
p.gem_spec = spec
|
45
|
-
p.need_tar = true
|
46
|
-
p.need_zip = true
|
47
|
-
end
|
48
|
-
|
49
|
-
desc "Publish the release files to RubyForge."
|
50
|
-
task :release => [ :package ] do
|
51
|
-
`rubyforge login`
|
52
|
-
|
53
|
-
for ext in %w( gem tgz zip )
|
54
|
-
release_command = "rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}"
|
55
|
-
puts release_command
|
56
|
-
system(release_command)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
desc "Run all examples with RCov"
|
61
|
-
Spec::Rake::SpecTask.new('specs') do |t|
|
62
|
-
t.spec_files = FileList['specs/**/*.rb']
|
63
|
-
end
|
data/contrib/piston
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
have piston &&
|
2
|
-
_piston()
|
3
|
-
{
|
4
|
-
local cur prev commands options command
|
5
|
-
|
6
|
-
COMPREPLY=()
|
7
|
-
cur=${COMP_WORDS[COMP_CWORD]}
|
8
|
-
|
9
|
-
commands='update convert help unlock lock import switch'
|
10
|
-
|
11
|
-
if [[ $COMP_CWORD -eq 1 ]] ; then
|
12
|
-
if [[ "$cur" == -* ]]; then
|
13
|
-
COMPREPLY=( $( compgen -W '--version' -- $cur ) )
|
14
|
-
else
|
15
|
-
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
|
16
|
-
fi
|
17
|
-
else
|
18
|
-
|
19
|
-
prev=${COMP_WORDS[COMP_CWORD-1]}
|
20
|
-
command=${COMP_WORDS[1]}
|
21
|
-
|
22
|
-
if [[ "$cur" == -* ]]; then
|
23
|
-
case $command in
|
24
|
-
@(update|import))
|
25
|
-
options='-r --revision --lock --verbose'
|
26
|
-
;;
|
27
|
-
esac
|
28
|
-
options="$options --verbose"
|
29
|
-
|
30
|
-
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
|
31
|
-
else
|
32
|
-
if [[ "$command" == @(help|h|\?) ]]; then
|
33
|
-
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
|
34
|
-
else
|
35
|
-
_filedir
|
36
|
-
fi
|
37
|
-
fi
|
38
|
-
fi
|
39
|
-
|
40
|
-
return 0
|
41
|
-
}
|
42
|
-
|
43
|
-
[ -n "${have:-}" ] && complete -F _piston $default piston
|
data/lib/core_ext/range.rb
DELETED
data/lib/core_ext/string.rb
DELETED
data/lib/piston/command.rb
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
require "piston"
|
2
|
-
|
3
|
-
module Piston
|
4
|
-
# The base class which all commands subclass to obtain services from.
|
5
|
-
class Command
|
6
|
-
attr_accessor :revision, :dry_run, :quiet, :verbose, :force, :lock,
|
7
|
-
:recursive, :show_updates
|
8
|
-
attr_reader :args
|
9
|
-
attr_writer :logging_stream
|
10
|
-
|
11
|
-
def initialize(non_options, options)
|
12
|
-
@args = non_options
|
13
|
-
|
14
|
-
# Because the Windows shell does not process wildcards, we must do it
|
15
|
-
# here ourselves
|
16
|
-
@args.collect! do |arg|
|
17
|
-
next arg unless arg =~ /[*?]/
|
18
|
-
Dir[arg]
|
19
|
-
end
|
20
|
-
|
21
|
-
options.each do |option, value|
|
22
|
-
self.send("#{option}=", value)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
# Run a Subversion command using the shell. If the Subversion command
|
27
|
-
# returns an existstatus different from zero, a RuntimeError is raised.
|
28
|
-
def svn(*args)
|
29
|
-
args = args.flatten.compact.map do |arg|
|
30
|
-
if arg.to_s =~ /[ *?@]/ then
|
31
|
-
%Q("#{arg}")
|
32
|
-
else
|
33
|
-
arg
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
command = "svn #{args.join(' ')}"
|
38
|
-
logging_stream.puts command if verbose
|
39
|
-
return if dry_run
|
40
|
-
ENV['LANGUAGE'] = 'en_US'
|
41
|
-
result = `#{command}`
|
42
|
-
logging_stream.puts result if verbose
|
43
|
-
raise "Command #{command} resulted in an error:\n\n#{result}" unless $?.exitstatus.zero?
|
44
|
-
result
|
45
|
-
end
|
46
|
-
|
47
|
-
# Returns an IO-like object to which all information should be logged.
|
48
|
-
def logging_stream
|
49
|
-
@logging_stream ||= $stdout
|
50
|
-
end
|
51
|
-
|
52
|
-
def skip(dir, msg, header=true)
|
53
|
-
logging_stream.print "Skipping '#{dir}': " if header
|
54
|
-
logging_stream.puts msg
|
55
|
-
end
|
56
|
-
|
57
|
-
def find_targets
|
58
|
-
targets = Array.new
|
59
|
-
svn(:propget, '--recursive', Piston::ROOT).each_line do |line|
|
60
|
-
next unless line =~ /^([^ ]+)\s-\s.*$/
|
61
|
-
targets << $1
|
62
|
-
end
|
63
|
-
|
64
|
-
targets
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
end
|
data/lib/piston/command_error.rb
DELETED
data/lib/piston/commands/lock.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require "piston"
|
2
|
-
require "piston/command"
|
3
|
-
|
4
|
-
module Piston
|
5
|
-
module Commands
|
6
|
-
class Lock < Piston::Command
|
7
|
-
def run
|
8
|
-
raise Piston::CommandError, "No targets to run against" if args.empty?
|
9
|
-
|
10
|
-
args.each do |dir|
|
11
|
-
remote_rev = svn(:propget, Piston::REMOTE_REV, dir).chomp.to_i
|
12
|
-
svn :propset, Piston::LOCKED, remote_rev, dir
|
13
|
-
logging_stream.puts "'#{dir}' locked at revision #{remote_rev}"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.help
|
18
|
-
"Lock one or more folders to their current revision"
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.detailed_help
|
22
|
-
<<EOF
|
23
|
-
usage: lock DIR [DIR [...]]
|
24
|
-
|
25
|
-
Locked folders will not be updated to the latest revision when updating.
|
26
|
-
EOF
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,139 +0,0 @@
|
|
1
|
-
require "piston"
|
2
|
-
require "piston/command"
|
3
|
-
|
4
|
-
module Piston
|
5
|
-
module Commands
|
6
|
-
class Switch < Piston::Command
|
7
|
-
def run
|
8
|
-
new_root, dir = args.shift, args.shift
|
9
|
-
raise Piston::CommandError, "Expected two arguments only to switch. Unrecognized arguments: #{args.inspect}" unless args.empty?
|
10
|
-
raise Piston::CommandError, "Expected a new vendor repository URL." if new_root.nil?
|
11
|
-
raise Piston::CommandError, "Expected a directory to update." if dir.nil?
|
12
|
-
switch(dir, new_root)
|
13
|
-
end
|
14
|
-
|
15
|
-
def switch(dir, new_repos)
|
16
|
-
return unless File.directory?(dir)
|
17
|
-
return skip(dir, "locked") unless svn(:propget, LOCKED, dir) == ''
|
18
|
-
status = svn(:status, '--show-updates', dir)
|
19
|
-
new_local_rev = nil
|
20
|
-
new_status = Array.new
|
21
|
-
status.each_line do |line|
|
22
|
-
if line =~ /status.+\s(\d+)$/i then
|
23
|
-
new_local_rev = $1.to_i
|
24
|
-
else
|
25
|
-
new_status << line unless line =~ /^\?/
|
26
|
-
end
|
27
|
-
end
|
28
|
-
raise "Unable to parse status\n#{status}" unless new_local_rev
|
29
|
-
return skip(dir, "pending updates -- run \"svn update #{dir}\"\n#{new_status}") if new_status.size > 0
|
30
|
-
|
31
|
-
logging_stream.puts "Processing '#{dir}'..."
|
32
|
-
repos = svn(:propget, Piston::ROOT, dir).chomp
|
33
|
-
uuid = svn(:propget, Piston::UUID, dir).chomp
|
34
|
-
remote_revision = svn(:propget, Piston::REMOTE_REV, dir).chomp.to_i
|
35
|
-
local_revision = svn(:propget, Piston::LOCAL_REV, dir).chomp.to_i
|
36
|
-
local_revision = local_revision.succ
|
37
|
-
|
38
|
-
new_info = YAML::load(svn(:info, new_repos))
|
39
|
-
raise Piston::CommandError, "Switching repositories is not supported at this time\nYou initially imported from #{uuid}, but are now importing from #{new_info['Repository UUID']}" unless uuid == new_info['Repository UUID']
|
40
|
-
|
41
|
-
logging_stream.puts " Fetching remote repository's latest revision and UUID"
|
42
|
-
info = YAML::load(svn(:info, "#{repos}@#{remote_revision}"))
|
43
|
-
return skip(dir, "Repository UUID changed\n Expected #{uuid}\n Found #{info['Repository UUID']}\n Repository: #{repos}") unless uuid == info['Repository UUID']
|
44
|
-
|
45
|
-
new_remote_rev = new_info['Last Changed Rev'].to_i
|
46
|
-
revisions = (remote_revision .. (revision || new_remote_rev))
|
47
|
-
|
48
|
-
logging_stream.puts " Restoring remote repository to known state at r#{revisions.first}"
|
49
|
-
svn :checkout, '--ignore-externals', '--quiet', '--revision', revisions.first, "#{repos}@#{remote_revision}", dir.tmp
|
50
|
-
|
51
|
-
logging_stream.puts " Updating remote repository to #{new_repos}@#{revisions.last}"
|
52
|
-
updates = svn :switch, '--revision', revisions.last, new_repos, dir.tmp
|
53
|
-
|
54
|
-
logging_stream.puts " Processing adds/deletes"
|
55
|
-
merges = Array.new
|
56
|
-
changes = 0
|
57
|
-
updates.each_line do |line|
|
58
|
-
next unless line =~ %r{^([A-Z]).*\s+#{Regexp.escape(dir.tmp)}[\\/](.+)$}
|
59
|
-
op, file = $1, $2
|
60
|
-
changes += 1
|
61
|
-
|
62
|
-
case op
|
63
|
-
when 'A'
|
64
|
-
if File.directory?(File.join(dir.tmp, file)) then
|
65
|
-
svn :mkdir, '--quiet', File.join(dir, file)
|
66
|
-
else
|
67
|
-
copy(dir, file)
|
68
|
-
svn :add, '--quiet', '--force', File.join(dir, file)
|
69
|
-
end
|
70
|
-
when 'D'
|
71
|
-
svn :remove, '--quiet', '--force', File.join(dir, file)
|
72
|
-
else
|
73
|
-
copy(dir, file)
|
74
|
-
merges << file
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
# Determine if there are any local changes in the pistoned directory
|
79
|
-
log = svn(:log, '--quiet', '--revision', (local_revision .. new_local_rev).to_svn, '--limit', '2', dir)
|
80
|
-
|
81
|
-
# If none, we skip the merge process
|
82
|
-
if local_revision < new_local_rev && log.count("\n") > 3 then
|
83
|
-
logging_stream.puts " Merging local changes back in"
|
84
|
-
merges.each do |file|
|
85
|
-
begin
|
86
|
-
svn(:merge, '--quiet', '--revision', (local_revision .. new_local_rev).to_svn,
|
87
|
-
File.join(dir, file), File.join(dir, file))
|
88
|
-
rescue RuntimeError
|
89
|
-
next if $!.message =~ /Unable to find repository location for/
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
logging_stream.puts " Removing temporary files / folders"
|
95
|
-
FileUtils.rm_rf dir.tmp
|
96
|
-
|
97
|
-
logging_stream.puts " Updating Piston properties"
|
98
|
-
svn :propset, Piston::ROOT, new_repos, dir
|
99
|
-
svn :propset, Piston::REMOTE_REV, revisions.last, dir
|
100
|
-
svn :propset, Piston::LOCAL_REV, new_local_rev, dir
|
101
|
-
svn :propset, Piston::LOCKED, revisions.last, dir if lock
|
102
|
-
|
103
|
-
logging_stream.puts " Updated to r#{revisions.last} (#{changes} changes)"
|
104
|
-
end
|
105
|
-
|
106
|
-
def copy(dir, file)
|
107
|
-
FileUtils.cp(File.join(dir.tmp, file), File.join(dir, file))
|
108
|
-
end
|
109
|
-
|
110
|
-
def skip(dir, msg, header=true)
|
111
|
-
logging_stream.print "Skipping '#{dir}': " if header
|
112
|
-
logging_stream.puts msg
|
113
|
-
end
|
114
|
-
|
115
|
-
def self.help
|
116
|
-
"Switches a single directory to a new repository root"
|
117
|
-
end
|
118
|
-
|
119
|
-
def self.detailed_help
|
120
|
-
<<EOF
|
121
|
-
usage: switch NEW_REPOSITORY_ROOT DIR
|
122
|
-
|
123
|
-
This operation changes the remote location from A to B, keeping local
|
124
|
-
changes. If any local modifications were done, they will be preserved.
|
125
|
-
If merge conflicts occur, they will not be taken care of, and your subsequent
|
126
|
-
commit will fail.
|
127
|
-
|
128
|
-
Piston will refuse to update a folder if it has pending updates. Run
|
129
|
-
'svn update' on the target folder to update it before running Piston
|
130
|
-
again.
|
131
|
-
EOF
|
132
|
-
end
|
133
|
-
|
134
|
-
def self.aliases
|
135
|
-
%w(sw)
|
136
|
-
end
|
137
|
-
end
|
138
|
-
end
|
139
|
-
end
|