| 1 |
-------------- |
| 2 |
Maven SCM AccuRev provider |
| 3 |
-------------- |
| 4 |
Grant Gardner |
| 5 |
-------------- |
| 6 |
January 2009 |
| 7 |
-------------- |
| 8 |
|
| 9 |
~~ Licensed to the Apache Software Foundation (ASF) under one |
| 10 |
~~ or more contributor license agreements. See the NOTICE file |
| 11 |
~~ distributed with this work for additional information |
| 12 |
~~ regarding copyright ownership. The ASF licenses this file |
| 13 |
~~ to you under the Apache License, Version 2.0 (the |
| 14 |
~~ "License"); you may not use this file except in compliance |
| 15 |
~~ with the License. You may obtain a copy of the License at |
| 16 |
~~ |
| 17 |
~~ http://www.apache.org/licenses/LICENSE-2.0 |
| 18 |
~~ |
| 19 |
~~ Unless required by applicable law or agreed to in writing, |
| 20 |
~~ software distributed under the License is distributed on an |
| 21 |
~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 22 |
~~ KIND, either express or implied. See the License for the |
| 23 |
~~ specific language governing permissions and limitations |
| 24 |
~~ under the License. |
| 25 |
|
| 26 |
~~ NOTE: For help with the syntax of this file, see: |
| 27 |
~~ http://maven.apache.org/doxia/references/apt-format.html |
| 28 |
|
| 29 |
The AccuRev provider implements Maven's generic SCM API for the AccuRev SCM system. |
| 30 |
|
| 31 |
Deprecation Notice |
| 32 |
|
| 33 |
This SCM provider is deprecated and will be removed in version 2.0.0. |
| 34 |
|
| 35 |
Use Cases |
| 36 |
|
| 37 |
The provider must handle a number of different use cases: |
| 38 |
|
| 39 |
* Label a source tree and check out that label to a temp directory (the release plugin) |
| 40 |
|
| 41 |
* Provide a changelog between dates/revisions and checkout code to a directory (Continuum et al) |
| 42 |
|
| 43 |
* Map a number of commands designed for CVS/SVN onto the semantics provided by AccuRev (the scm plugin) |
| 44 |
|
| 45 |
Details |
| 46 |
|
| 47 |
|
| 48 |
The main semantic issue faced by the provider is CVS/SVN's concept of a working copy versus AccuRev's concept of a |
| 49 |
workspace. |
| 50 |
|
| 51 |
CVS/SVN allow the user to checkout any repository location to any local directory at will and tracks this |
| 52 |
by keeping metadata in a CVS/.svn directory. AccuRev uses a "workspace" concept whereby it keeps track of |
| 53 |
the physical filesystem locations within the server. This necessarily creates restrictions on where projects |
| 54 |
may be checked out to, in that overlapping workspaces are not allowed. |
| 55 |
|
| 56 |
The other major constraint is the uniqueness of workspace and tag names which cannot be reused. It is up to the |
| 57 |
user to implement some namespace standards to manage this. |
| 58 |
|
| 59 |
URLS |
| 60 |
|
| 61 |
<<<scm:accurev:[user/pass[@host[:port]]][:streamName][:?key=value&key=value...][:/project/path]>>> |
| 62 |
|
| 63 |
* <user/pass> See login below. |
| 64 |
|
| 65 |
* <@host:port> Specify the accurev server to connect to. If used all accurev commands will include a |
| 66 |
<<<-H host:port>>> argument. |
| 67 |
|
| 68 |
* <streamName> provide a "version" for initial checkouts. Only really required for HEAD/trunk type |
| 69 |
checkouts such as done by the tck tests. |
| 70 |
|
| 71 |
* <?prop=value> various properties |
| 72 |
|
| 73 |
* <accurevExe> Path to the accuRev executable |
| 74 |
|
| 75 |
* <tagFormat> Maps branch/tag/version names to AccuRev stream names and vice-versa. See the "tag" command below. |
| 76 |
If provided all streams are expected to conform to this naming standard. |
| 77 |
|
| 78 |
The above can also be referenced as system properties - "maven.scm.accurev.<propertyname>" |
| 79 |
|
| 80 |
* </project/path> is the relative path of your project within AccuRev. Note that AccuRev has no concept of checking |
| 81 |
out a sub-directory so checkouts always create this physical path under the working directory. |
| 82 |
|
| 83 |
NOTE: There is no specification of depot as it can be derived from the working directory or stream names. |
| 84 |
|
| 85 |
SCM Commands |
| 86 |
|
| 87 |
* Login |
| 88 |
|
| 89 |
The recommended method is to run <<<accurev login>>> externally. For automated SCM operations (e.g. Continuum), |
| 90 |
suggest using <<<accurev login -n>>> to create a persistent login that won't expire in the middle of your build. |
| 91 |
|
| 92 |
If you really want to embed this information in URLS and config files, read on. |
| 93 |
|
| 94 |
Username and password can either come from the URL, or from a <<< <server> >>> section in a settings.xml file. |
| 95 |
|
| 96 |
If supplied then we will login to the server with <<< accurev login <user> -A >>>. This returns an |
| 97 |
authentication token to the process which is used in subsequent command invocations by passing |
| 98 |
|
| 99 |
<<< -A <authtoken> >>> to the accurev cli. |
| 100 |
|
| 101 |
* <<Warning>> this method will expose your accurev session token to anyone snooping command lines (eg via ps) |
| 102 |
and will be exposed in debug output |
| 103 |
|
| 104 |
* <<Warning>> under Windows the user's password is passed on the command line, and will be exposed in debug output |
| 105 |
|
| 106 |
* <<Note>> We never logout. AccuRev returns the same session id for a user anyway, and unused sessions will expire. |
| 107 |
|
| 108 |
* Checkout |
| 109 |
|
| 110 |
* Persistent checkout (<<<isPersistCheckout() == true>>>) |
| 111 |
|
| 112 |
The basic premise is to end up with a workspace rooted at the checkout directory with contents as at the specified |
| 113 |
version. |
| 114 |
|
| 115 |
Versions are of the form [basisStream/[tranid|timestamp]]. If a version is not supplied, the streamName from the url |
| 116 |
is used as the basisStream for the workspace. |
| 117 |
|
| 118 |
A non-empty checkout directory is not allowed. It will be created if it does not exist. |
| 119 |
|
| 120 |
If the checkout directory is a subdirectory of an existing workspace other than the <<</project/path>>> specified in |
| 121 |
the URL then the checkout will be aborted. |
| 122 |
|
| 123 |
If a workspace exists at the checkout location then it will be reused. If necessary the basisStream of the workspace |
| 124 |
will be reparented with <<<accurev chws -b>>>. |
| 125 |
|
| 126 |
If the checkout location is not an existing workspace then a new one is created with <<<accurev mkws>>> |
| 127 |
|
| 128 |
Workspace names are generated by concatenating the basis stream and the base name of the checkout directory unless the |
| 129 |
basis stream contains the base name or vice versa, in which case the longer one is used. |
| 130 |
|
| 131 |
If the generated workspace name already exists as stream name elsewhere in AccuRev then the checkout will fail. |
| 132 |
|
| 133 |
The final step is to update the workspace to the tranid/timestamp specified in the supplied version (or "highest" if |
| 134 |
not specified). Note that workspaces cannot go backwards, even when reparented or repopulated and you will get |
| 135 |
"transaction out of range" errors if you try. Since you can't update a workspace to a transaction less than one used |
| 136 |
to create it, any transaction information supplied for an initial checkout will be silently ignored. |
| 137 |
|
| 138 |
* Non persistent checkout |
| 139 |
|
| 140 |
If the persistCheckout flag is false, the provider redirects the checkout to the export command as below. |
| 141 |
|
| 142 |
* Export |
| 143 |
|
| 144 |
A populate outside of a workspace <<<accurev pop -V -l >>> If the checkout directory exists |
| 145 |
within a subdirectory of a workspace AccuRev would normally generate an error. To work around this restriction |
| 146 |
the existing workspace is temporarily deactivated during the export. |
| 147 |
|
| 148 |
For AccuRev 4.9.x the provider supports export to a specific tranid/timestamp. |
| 149 |
|
| 150 |
* Tag |
| 151 |
|
| 152 |
Creates a snapshot <<< accurev mksnap >>> for the basis stream of the workspace specified by the working directory. |
| 153 |
|
| 154 |
A system property "maven.scm.accurev.tagFormat" can be used to specify a java.util.Formatter string used to convert |
| 155 |
from a maven scm tag name to an accurev stream name for the snapshot. |
| 156 |
|
| 157 |
Useful for the release plugin in cases where you have a certain stream naming convention enforced by an AccuRev admin trigger. |
| 158 |
|
| 159 |
* Update |
| 160 |
|
| 161 |
Equivalent to <<<accurev update>>>. The working directory must be in a workspace (or reftree) and that whole |
| 162 |
workspace is updated. |
| 163 |
here has been the option to populate to a specific transaction id. |
| 164 |
A version of the form basisStream/timeSpec can be supplied (tag/branch/revision). If the basis stream of this version |
| 165 |
is different to the current basis of the workspace, then a <<<accurev chws>>> is performed. The timespec component |
| 166 |
is passed as the <<< -t >>> option to the update command. If not supplied the timespec is set to "highest". |
| 167 |
|
| 168 |
Changelog with update is supported. If no start_date for the changelog is supplied, then we start from the |
| 169 |
transaction id of the workspace before the update. The end version for the changelog is the supplied version as |
| 170 |
above (defaulting to "now"). |
| 171 |
|
| 172 |
If the start and end versions refer to the same basis stream, then a changelog is performed using the changelog |
| 173 |
command described below. If the streams are different, then a dummy changeset is synthesised to simply list the |
| 174 |
updated files. |
| 175 |
|
| 176 |
* Add |
| 177 |
|
| 178 |
Equivalent to <<<accurev add>>> |
| 179 |
|
| 180 |
* Checkin |
| 181 |
|
| 182 |
Keep and promote any pending files. <<< accurev promote -K >>> |
| 183 |
|
| 184 |
* Status |
| 185 |
|
| 186 |
Runs a series of <<<accurev stat>>> calls to identify various types of modifications. |
| 187 |
|
| 188 |
* <<<accurev stat -D>>> defunct files => "DELETED" status |
| 189 |
|
| 190 |
* <<<accurev stat -k>>> kept files |
| 191 |
|
| 192 |
* <<<accurev stat -m>>> modified files |
| 193 |
|
| 194 |
* <<<accurev stat -b>>> to find state of kept and modified files in the backing stream to determine |
| 195 |
whether their Maven ScmFileStatus is "ADDED" or "MODIFIED". An unintended change in stat -b output |
| 196 |
for AccuRev 4.9.0 breaks this distinction. |
| 197 |
|
| 198 |
|
| 199 |
* <<<accurev stat -M>>> missing files => "MISSING" status |
| 200 |
|
| 201 |
* <<<accurev stat -x>>> external files => "UNKNOWN" status |
| 202 |
|
| 203 |
* Changelog |
| 204 |
|
| 205 |
List the changes promoted into a stream between times/transaction ids. |
| 206 |
|
| 207 |
<<<accurev hist -s stream -t T1-T2>>> |
| 208 |
|
| 209 |
For AccuRev > 4.7.2 also issues |
| 210 |
|
| 211 |
<<<diff -v stream -V stream -t T1-T2>>> |
| 212 |
|
| 213 |
to synthesise a changeset representing files that have changed upstream. |
| 214 |
|
| 215 |
If the version specifies a workspace stream the history of the workspace |
| 216 |
is merged with the above hist/diff performed on the workspace's basis stream |
| 217 |
|
| 218 |
* Diff |
| 219 |
|
| 220 |
<<Not yet implemented>> |
| 221 |
|
| 222 |
Diff between versions. If only a base directory supplied in the fileset will diff the whole workspace. |
| 223 |
|
| 224 |
If both version specified |
| 225 |
* <<< accurev diff -v <start> -V <end> >>> |
| 226 |
|
| 227 |
If only one version specified then comparison is against workspace filesystem |
| 228 |
* <<< accurev diff -v <start|end> >>> |
| 229 |
|
| 230 |
If no versions specified and stream is in URL, then compare workspace to that stream |
| 231 |
* <<< accurev diff -v <urlStream> >>> |
| 232 |
|
| 233 |
If no versions specified and no stream in URL, then compare workspace to basis stream |
| 234 |
* <<< accurev diff -b >>> |
| 235 |
|
| 236 |
|
| 237 |
* Remove |
| 238 |
|
| 239 |
<<<accurev defunct>>> the elements specified in the fileset, or the whole basedir |
| 240 |
|
| 241 |
* Blame |
| 242 |
|
| 243 |
<<<accurev annotate>>> the specified file |
| 244 |
|
| 245 |
file must be in a workspace/reftree |
| 246 |
|
| 247 |
* Branch |
| 248 |
|
| 249 |
Not implemented. |
| 250 |
|
| 251 |
The Maven SCM branch concept possibly could be represented as some form of <<<accurev mkstream>>> but not sure |
| 252 |
this really does the stream concept justice. |
| 253 |
|
| 254 |
Troubleshooting |
| 255 |
|
| 256 |
Generally to get yourself out of trouble you'll need to manipulate AccuRev externally by moving workspaces around |
| 257 |
bumping versions, reparenting or renaming streams. |
| 258 |
|