svnauto 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/INSTALL +48 -0
- data/LICENSE +22 -0
- data/README +81 -0
- data/THANKS +8 -0
- data/TODO +9 -0
- data/bin/sc +35 -0
- data/doc/manual.txt +241 -0
- data/lib/sc.rb +38 -0
- data/lib/sc/command.rb +118 -0
- data/lib/sc/commands/bug.rb +161 -0
- data/lib/sc/commands/checkout.rb +71 -0
- data/lib/sc/commands/config.rb +58 -0
- data/lib/sc/commands/create.rb +68 -0
- data/lib/sc/commands/experimental.rb +142 -0
- data/lib/sc/commands/info.rb +54 -0
- data/lib/sc/commands/list.rb +40 -0
- data/lib/sc/commands/release.rb +98 -0
- data/lib/sc/config_file.rb +87 -0
- data/lib/sc/constants.rb +40 -0
- data/lib/sc/dispatcher.rb +189 -0
- data/lib/sc/path.rb +51 -0
- data/lib/sc/project.rb +265 -0
- data/lib/sc/repository.rb +108 -0
- data/lib/sc/svn.rb +96 -0
- data/lib/sc/version.rb +111 -0
- data/test/projfiles/file_one +3 -0
- data/test/projfiles/file_two +3 -0
- data/test/setup.rb +97 -0
- data/test/test_bug.rb +55 -0
- data/test/test_checkout.rb +20 -0
- data/test/test_create.rb +20 -0
- data/test/test_experimental.rb +86 -0
- data/test/test_release.rb +37 -0
- data/test/test_version.rb +41 -0
- metadata +99 -0
data/INSTALL
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
= SC Installation
|
2
|
+
|
3
|
+
Installing SC should be pretty simple, especially if you already have Ruby and
|
4
|
+
RubyGems installed.
|
5
|
+
|
6
|
+
== Install Subversion
|
7
|
+
|
8
|
+
SC uses the svn and svnadmin command line clients that come with Subversion.
|
9
|
+
It's highly likely that you already have Subversion installed, but if not, you
|
10
|
+
can download the source code from http://subversion.tigris.org/ or follow your
|
11
|
+
operating system's procedures for installing third-party software.
|
12
|
+
|
13
|
+
|
14
|
+
== Install Ruby
|
15
|
+
|
16
|
+
Ruby is pre-installed on many operating systems. If for some reason you don't
|
17
|
+
have Ruby installed, you'll need to follow your operating system's procedures
|
18
|
+
for installing Ruby.
|
19
|
+
|
20
|
+
For example, on FreeBSD you can:
|
21
|
+
|
22
|
+
> cd /usr/ports/lang/ruby18 && make install clean
|
23
|
+
|
24
|
+
You can also build Ruby from source. See the Ruby website
|
25
|
+
(http://www.ruby-lang.org) for more information.
|
26
|
+
|
27
|
+
|
28
|
+
== Install RubyGems
|
29
|
+
|
30
|
+
RubyGems is a software package system for software written in Ruby. You may
|
31
|
+
already have RubyGems installed. Try running this:
|
32
|
+
|
33
|
+
> gem -v
|
34
|
+
|
35
|
+
If you don't have RubyGems installed, you can do so by following the
|
36
|
+
instructions on: http://rubygems.org/
|
37
|
+
|
38
|
+
Alternatively, you can use your operating system's package feature, if so
|
39
|
+
equipped. For example, on FreeBSD:
|
40
|
+
|
41
|
+
> cd /usr/ports/devel/ruby-gems && make install clean
|
42
|
+
|
43
|
+
|
44
|
+
== Install SC
|
45
|
+
|
46
|
+
SC is distributed as a RubyGem. You can install SC using the gem command:
|
47
|
+
|
48
|
+
> gem install svnauto --include-dependencies
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
== License
|
2
|
+
|
3
|
+
Copyright (C) 2006 Peter J Jones (pjones@pmade.com)
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
= What is SC?
|
2
|
+
|
3
|
+
SC is a wrapper around Subversion that automates and standardizes branching
|
4
|
+
and merging. The primary goal of the project is to simplify the more complex
|
5
|
+
features of Subversion and therefore encouraging their use.
|
6
|
+
|
7
|
+
|
8
|
+
== Quick Start
|
9
|
+
|
10
|
+
This is a very terse introduction to using SC. For more information, please
|
11
|
+
read the INSTALL file, and it is highly recommended that you read the
|
12
|
+
doc/manual.txt file.
|
13
|
+
|
14
|
+
|
15
|
+
=== Install SC Dependencies
|
16
|
+
|
17
|
+
* Subversion (svn and svnadmin) (http://subversion.tigris.org/)
|
18
|
+
* Ruby (http://www.ruby-lang.org/en/downloads/)
|
19
|
+
* RubyGems (http://docs.rubygems.org/)
|
20
|
+
|
21
|
+
|
22
|
+
=== Downloading and Installing SC
|
23
|
+
|
24
|
+
SC is distributed as a RubyGem. You can install SC using the gem command:
|
25
|
+
|
26
|
+
> gem install svnauto --include-dependencies
|
27
|
+
|
28
|
+
Other download options can be found at: http://rubyforge.org/projects/svnauto/
|
29
|
+
|
30
|
+
=== Getting SC from Its Subversion Repository
|
31
|
+
|
32
|
+
> svn co http://pmade.com/svn/oss/sc/trunk sc-trunk
|
33
|
+
|
34
|
+
|
35
|
+
=== Configure Your Repositories
|
36
|
+
|
37
|
+
Start by telling SC about the repositories you use:
|
38
|
+
|
39
|
+
> sc config --add
|
40
|
+
|
41
|
+
You can also use this method to create a new local repository. When prompted
|
42
|
+
for a repository URL, give a path to a nonexistent directory.
|
43
|
+
|
44
|
+
|
45
|
+
=== Creating a Project with SC
|
46
|
+
|
47
|
+
SC considers top-level directories in the repository to be projects. You can
|
48
|
+
create a new project using the SC 'create' command. This command is
|
49
|
+
non-destructive, so you can use it to make sure that an existing project has
|
50
|
+
the correct directory layout. For more information, see doc/manual.txt.
|
51
|
+
|
52
|
+
> sc create my-new-project
|
53
|
+
|
54
|
+
|
55
|
+
=== Making a Release of Your Project
|
56
|
+
|
57
|
+
When it's time to make an official public release of your software, you should
|
58
|
+
create a release branch and tag the release:
|
59
|
+
|
60
|
+
> sc release 1.0.0
|
61
|
+
|
62
|
+
SC uses a strict version number scheme. Version numbers are formated as
|
63
|
+
MAJOR.MINOR.MACRO. Each component of the version number can be up to six
|
64
|
+
digits long, but they are restricted to integers.
|
65
|
+
|
66
|
+
MAJOR.MINOR version releases are kept on their own release branch. MACRO
|
67
|
+
releases are tags on a release branch. For more information, see
|
68
|
+
doc/manual.txt.
|
69
|
+
|
70
|
+
|
71
|
+
=== Fixing Bugs on a Release Branch
|
72
|
+
|
73
|
+
This is an example that illustrates the use of bug fix branches. Here we take
|
74
|
+
the necessary steps to fix a bug on the release branch. The SC 'bug' command
|
75
|
+
takes a unique bug identifier, which usually comes from a bug tracking system:
|
76
|
+
|
77
|
+
> sc bug 25
|
78
|
+
> # edit files, fix bug, test, and commit
|
79
|
+
> sc bug --close 25
|
80
|
+
|
81
|
+
The bug fix is then merged with the release branch and the trunk.
|
data/THANKS
ADDED
data/TODO
ADDED
data/bin/sc
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
################################################################################
|
3
|
+
#
|
4
|
+
# Copyright (C) 2006 Peter J Jones (pjones@pmade.com)
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
# a copy of this software and associated documentation files (the
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
# the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be
|
15
|
+
# included in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
#
|
25
|
+
################################################################################
|
26
|
+
require 'rubygems'
|
27
|
+
require 'sc'
|
28
|
+
|
29
|
+
begin
|
30
|
+
SC::Dispatcher.new.run
|
31
|
+
rescue RuntimeError => e
|
32
|
+
$stderr.puts "#{SC::Constants::TERMINAL.color(SC::Constants::ME, :red)}: #{e}"
|
33
|
+
exit 1
|
34
|
+
end
|
35
|
+
################################################################################
|
data/doc/manual.txt
ADDED
@@ -0,0 +1,241 @@
|
|
1
|
+
= SC Users Manual
|
2
|
+
|
3
|
+
== SC Command Usage
|
4
|
+
|
5
|
+
SC is invoked in a manner similar to the Subversion svn command. When you use
|
6
|
+
the sc command, you supply optional command line flags, a command, and
|
7
|
+
possibly more command line flags.
|
8
|
+
|
9
|
+
=== SC Invocation Example
|
10
|
+
|
11
|
+
> sc -r test create hello
|
12
|
+
|
13
|
+
This runs the sc command, telling it to use the test repository and to create
|
14
|
+
a project with the name hello. Here is a more complex example:
|
15
|
+
|
16
|
+
> sc -r test create -f hello
|
17
|
+
|
18
|
+
=== Getting More Help
|
19
|
+
|
20
|
+
For a list of top-level command line flags, and commands, invoke sc with
|
21
|
+
the --help command line flag.
|
22
|
+
|
23
|
+
=== Commands
|
24
|
+
|
25
|
+
All work in SC is done through a command. For information about a specific
|
26
|
+
command, give the --help option to the command, for example:
|
27
|
+
|
28
|
+
> sc create --help
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
== Telling SC About Your Repositories
|
33
|
+
|
34
|
+
To save you from having to enter the full URL for the repository each time you
|
35
|
+
use SC, you can store repository URLs in the SC configuration file, which is
|
36
|
+
~/.sc by default.
|
37
|
+
|
38
|
+
=== Adding a Repository
|
39
|
+
|
40
|
+
Use the SC config command to add a repository to the SC configuration file,
|
41
|
+
for example:
|
42
|
+
|
43
|
+
> sc config --add
|
44
|
+
|
45
|
+
Will tell SC to prompt you to enter information about a repository. You will
|
46
|
+
be asked for a name for the repository. The name is then used instead of the
|
47
|
+
URL when invoking SC.
|
48
|
+
|
49
|
+
=== Auto-Discovery
|
50
|
+
|
51
|
+
If you invoke SC from a Subversion controlled directory, SC will automatically
|
52
|
+
use the current repository URL and project name, unless you give SC the -r and
|
53
|
+
-p flags.
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
== Creating a New Project
|
58
|
+
|
59
|
+
You can use SC to create a new project directory structure in the repository.
|
60
|
+
To do this, use the SC create command:
|
61
|
+
|
62
|
+
> sc create my-project-name
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
== Checking Out a Project
|
67
|
+
|
68
|
+
The SC checkout command can be used to help you do a Subversion checkout:
|
69
|
+
|
70
|
+
> sc checkout my-project-name
|
71
|
+
|
72
|
+
By default, the trunk is checked out. Using command line flags, you can also
|
73
|
+
choose to checkout a release, an experimental branch, or a bug fix branch.
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
== Making a Release Branch
|
78
|
+
|
79
|
+
You normally work with your project on its trunk. When it comes time to make
|
80
|
+
a release of your software, you stabilize the trunk, and then make a release
|
81
|
+
branch. The release branch allows you to later fix bugs for a release without
|
82
|
+
having to release the new and unstable features that now exist in the trunk.
|
83
|
+
|
84
|
+
=== Version Numbers
|
85
|
+
|
86
|
+
Before we talk about release branches, we must first talk about version
|
87
|
+
numbers and what SC understands. SC puts strict limitations on version
|
88
|
+
numbers in order to reliably parse and sort version numbers.
|
89
|
+
|
90
|
+
A version number is made up of three parts, MAJOR, MINOR, and MACRO. For
|
91
|
+
example, the version number 10.4.8 has a MAJOR version of 10, a MINOR version
|
92
|
+
of 4 and a MACRO version of 8.
|
93
|
+
|
94
|
+
Each part of the version number must be an integer, and must not be greater
|
95
|
+
than 6 digits.
|
96
|
+
|
97
|
+
SC can properly sort version numbers. For example, version 1.0.10 comes
|
98
|
+
after version number 1.0.2. So, SC actually sorts the version numbers knowing
|
99
|
+
what they mean, instead of just doing a lexical sort.
|
100
|
+
|
101
|
+
Because of this, when using SC, you must use this version numbering scheme.
|
102
|
+
|
103
|
+
=== Branching the Trunk for a Release
|
104
|
+
|
105
|
+
To make a release branch from the current point of the trunk, use the SC
|
106
|
+
release command:
|
107
|
+
|
108
|
+
> sc release 1.0.0
|
109
|
+
|
110
|
+
This will create a release branch for MAJOR.MINOR version 1.0, and then tag
|
111
|
+
the release branch with MACRO version 0.
|
112
|
+
|
113
|
+
|
114
|
+
== Fixing a Bug for a Release
|
115
|
+
|
116
|
+
The great thing about release branches is that you can fix a bug in an older
|
117
|
+
release, without having to create a new release from the trunk of your
|
118
|
+
project. This is because the trunk may contain new features that may not be
|
119
|
+
backwards compatible, or the trunk may currently be unstable.
|
120
|
+
|
121
|
+
To fix a bug that exists in a specific release, you would have to manually do
|
122
|
+
the following:
|
123
|
+
|
124
|
+
1. Branch from the release branch creating a bug fix branch
|
125
|
+
2. Fix the bug on the bug fix branch
|
126
|
+
3. Test and commit your fix
|
127
|
+
4. Merge the bug fix branch to the release branch
|
128
|
+
5. Merge the bug fix branch to the trunk
|
129
|
+
6. Make a new release
|
130
|
+
|
131
|
+
Step five is very important. It ensures that the bug fix makes its way to the
|
132
|
+
trunk, and therefore the next release.
|
133
|
+
|
134
|
+
SC automates this process. It relies on the fact that you assign unique bug
|
135
|
+
identifiers to each bug using a bug tracking system. The example below helps
|
136
|
+
fix a bug with the ID of 5 on the latest release branch:
|
137
|
+
|
138
|
+
> sc bug 5
|
139
|
+
> # fix and commit
|
140
|
+
> sc bug --close 5
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
== Working With Experimental Branches
|
145
|
+
|
146
|
+
Sometimes you might want to make a large set of changes to the trunk that will
|
147
|
+
greatly affect the stability of the code, or might take longer than normal to
|
148
|
+
implement. It's even possible that you might want to make changes to the
|
149
|
+
project that may never be released.
|
150
|
+
|
151
|
+
SC allows you to create experimental branches for such purposes. Experimental
|
152
|
+
branches can be created off the trunk, and can receive changes from the trunk
|
153
|
+
or send changes to the trunk.
|
154
|
+
|
155
|
+
=== Creating an Experimental Branch
|
156
|
+
|
157
|
+
To create an experimental branch, use the SC experimental command, of course,
|
158
|
+
that's a bit much to type, so SC allows you to abbreviate it:
|
159
|
+
|
160
|
+
> sc exp testing-new-parser
|
161
|
+
|
162
|
+
This creates a new experimental branch called testing-new-parser.
|
163
|
+
|
164
|
+
=== Merging the Current Trunk to the Experimental Branch
|
165
|
+
|
166
|
+
Use the SC experimental command with the --up flag:
|
167
|
+
|
168
|
+
> sc exp --up testing-new-parser
|
169
|
+
|
170
|
+
=== Merging the Experimental Branch to the Trunk
|
171
|
+
|
172
|
+
Use the SC experimental command with the --down flag:
|
173
|
+
|
174
|
+
> sc exp --down testing-new-parser
|
175
|
+
|
176
|
+
== Theory
|
177
|
+
|
178
|
+
This section aims to help the SC user understand the implementation decisions
|
179
|
+
that were made.
|
180
|
+
|
181
|
+
=== Inspiration
|
182
|
+
|
183
|
+
The layout of the repository was mostly inspired by:
|
184
|
+
|
185
|
+
Pragmatic Version Control, Using Subversion
|
186
|
+
By Mike Mason
|
187
|
+
ISBN 0-9745140-6-3
|
188
|
+
|
189
|
+
The process for creating release branches and tags is based on the one used by
|
190
|
+
the FreeBSD Release Engineering Team: http://www.freebsd.org/releng/
|
191
|
+
|
192
|
+
=== Repository Layout
|
193
|
+
|
194
|
+
The directories at the top-level of the repository are considered to be
|
195
|
+
projects. In each project, a very specific directory structure is maintained.
|
196
|
+
|
197
|
+
==== The Trunk Directory
|
198
|
+
|
199
|
+
The trunk directory is used to store the most current version of the project.
|
200
|
+
There is no enforcement of the structure inside the trunk. Developers usually
|
201
|
+
work on the trunk until a point in time where the source code in the trunk
|
202
|
+
becomes stable. At this time, a branch of the trunk is made.
|
203
|
+
|
204
|
+
==== The Branches Directory
|
205
|
+
|
206
|
+
The branches directory is used to store branches made of the project. This
|
207
|
+
includes release branches, bug fix branches, and experimental branches.
|
208
|
+
|
209
|
+
==== The Tags Directory
|
210
|
+
|
211
|
+
The tags directory is used to record a point in time for the project. This
|
212
|
+
includes the time at which releases where made, or bug fix branches were
|
213
|
+
created.
|
214
|
+
|
215
|
+
==== Branches and Tags Subdirectories
|
216
|
+
|
217
|
+
The branches and tags directories both include the following subdirectories:
|
218
|
+
|
219
|
+
rel: For releases
|
220
|
+
bug: For bug fixes
|
221
|
+
exp: For experimental code
|
222
|
+
|
223
|
+
==== Repository Structure Visualization
|
224
|
+
|
225
|
+
myproject:
|
226
|
+
|
|
227
|
+
+--trunk
|
228
|
+
| |
|
229
|
+
| +--project-files
|
230
|
+
|
|
231
|
+
+--branches
|
232
|
+
| |
|
233
|
+
| +--rel
|
234
|
+
| +--bug
|
235
|
+
| +--exp
|
236
|
+
|
|
237
|
+
+--tags
|
238
|
+
|
|
239
|
+
+--rel
|
240
|
+
+--bug
|
241
|
+
+--exp
|