SlideShare a Scribd company logo
Subversion In Action 1st Edition Jeffrey Machols
download
https://ebookbell.com/product/subversion-in-action-1st-edition-
jeffrey-machols-6729636
Explore and download more ebooks at ebookbell.com
Here are some recommended products that we believe you will be
interested in. You can click the link to download.
Subversion In Institutional Change And Stability A Neglected Mechanism
1st Edition Jan Olsson Auth
https://ebookbell.com/product/subversion-in-institutional-change-and-
stability-a-neglected-mechanism-1st-edition-jan-olsson-auth-5611208
Narrative Subversion In Medieval Literature El Risden
https://ebookbell.com/product/narrative-subversion-in-medieval-
literature-el-risden-48811808
Espionage And Subversion In An Industrial Society An Examination And
Philosophy Of Defence For Management Peter Hamilton
https://ebookbell.com/product/espionage-and-subversion-in-an-
industrial-society-an-examination-and-philosophy-of-defence-for-
management-peter-hamilton-49419800
The Preaching Fox Festive Subversion In The Plays Of The Wakefield
Master Reprint Warren Edminster
https://ebookbell.com/product/the-preaching-fox-festive-subversion-in-
the-plays-of-the-wakefield-master-reprint-warren-edminster-50769230
Marginality And Subversion In Korea The Hong Kyongnae Rebellion Of
1812 Sun Joo Kim
https://ebookbell.com/product/marginality-and-subversion-in-korea-the-
hong-kyongnae-rebellion-of-1812-sun-joo-kim-51431034
Escape Routes Control And Subversion In The Twentyfirst Century
Dimitris Papadopoulos
https://ebookbell.com/product/escape-routes-control-and-subversion-in-
the-twentyfirst-century-dimitris-papadopoulos-2434750
Myth And Subversion In The Contemporary Novel Jose Manuel Losada Goya
https://ebookbell.com/product/myth-and-subversion-in-the-contemporary-
novel-jose-manuel-losada-goya-40666804
The Gender Dance Ironic Subversion In C S Lewiss Cosmic Trilogy Monika
B Hilder
https://ebookbell.com/product/the-gender-dance-ironic-subversion-in-c-
s-lewiss-cosmic-trilogy-monika-b-hilder-5032172
Power And Subversion In Byzantium Papers From The Fortythird Spring
Symposium Of Byzantine Studies University Of Birmingham March 2010
Reprint Dimiter Angelov
https://ebookbell.com/product/power-and-subversion-in-byzantium-
papers-from-the-fortythird-spring-symposium-of-byzantine-studies-
university-of-birmingham-march-2010-reprint-dimiter-angelov-10841852
Subversion In Action 1st Edition Jeffrey Machols
Jeffrey Machols
M A N N I N G
Subversion
IN ACTION
The guide to source control
Subversion in Action
Licensed to <null>
Licensed to <null>
Subversion
in Action
JEFFREY MACHOLS
M A N N I N G
Greenwich
(74° w. long.)
Licensed to <null>
For online information and ordering of this and other Manning books, please visit
www.manning.com. The publisher offers discounts on this book when ordered in
quantity. For more information, please contact:
Special Sales Department
Manning Publications Co.
209 Bruce Park Avenue Fax: (203) 661-9018
Greenwich, CT 06830 email: manning@manning.com
©2005 by Manning Publications Co. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted,
in any form or by means electronic, mechanical, photocopying, or otherwise, without
prior written permission of the publisher.
Many of the designations used by manufacturers and sellers to distinguish their products
are claimed as trademarks. Where those designations appear in the book, and Manning
Publications was aware of a trademark claim, the designations have been printed in initial
caps or all caps.
Recognizing the importance of preserving what has been written, it is Manning’s policy to have
the books they publish printed on acid-free paper, and we exert our best efforts to that end.
Manning Publications Co. Copyeditor: Linda Recktenwald
209 Bruce Park Avenue Typesetter: Gordan Salinovic
Greenwich, CT 06830 Cover designer: Leslie Haimes
ISBN 1-932394-36-2
Printed in the United States of America
1 2 3 4 5 6 7 8 9 10 – VHG – 07 06 05 04
Licensed to <null>
v
contents
preface xiii
acknowledgments xv
about this book xvii
about the title xx
about the cover illustration xxi
1 Introduction 1
1.1 Understanding version control 2
Why use version control 3 ■ The repository 3 ■ Checkout
strategies 3 ■ Commit and update 5 ■ What are change logs? 5
The role of properties 7
1.2 30,000 foot view of Subversion 8
Atomic commits 9 ■ Everything is versioned 9
The three components of Subversion 9
1.3 Revision numbers 10
The old way 11 ■ Subversion revision numbers 12
1.4 Summary 14
2 Getting started 15
2.1 Getting Subversion 16
Which package to get? 16 ■ Installing on Windows 17
Installing on Linux 17 ■ Subversion is installed; what now? 18
Licensed to <null>
vi CONTENTS
2.2 Command-line interface 19
Different clients 19 ■ Getting help 20 ■ Paths and URLs 21
2.3 Creating a repository 22
Finding a location for the repository 22 ■ Permissions 23
Svnadmin create 24 ■ Internal repository directories and files 25
2.4 Common options 26
Recursion 26 ■ Entering the log message 27
Accessing specific revisions 30 ■ Authentication 32
2.5 Importing your files into Subversion 33
A basic import 33 ■ Changing what you import 34
Changing where you import 35
2.6 Checking out the repository 35
Finding your starting point 35 ■ A simple checkout 36
The .svn directory 37 ■ Checking out specific versions 37
Changing the paths 38
2.7 Committing changes 39
A path to commit 40 ■ What and when do you commit? 40
Out-of-date transactions 41
2.8 Summary 43
3 Managing your working copy 44
3.1 Checking the state of your working copy 45
Understanding the status codes 45 ■ Running the status
command 48 ■ Trimming your file list 49 ■ Getting more
information 51 ■ Checking ignored files 51 ■ Repository
changes 52 ■ When to use the status 53
3.2 Updating your working copy 54
Running the update command 54 ■ Update status codes 55
Updating to specific revisions 55
3.3 Conflicts 59
Resolution files 59 ■ Resolution scenarios 60
Cleaning up the conflict 64
3.4 Adding files and directories 65
Adding a single file 65 ■ Adding a directory and its contents 66
Wildcards 68
3.5 Copying 68
Where is my previous version? 69 ■ Making a local copy 70
Licensed to <null>
CONTENTS vii
3.6 Moving and renaming 71
Moving files in the working copy 72 ■ Directories 73
Moving directly in the repository 74 ■ Implications of
moving files on previous revisions 74
3.7 Removing files from the repository 75
Running the remove command 76 ■ Directories 77
3.8 Summary 78
4 Getting change information 79
4.1 Viewing change logs 80
Running the log command 80 ■ Change logs for
directories 81 ■ Suppressing the log messages 83
Logs for specific revisions 84 ■ Viewing the change
paths 87 ■ Stopping the change logs from a copy 89
Formatting the change logs 90 ■ Changing log messages 94
4.2 Getting a list of files 96
A simple list 96 ■ Verbose 97 ■ Revisions 98 ■ Recursive
listing 98 ■ List from URL 99 ■ Old or nonexistent files 99
4.3 Comparing revisions 100
The diff syntax 100 ■ Running the diff command on your
local copy 102 ■ Specifying revisions 103 ■ Running diff
directly from the repository 105 ■ Using other diff programs 107
Running diff on directories 109
4.4 Looking at file contents 111
Running the cat command 111
Revision numbers 112 ■ URLs 112
4.5 Annotating a file 113
Running the annotate command 114 ■ Annotating specific
revisions 114 ■ Directly accessing the repository 115
Be cautious when using annotate 115
4.6 Summary 117
5 Branches and tags 119
5.1 Branching overview 120
What is a branch? 120 ■ When should you use branches? 122
Branching strategies 124 ■ Project root layout 126
Licensed to <null>
viii CONTENTS
5.2 Creating branches 130
Creating a branch from a working copy 130
Copying directly into the repository from a working copy 131
Creating a branch on a checkout 133 ■ Repository to repository 134
Creating a branch from a specific revision 135
5.3 Changing repository URLs 136
Recursion 137 ■ Moving repositories 138
Switching to an old revision 139
5.4 Merging revisions 140
A simple merge 140 ■ Moving changes from a branch 141
Merging a single file 142 ■ Conflicts 142 ■ Keeping track of
your merges 142 ■ Doing a dry run 145
5.5 Tags in Subversion 146
5.6 Summary 147
6 Properties 148
6.1 Properties overview 149
Name/value pairs 149 ■ Properties are versioned 150
6.2 Adding a property to an object 151
Applying properties to a directory 152 ■ Passing in arguments as file
contents 153 ■ Editing property values 155
Removing properties 156
6.3 Listing properties on an object 159
Listing the name and value 159 ■ Property listings on a
directory 160 ■ Listing the properties of a specific revision 161
6.4 Getting the value of a property 161
Running the propget 161 ■ Getting properties on multiple files 162
Getting older revisions 162 ■ Removing extra characters from
the output 163
6.5 Built-in properties 164
Ignore property 164 ■ Keywords 169 ■ Executable property 172
End-of-line style 173 ■ Externals 174
6.6 Revision properties 176
Default revision properties 176 ■ Adding properties 176
Viewing revision properties 177 ■ Changing the properties 178
6.7 Summary 178
Licensed to <null>
CONTENTS ix
7 Repository administration 180
7.1 Backing up your repository 181
Dumping the repository 181 ■ Loading from a dump file 185
Creating a hot backup of a repository 187 ■ Exporting a
non-versioned copy 188
7.2 Setting up network access with svnserve 189
Choosing between svnserve and Apache 190
Running the default configuration 191 ■ Svnserve configuration
file 192 ■ Setting up authorization 194 ■ Changing the URL 197
Changing the svnserve network settings 197 ■ Running svnserve from
the Linux xinetd 198 ■ Running svnserve with ssh 199
7.3 Setting up access with the Apache HTTP server 200
Getting the modules set up 200 ■ A basic setup 201
Multiple repositories 203 ■ Users and authentication 203
Configuring authorization 205 ■ Encrypting the transmission 208
Repository browsing 210
7.4 Summary 213
8 Advanced administration and configuration 214
8.1 Client-side configuration 215
Configuration files 215 ■ Configuring the server connection
information 217 ■ SSL settings 220 ■ Command
configurations 221 ■ Authentication caching 226
8.2 Resolving deadlocks 227
Working copy locks 227
8.3 Berkeley DB 229
Transaction logs 229 ■ Old transactions 230
8.4 Hooks 231
Commit actions 232 ■ Revision property actions 233
Scripts 234
8.5 Summary 240
9 Subversion utility clients 241
9.1 The svnlook interface 242
Transactions and revisions 242
Licensed to <null>
x CONTENTS
9.2 Getting change log information 243
Getting the author 243 ■ Finding the date of a revision 244
Viewing the log message 244 ■ Getting all the change
information 244 ■ Finding the files that changed 245
9.3 Getting information on properties 245
Listing the properties 246 ■ Getting the value of a property 247
9.4 Finding out what changed 249
Getting the differences between revisions 249
Viewing the entire contents of a file 250 ■ Finding the directories
that changed 251 ■ Looking at the entire tree 251 ■ Getting change
information on a directory 252 ■ Getting repository information
with svnlook 253
9.5 Other Subversion programs 254
The svnversion tool 254 ■ The svndumpfilter interface 256
9.6 Summary 262
10 Third-party tools 263
10.1 Importing a CVS repository 264
Getting cvs2svn 264 ■ Creating a Subversion dump from CVS 265
Changing the project root information 268
Converting directly into a Subversion repository 269
10.2 Eclipse plug-in 271
Getting Subclipse 271 ■ Using Subclipse 272
Using the command line versus the plug-in 275
10.3 Subversion browsing over Apache with a browser 275
Configuration 276 ■ Using WebSVN 278
10.4 Windows graphical user interface 278
Installing TortoiseSVN 278 ■ Checking out a repository 280
Checking the status 281 ■ Committing to the repository 282
Running other commands 282
10.5 Summary 283
11 Subversion in a development lifecycle 284
11.1 Setting up your environment 285
Ignored files 285 ■ Using autoprops 285
Getting plug-ins and other tools 286
Licensed to <null>
CONTENTS xi
11.2 Writing code 286
Bug fixes 287 ■ Patches 289
11.3 Promoting code 292
Properties 293 ■ Tags 294 ■ Automating code promotion 295
11.4 Testing and Subversion 296
Maintaining the testing environment 296
Locking down properties 297
11.5 Summary 297
appendix A SSL certificates 299
appendix B Building Subversion 307
index 313
Licensed to <null>
Licensed to <null>
xiii
preface
When the Apache Software Foundation accepted LDAPd, an open source LDAP
server, as a new project in the incubator, I was “elected” to work with the Apache
Infrastructure team to bring the source code over and get it into the CVS reposi-
tory. Noel Bergman, the mentor for the project, suggested to the team that we use
Subversion, a new version control system, instead of CVS. No one on the team,
including myself, gave Subversion a very close look. We were all very excited to be
a part of Apache and just wanted to get the project going. After all, Subversion
had a different revision numbering system that nobody liked, we all had our sys-
tems set up for CVS, plus Subversion had not yet even released a 1.0 version. So we
took a vote on the Apache Directory project to stay with CVS.
Despite our strong resistance to change, Noel stuck to his guns that Subversion
was a better tool and it would be worth the relatively small effort required to learn
it. After some discussion, Alex Karasulu, the project lead and creator of the server,
asked me to investigate Subversion further and see what it had to offer.
So I went to the Subversion web site and downloaded the tool. In about two
minutes I had a repository created and some test files loaded. Hmm…that was
easy. Then it was time to test one of the big claims: that Subversion can rename
and move files and directories seamlessly. After years of struggling to do this in
CVS, I had to see it to believe it. Part of the migration into Apache required switch-
ing to a different directory structure, and I knew that would be a huge headache
for me. This worked without a hitch. It took only one evening of playing around,
and I was singing a different tune.
Licensed to <null>
xiv PREFACE
After another discussion with Alex, it was time for a second vote with our new
recommendations. There was some reluctance on the part of the team, but we
decided to go with Subversion. I was fortunate to work with Noel and other mem-
bers of the Apache Infrastructure team, who helped me migrate the code.
Through this process I was able to get some great experience with Subversion and
see its benefits.
Over the next few months I became a bigger proponent of Subversion. As I talked
to others in the development world, both open source and corporate, I didn’t get
the enthusiastic response I expected. It occurred to me that developers still saw ver-
sion control as a necessary evil, not a beneficial tool for software development.
It was at this point that I wanted to write a comprehensive guide on Subver-
sion. It was important to demonstrate to the development community not only
how to run the commands but also how the tool can help the software develop-
ment process. The staff at Manning also saw a need for this type of book, and so
we started Subversion in Action.
This book is not just the online help regurgitated with a few examples thrown
in. While it will serve as a technical guide to using Subversion, more importantly,
it will be a guide for using it as a tool in your software development.
Licensed to <null>
xv
acknowledgments
I would like to acknowledge my family for all their support and patience through
this process, another one of my projects.
There are many people along the way who helped me get to the point where I
could write this book. First and foremost I need to thank Alex Karasulu. He opened
many doors for me in the open source and technical communities (and sometimes
pushed me through the doorway). I would also like to thank Noel Bergman for
introducing me to Subversion and helping me through the learning process.
None of this would have happened without the people who created, developed,
and now support Subversion. The time, effort, and sacrifices it takes to create a
project of this size are enormous—and this is all volunteer work.
Thanks to all the people who either formally or informally reviewed the book
as it was being written and gave input. These include Darin Riedlinger, Michael A.
Koziarski, Doug Warren, Michael Oliver, Bill Fly, and James Rybacki. I would espe-
cially like to thank Ryan Cox for his multiple passes through the book and great
suggestions.
All of the great people at Manning Publications really helped me get through
this daunting task. I owe a great deal to the following folks:
Licensed to <null>
xvi ACKNOWLEDGMENTS
■ Marjan Bace, publisher of Manning, for refining my rough idea, training
me without limiting me, and finally taking a chance on a rookie
■ Susan Capparelle for her help in coordinating the entire process and
assiting me throughout
■ Ann Navarro, the book’s development editor, for all her guidance and
support
■ Karen Tegtmeyer, who coordinated all the reviewers and the feedback
■ Mary Piergies, who managed the production of the book and kept things,
including me, moving
■ Linda Recktenwald for her detailed editing of the book
■ Dottie Marsico and Gordan Salinovic for turning the text into a book
■ Helen Trimes for getting the book out there and known
■ Susan Forsyth for proofreading the book and getting me through the final
stages
Licensed to <null>
xvii
about this book
How the book is organized
Each chapter in the book is meant to extend your knowledge of Subversion. The
first few chapters will give you a basic understanding so you can start using the
software productively. The following chapters will show you how to take advantage
of the power of Subversion. This means you don’t have read the book from cover
to cover to use Subversion. In addition to using the book as a guide, you can use it
as a reference. By following the headings, you can quickly find the information
you are looking for. Let’s take a look at how the chapters are organized:
■ Chapter 1 gives you an introduction to version control in general and shows
what Subversion brings to the table.
■ Chapter 2 gets you started using Subversion. Here you will install the
software, create a repository, and start to access it.
■ Chapters 3 and 4 go through the common Subversion commands to
manipulate files and get information out of the repository.
■ Chapter 5 discusses branching and tagging concepts and how Subversion
implements them.
■ Chapter 6 describes properties, which are Subversion’s implementation of
metadata.
■ Chapters 7 and 8 go into repository administration, including backups and
network access, and then advance to such topics as client configuration and
hook scripts.
Licensed to <null>
xviii ABOUT THIS BOOK
■ Chapter 9 explores the “extra” Subversion clients that give you more
advanced capabilities to customize your implementation.
■ Chapter 10 reviews some of the common third-party tools that can enhance
your development with Subversion.
■ Chapter 11 wraps up by showing how you can use Subversion in areas of
development that may not fit the traditional view of version control yet still
be valuable.
Who should read this book
Version control is something that affects many parts of an organization, open
source or commercial, that does any kind of development. There are three main
groups of people who need to know about the tool and the process behind the tool:
■ Developers: This is the obvious group who will benefit from the book. Not
only will you learn how to use Subversion, but you will see ways it can help
you with your software development.
■ Configuration managers: If you are responsible for the building, deployment,
and migration of source code, you will need to have a better understanding
of version control than even the developers. In addition to using
Subversion, you will need to create scripts, automation, and the processes
around the code.
■ System administrators: In many organizations, the people maintaining the
infrastructure are separate from those who develop it. Even if you do not
work with the code, you will have to install the software, set up access,
configure the network, and create backups. These topics have been
segmented so you can easily refer to them without having to go through all
aspects of Subversion.
Conventions
The vast majority of Subversion is accessible from the command line. A command
prompt will be indicated by the $ character. This will indicate the start of a com-
mand, and you will not type the $ when running the command. For example, if
you see something like the following:
$ run a command
Some output
you will type everything on the first line, including the spaces, except the first $.
The lines without the $ prompt are output from the command. All the commands
and the output will be in code font, which tells you that the text is part of the com-
mand or part of the output. For the sake of readability, some commands will span
Licensed to <null>
ABOUT THIS BOOK xix
multiple lines in the example. To indicate this, a  character will be placed at the
end of line:
$ run a command 
on two lines
Some output
In this example, you will type “run a command on two lines” as the actual com-
mand. The output will follow the last line that does not end with .
Source code
While Subversion and version control in general are designed for software devel-
opment, this is not a programming book. With that said, we will be working with
code in many of the examples. The source code is oversimplified on purpose so
you will not get caught up in figuring out what the program is doing (we will work
with HelloWorld quite a bit). I intentionally switch from Java to C—and some-
times text files—throughout the book to illustrate that Subversion does not care
what it is storing.
Author Online
Purchase of Subversion in Action includes free access to a private web forum run by
Manning Publications where you can make comments about the book, ask
technical questions, and receive help from the author and from other users. To
access the forum and subscribe to it, point your web browser to
www.manning.com/machols. This page provides information on how to get on
the forum once you are registered, what kind of help is available, and the rules of
conduct on the forum.
Manning's commitment to our readers is to provide a venue where a meaningful
dialog between individual readers and between readers and the author can take
place. It is not a commitment to any specific amount of participation on the part of
the author, whose contribution to the AO remains voluntary (and unpaid). We sug-
gest you try asking the authors some challenging questions lest his interest stray!
The Author Online forum and the archives of previous discussions will be
accessible from the publisher's web site as long as the book is in print.
Licensed to <null>
xx
about the title
By combining introductions, overviews, and how-to examples, the In Action books
are designed to help learning and remembering. According to research in cogni-
tive science, the things people remember are things they discover during self-
motivated exploration.
Although no one at Manning is a cognitive scientist, we are convinced that for
learning to become permanent it must pass through stages of exploration, play,
and, interestingly, re-telling of what is being learned. People understand and
remember new things, which is to say they master them, only after actively explor-
ing them. Humans learn in action. An essential part of an In Action guide is that it
is example-driven. It encourages the reader to try things out, to play with new
code, and explore new ideas.
There is another, more mundane, reason for the title of this book: our readers
are busy. They use books to do a job or solve a problem. They need books that
allow them to jump in and jump out easily and learn just what they want just when
they want it. They need books that aid them in action. The books in this series are
designed for such readers.
Licensed to <null>
xxi
about the cover illustration
The figure on the cover of Subversion in Action is a “Hamal,” or common porter.
The illustration is taken from a collection of costumes of the Ottoman Empire
published on January 1, 1802, by William Miller of Old Bond Street, London. The
title page is missing from the collection and we have been unable to track it down
to date. The book's table of contents identifies the figures in both English and
French, and each illustration bears the names of two artists who worked on it,
both of whom would no doubt be surprised to find their art gracing the front
cover of a computer programming book...two hundred years later.
The collection was purchased by a Manning editor at an antiquarian flea mar-
ket in the "Garage" on West 26th Street in Manhattan. The seller was an American
based in Ankara, Turkey, and the transaction took place just as he was packing up
his stand for the day. The Manning editor did not have on his person the substan-
tial amount of cash that was required for the purchase and a credit card and
check were both politely turned down.
With the seller flying back to Ankara that evening the situation was getting
hopeless. What was the solution? It turned out to be nothing more than an old-
fashioned verbal agreement sealed with a handshake. The seller simply proposed
that the money be transferred to him by wire and the editor walked out with the
bank information on a piece of paper and the portfolio of images under his arm.
Needless to say, we transferred the funds the next day, and we remain grateful and
Licensed to <null>
xxii ABOUT THE COVER ILLUSTRATION
impressed by this unknown person’s trust in one of us. It recalls something that
might have happened a long time ago.
The pictures from the Ottoman collection, like the other illustrations that
appear on our covers, bring to life the richness and variety of dress customs of two
centuries ago. They recall the sense of isolation and distance of that period—and
of every other historic period except our own hyperkinetic present.
Dress codes have changed since then and the diversity by region, so rich at the
time, has faded away. It is now often hard to tell the inhabitant of one continent
from another. Perhaps, trying to view it optimistically, we have traded a cultural
and visual diversity for a more varied personal life. Or a more varied and interest-
ing intellectual and technical life.
We at Manning celebrate the inventiveness, the initiative, and, yes, the fun of
the computer business with book covers based on the rich diversity of regional life
of two centuries ago, brought back to life by the pictures from this collection.
Licensed to <null>
1
Introduction
In this chapter
■ Introduction to version control
■ Overview of Subversion
■ New revision numbering paradigm
Licensed to <null>
2 CHAPTER 1
Introduction
I doubt this was planned, but the dictionary definition of “subversion” happens
to provide a fitting description of Subversion’s social role: by subverting the com-
manding position held for years by Concurrent Versions System (CVS), it is
quickly becoming the de facto standard for open source version control systems.
Many open source development communities are moving away from CVS and
adapting Subversion, and this trend will only accelerate. If you want to be in on
this trend—and take advantage of the best versioning system available for your
group-development infrastructure—this book is for you.
While other areas of software development such as IDE’s progressed, version
control remained relatively stagnant, especially in the open source world. But as
the practice of community software development caught on, it became apparent
that the glue that allows people to work together in different places and at differ-
ent times is their version control system. It also became clear that the old stan-
dard, CVS, was becoming inadequate for supporting advanced open source
development practices. From this need, Subversion was born as a product built by
developers to make version control a seamless part of the development process
instead of an impediment.
If you find yourself involved in a live discussion that touches on Subversion,
you might like to know that those in the know do not pronounce it as a single
word, with the accent on “ver.” Instead, they say it as if it were two words, Sub
version. Pronounce it as they do and your standing automatically improves.
Now, having finished with that important matter, let’s turn to substance.
Throughout this book, we will explore the features of Subversion that are making
it the success it is and causing development communities and businesses to
embrace it so quickly. Not only will we look at how the system works and what the
commands do, but we will also tie it all in with your software development process.
1.1 Understanding version control
First, it will help to understand the basics of a version control system in a generic
sense. Think back to elementary school and remember the bespectacled figure of
your librarian. She may have been stern but she knew where every book in the
library was, who had it checked out, and when a new edition was coming in. A ver-
sion control system plays a similar role, but without the thick glasses and the nasty
shushing, of course. Rather than tracking books in a library, a versioning system
manages files in a directory. It controls the files coming in and out and keeps
track of who made the change. It also provides the useful capability to get back an
old revision of a file.
Licensed to <null>
Understanding version control 3
1.1.1 Why use version control
Have you ever been in a situation where something in a file changed and you
asked, “What did that file look like before—when it worked? When did this file
change? Who changed it?” I often find myself looking at an edit I made in the past
and wondering why I made it. A version control system gives you the answer to
these questions. It also gives you the tools to manage your code better by provid-
ing features such as the following:
■ Helps you manage code by tagging specific versions as a release of the software
■ Allows you to add automation to manual tasks through the use of hook
scripts, which run when triggered from an action
■ Allows for multiple users to work on the same file without losing any
changes
■ Provides the ability to start another development path from the same code
base and then merge the two paths back together
■ Efficiently stores multiple versions of a file by keeping only the changes to
each version instead of an entire copy
Let’s take a look at how some of these features are implemented by exploring
some of the technical aspects of a version control system.
1.1.2 The repository
The core of any version control system is the repository, which is a basically a
souped-up filesystem. It tracks the changes to files and allows multiple users con-
current access. Each time a modified file is saved to the repository, a new revision
of that file is created. These revisions contain not only the contents in the file that
changed but also external information, such as who changed it and when it was
changed. In a standard filesystem, you access and edit files directly; not so in a
repository. Instead, the system has a client interface that does the reading and
writing to the repository for you. This client talks to the repository and allows for
the transparent implementation of all the features we just described.
1.1.3 Checkout strategies
We know repositories do not allow direct access to the files and directories, so you
need a way to get at your code. To accomplish this, you perform a checkout, which
is a request for a copy of the file through the client. You can check out one file, a
directory, or the entire repository. This is similar to checking out a book from a
library. You go to a central location and get a copy of a book, or in the case of a
Licensed to <null>
4 CHAPTER 1
Introduction
repository, a file. If a new edition or revision comes out, you go back and check
out the new one.
Copy-modify-merge. Many version control systems, including Subversion, use a
checkout strategy called copy-modify-merge. In this model, when you perform a
checkout, you get a working copy of the file in a local directory on your machine.
This is a snapshot of the repository where you will make your changes
independently of other developers. When you have finished with your changes,
you copy the file, main.c in this example, back into the repository. Figure 1.1
illustrates this workflow.
Then, when another developer checks out the file main.c, it will include your
changes, and that person will follow the same process. If you are making changes
at the same time as someone else, the flow will look something like figure 1.2.
main.c
Repository
main.c
Checkout
Client working
copy
main.c
(changed
locally)
Client working
copy
Changes
to file main.c
(new
revision)
Merge and
Save
changes
Repository
Figure 1.1 Workflow in the copy-modify-merge model
Repository
Client working copy
for Alex
main.c
(revision 1)
Client working copy
for Jeff
main.c
(merged from
revision 2 and
local copy)
main.c
(revision 3)
main.c
(changed
locally)
main.c
(changed locally)
main.c
(revision 1)
main.c
(revision 1)
main.c
(revision 2)
Figure 1.2 Workflow in the copy-modify-merge model with multiple users
Licensed to <null>
Understanding version control 5
This merge will happen automatically if the two changes do not conflict, which
would happen if the users made changes to the same line in the file. It is impor-
tant to understand that these conflicts are strictly based on whether or not the sys-
tem can merge the data within the file. There are no logical checks that take place
to ensure that you did not muck up the source code, so you are responsible for
the logical validation of the change.
1.1.4 Commit and update
Version control systems that use the copy-modify-merge model create a working
copy of the repository for you to make your changes. You also need a way to save
your edits back to the repository. The process of applying your changes into the
repository is called committing (some systems call this check in). When you perform
a commit from your working copy, the system will find the files that have changed
and compare them against the latest version in the repository. If there are no con-
flicts, a new revision of the files will be created and saved in the repository. Once
you commit, the repository will be in sync with the changes in your working copy,
but this is only half the battle.
If you develop in a vacuum, the checkout and commit give you everything
needed to keep the repository and working copy in sync, but this does not happen
in the real world. While you were editing your working copy, Alex committed his
changes to the repository. So not only do you need a way to get your changes into
the repository, you need a way to get any changes made to the repository back
into your working copy; this is done with an update. An update is a specialized
checkout that gives you only the changes in the repository since your checkout or
last update.
You know that a commit saves your changes back to the repository, but remem-
ber that there is more to a version control system than just file contents. When the
commit occurs, a record of the change is also saved. This record is called a change
log and is one of the components that gives the answer to those who, when, and
why questions we have been trying to answer.
1.1.5 What are change logs?
One of the reasons for using a version control system is to get more information
about a change than just the content difference in a file between revisions. This
additional information is stored in the change log and is attached to each revision
of a file. Let’s take a look at a typical change for the file main.c in figure 1.3.
Licensed to <null>
6 CHAPTER 1
Introduction
Each revision’s change log for the file main.c has the same set of information and
is ordered by date in descending order. The top line of each change log is the sys-
tem information. The line(s) following the system information is the log message.
This is a description of the change for that revision, which the user adds as part of
the commit. Since the log message is added by the user, the quality of the message
will depend on that developer’s attention to detail.
When developing software for the long term, it is important to be descriptive
when writing the log message. It should be clear to all users why you are making
the change and what the problem and fix are. To see how nondescript messages
can be a problem, look at the following log message:
-----------------------------------------------------------------
r3 | jeff | 2004 -03 -13 13 :46 :28 -0500 (Sat , 13 Mar 2004 ) |1 line
Fixed bug .
-----------------------------------------------------------------
r2 | alex | 2004 -03 -13 10 :45 :56 -0500 (Sat , 13 Mar 2004 ) |2 lines
Added main function .
We only had a program stub to this point
-----------------------------------------------------------------
r1 | jeff | 2004 -03 -06 14 :16 :03 -0500 (Sat , 06 Mar 2004 ) |1 line
Initial Version
----------------------------------------------------------------
Revision number
of the change log
ID of the user who
made the change
Date and time revision was
saved to the repository
Log message entered by the user
when the new revision was created
Number of lines in the
log message
Figure 1.3 Change log information provided by subversion
Licensed to <null>
Understanding version control 7
---------------------------------------------------------------------
r3 | jeff | 2004-03-13 13:46:28 -0500 (Sat, 13 Mar 2004) | 1 line
Bug Fix
---------------------------------------------------------------------
The log message simply says “bug fix.” While this may make sense to the developer
at the time of the change, it will probably not make sense in the future and likely
won’t help other developers who look at it. The only way to get any details about
the change is to look at the content differences between revisions. This can be
tedious and will not always give you the answers you are looking for. Even if you
see the differences in the contents of the file, you still may not know why the
change was made. Instead of just saying “bug fix,” consider using something like
the following message:
---------------------------------------------------------------------
r3 | jeff | 2004-03-13 13:46:28 -0500 (Sat, 13 Mar 2004) | 3 lines
Bug Fix number 2255. The application is supposed to print a message
when it starts. This message did not print because it was directed
to STDERR. Adjusted the startup println statement to STDOUT
---------------------------------------------------------------------
This log message is clear. Now you can easily see what was fixed, which can drasti-
cally cut down your research time. If your development process uses a bug-track-
ing tool, you can include the tracker number in the log message for a quick and
dirty integration. Change logs provide the basic information in a version control
system, but you are not limited to this data. You can add your own customization
and information to a version by using properties.
1.1.6 The role of properties
Today’s version control systems are much more than simple repositories for stor-
ing old versions of source code; they help you manage your development process.
For example, most software you develop will have releases. You will want a way to
associate a particular version of a file, or more likely multiple files, with a particu-
lar release of the entire application. So, for example, you can say that release 2.0
of the application uses revision 10 of the file main.c. In order to accommodate
this, version control systems have something called properties, also known as meta-
data. This is simply some user-defined piece of information that is associated with
a file or revision of a file. If we stick with the analogy of a library, using properties
Licensed to <null>
8 CHAPTER 1
Introduction
to track releases of your software is similar to using a card catalog system. It allows
you to easily track and find your files and see what state they are in.
So using properties, you can assign the name of the application release to a revi-
sion of the file to track the progress through the releases of your software.
Figure 1.4 illustrates how this would look in a version tree for a file called hello.c.
The file hello.c has four revisions in the repository; three are associated with a
particular release of your software. If version 2.0 of the application needs to be
built, revision 4 of hello.c will be used. Versions not associated with a tag are
either just checkpoints for a developer to save his work or not production worthy.
You can use properties for any kind of custom information that is required in your
development process.
1.2 30,000 foot view of Subversion
Now that you have an understanding of what most version control systems pro-
vide, we can better examine what is different about Subversion. Right off the bat,
we know that Subversion uses current open source tools to fill needs that do not
directly deal with version control. The following is a list of the key open source
tools used:
■ Berkeley DB is used for a back end, which provides an efficient storage facil-
ity in terms of speed and memory.
■ The Apache Portable Runtime libraries are used, eliminating the need for
operating system–specific code.
■ The Apache HTTP server is used for the network protocol, which gives
built-in security and web-browsing capabilities.
In addition to utilizing current technologies, Subversion has a few innovations
that give it additional advantages. Let’s look at some of them.
hello.c
Application_1.3 Application_2.0
Rev 4
Rev 3
Rev 2
Application_1.2
Rev 1
Figure 1.4 Tags in the version tree
Licensed to <null>
30,000 foot view of Subversion 9
1.2.1 Atomic commits
“Atomic” means one global change to the repository, no matter how many files
have changed. For example, say you make changes to five different files, instead
of five new files being created in traditional systems, Subversion creates one new
repository with all the changes. There is one revision number and one change log
in an atomic commit, as opposed to one for each file. Don’t worry if this concept
is not crystal clear yet; as you move through the book, it will make sense and the
reasons why this was implemented will become obvious.
1.2.2 Everything is versioned
If you have been in software development for any length of time, you have proba-
bly been in a situation similar to this. You come in to work on a Monday morning
to find your mailbox full of user complaints that a function in your software
doesn’t work anymore, but you haven’t made any changes to the source code in
two weeks. After some probing, you find out that this function gets run only annu-
ally, so the last time it worked was a year ago. Of course, there have been a dozen
releases and patches to the software since last year. In order to see if a code
change broke the function, you will need to travel back in time to re-create the
repository at that point, build the application, and see if the problem exists. This
ability to “go back in time” turns out to be a very powerful feature.
Any version control system can get the file contents back easily enough, but
there may be more to it than that. For instance, what if some files were moved to
different directories? Then you would need to fix the paths in your build scripts.
If you are using tags or labels on the files to determine what was in production,
there is no way track this unless you manually record it somehow. Subversion not
only tracks changes to a file’s contents, it also versions directories and properties,
which allows you to return the repository back to its original state, which consists
of more than just file contents.
1.2.3 The three components of Subversion
Subversion consists of three components: the filesystem, the network, and the cli-
ent. The filesystem component is the Subversion repository that stores the files
and change logs. The client component is the set of libraries and command-line
programs the user will run to access the repository. The network component can
be used if the access to the repository is not local—it acts as an intermediary
between the filesystem and the client. For local access, the client talks directly to
the filesystem. Figure 1.5 shows the coupling points of the components.
Licensed to <null>
10 CHAPTER 1
Introduction
Each component is a standalone module and can be changed out without affect-
ing the other two. So how does this modularity help you? First, it allows you to
access the repository over the network or locally on the host. In addition, this
design provides more third-party and vertical tools to sit on top of Subversion, and
you can easily snap in different network protocols or client interfaces.
1.3 Revision numbers
Subversion has developed a new paradigm for identifying version numbers in a
repository, one that is based on repository commits and not individual file
changes. This is a little different than traditional version control systems, so it may
take some getting used to.
Local Access
Network Access
Network
API
Filesystem
API
Network Protocol
Filesystem
API
Client API
Client Libraries
Network
API
Repository
Figure 1.5 Subversion component coupling points
Licensed to <null>
Revision numbers 11
1.3.1 The old way
In traditional version control systems, each file has its own revision number, which
is an incremental decimal. So the revision numbers for a file would be 1.1, 1.2,
1.3, etc. There will not be any gaps because each time the file is changed, it is
incremented off its own revision number (unless it is manually changed). To see
how this can be a deficiency, consider two files: main.c is at revision 1.2 while
hello.c is at revision 1.1. If a change is made to both files and committed to the
repository, the output of the two logs would look something like this:
File: main.c
head: 1.3
----------------------------
revision 1.3
date: 2004/03/09 18:23:14; author: alex; state: Exp; lines: +3 -0
Added author tags to source files that were missing it
----------------------------
revision 1.2
date: 2004/03/09 18:21:19; author: jeff; state: Exp; lines: +1 -0
Added print statement so we know it started
----------------------------
revision 1.1
date: 2004/03/09 18:16:45; author: jeff; state: Exp;
branches: 1.1.1;
Initial revision
----------------------------
File: hello.c
head: 1.2
----------------------------
revision 1.2
date: 2004/03/09 18:23:14; author: alex; state: Exp; lines: +4 -0
Added author tags to source files that were missing it
----------------------------
revision 1.1
date: 2004/03/09 18:16:45; author: jeff; state: Exp;
branches: 1.1.1;
Initial revision
----------------------------
Since the revision numbers are just sequential, main.c moves to 1.3 and hello.c is
now at 1.2. There is nothing that ties the two revision numbers back to your
change. The only way to tell which versions of files trace back to the same change
is to look at the log file. This is fine if you are comparing files that you are aware
of. What if a change caused your application to go bonkers, and you need to trace
Licensed to <null>
12 CHAPTER 1
Introduction
back to see what has been modified? To see how difficult this can be to trace, look
at how the changes are correlated in the version tree in figure 1.6.
As you can see, it is difficult enough to trace changes with only two files. The
same commit produced revision 1.2 of the file hello.c and revision 1.3 of main.c.
In order to find all the files affected by a change, you will have to look through all
your files for either a time stamp or specific log message. To get around this prob-
lem with most traditional version control systems, you will need to create a label
and attach it to each new file revision. Unless you create a system to tag all previ-
ous revisions of a change, it will be difficult to back out of a change.
1.3.2 Subversion revision numbers
With the atomic commits, Subversion tracks changes using a per-commit
basis, not per-file. Instead of each file maintaining a separate revision num-
ber, Subversion has one global revision number for the repository. The num-
ber starts at 0 when the repository is created and is incremented by a whole
number each time a commit happens. Conceptually, each commit creates a
new copy of the repository with the changes applied. Files that do not
change on a commit simply have identical copies created in the new reposi-
tory, although they are stored more efficiently than a complete copy. Let’s
Added author tags
to source files that
were missing it
Added print
statement so we
know it started
Initial Revision
Rev 1.3
Rev 1.2
Rev 1.1
Rev 1.1
Rev 1.2
main.c
hello.c
Figure 1.6
Version tree with traditional
version numbering
Licensed to <null>
Revision numbers 13
take a look at what the log files would look like in Subversion going through
the steps in the previous example:
File: main.c
--------------------------------------------------------------------
r3 | alex | 2004-03-09 22:32:34 -0500 (Tue, 09 Mar 2004) | 1 line
Added author tags to source files that were missing it
--------------------------------------------------------------------
r2 | jeff | 2004-03-09 22:30:42 -0500 (Tue, 09 Mar 2004) | 1 line
Added print statement so we know it started
--------------------------------------------------------------------
r1 | jeff | 2004-03-09 22:28:18 -0500 (Tue, 09 Mar 2004) | 1 line
Imported Sources
--------------------------------------------------------------------
File: hello.c
--------------------------------------------------------------------
r3 | alex | 2004-03-09 22:32:34 -0500 (Tue, 09 Mar 2004) | 1 line
Added author tags to source files that were missing it
--------------------------------------------------------------------
r1 | jeff | 2004-03-09 22:28:18 -0500 (Tue, 09 Mar 2004) | 1 line
Imported Sources
--------------------------------------------------------------------
What should stand out when you compare the two log histories is that the file
hello.c jumps from revision 1 to revision 3. Many people (including myself)
cringe the first time they see this. Once you stop and think about it, this method
makes more sense. When you commit to the repository, you are applying a set of
common changes. If the revision number for each file is the same, it is easier to
trace and back out if necessary.
This also makes it easier to check out the repository at a specific point. The
reason for the ease is that all changes are at the same level in the version tree, as
figure 1.7 shows.
Unlike the traditional numbering scheme we saw earlier, in Subversion all the
files that were changed by the commit to add the author tags are part of revision 3.
When you check out a specific revision of the repository, you will get the high-
est revision of each file less than or equal to the number specified. So using the
files hello.c and main.c from our previous example, you check out revision 2 of
the repository. Since main.c has a revision 2, you will get that copy. Because
hello.c does not have a revision 2, it will go down to revision 1. Since the commit
is considered to be at a repository basis, the change log information is stored at
the repository level instead of the file level. This means that instead of each file
Licensed to <null>
14 CHAPTER 1
Introduction
revision containing the author, date, and change log, this information is kept only
once in the repository. This actually allows Subversion to be more efficient in
terms of storage. It also allows for easier maintenance; if you need to adjust the
change log, you need to do so in only one place instead of every file.
1.4 Summary
We have discussed concepts such as atomic commits and the copy-modify-merge
model at a high level, but these may not be perfectly clear to you yet. As you read
through this book and explore the commands, these concepts will become sec-
ond nature. Just remember that it will be up to you to keep your working copy in
sync with the repository, with both your changes and those of other developers.
You are now ready to dive into Subversion! Whether you are a novice to
traditional version control systems or a seasoned veteran, the best way to learn
how to use this tool is to walk through the steps as we discuss them. Don’t be
afraid to experiment and try different things. If you create a test repository, the
worst case would be that you blow it away and have to start over. If you are brand
new to version control systems and are feeling a little wary, don’t worry. You can
easily set up and destroy test repositories to get the feel for them. We will go
through Subversion sequentially, starting with creating a repository.
Added author tags
to source files that
were missing it
Added print
statement so we
know it started
Initial Revision
Rev 3 Rev 3
Rev 1
Rev 2
Rev 1
hello.c main.c
Figure 1.7
Version tree with Subversion
revision numbers
Licensed to <null>
15
Getting started
In this chapter
■ Get and install Subversion
■ Get around the command-line interface
■ Create a repository
■ Basic work cycle—getting a file in and
out of Subversion
Licensed to <null>
16 CHAPTER 2
Getting started
Now that you have an understanding of the high-level features of a version control
system, we can start examining the details of Subversion. By the end of this chap-
ter, you will be making changes to your code and saving them to the repository.
While the next two chapters will ease you into working with Subversion, there will
still be a bit of theory thrown in. This is not intended to make you an expert in the
theory behind version control, but it is important that you understand and
become efficient with these concepts. The goal is to make using Subversion sec-
ond nature so it will improve your software development, not hinder it.
2.1 Getting Subversion
Before you can jump into using Subversion, you will have to go out and get it. As its
popularity grows, it is being bundled with other software packages such as Fedora
Linux. Despite this trend, you will be better off going to the Subversion web site
and downloading it. This is a fast-moving application, so a bundled distribution
such as Fedora will likely be outdated by the time you install it. The software can be
downloaded from http://subversion.tigris.com/project_packages.html.
2.1.1 Which package to get?
Subversion has binary distributions for multiple operating systems, including Win-
dows and most flavors of Linux. When given the option, it is usually quicker and
easier to use these, as opposed to building the source code. The install and
dependencies are different for each distribution, but they use the standard install
system for the particular OS. For example, the Red Hat distribution is an RPM
(Red Hat Package Manager) file, FreeBSD uses pkgsrc, and Windows is just an
.exe file. If your operating system does not have a binary package, or you need a
bleeding-edge release, you will have to compile Subversion. While this may take a
little more effort than running an .exe, it is not impossible.
You will also need to choose which release of Subversion is right for you. This is
a decision that will depend on how in-depth you are going to use the tool and
which features and bug fixes come out in new releases. A general rule of thumb is
that if you aren’t sure which version to get, you should use the latest stable release.
The Subversion web site contains change logs for the releases that will tell you
what has been fixed or added. You can look through these logs to see if a particu-
lar version is right for your environment or if it is time to upgrade. It is difficult to
describe in great detail how to navigate through the site because it is constantly
evolving. Once Subversion reaches a maturity level, the web site and distributions
will likely follow.
Licensed to <null>
Getting Subversion 17
Don’t get hung on up on distributions. With all of the different operating systems
and configurations, it is impossible to cover all or even most of the possibilities. If
you are trying to learn Subversion, don’t let getting the correct distribution or
compiling become a roadblock. Most people have access to a Windows or Red Hat
workstation. This is all you need to start using Subversion, and you won’t get frus-
trated and give up because you can’t get it installed.
2.1.2 Installing on Windows
The Windows install of Subversion is more straightforward than that of the other
operating systems. There are no dependencies, and you need to download only
one .exe file. Go to the Downloads link on the web site and select the Win32 dis-
tribution. After you figure out which release fits your needs, find the appropriate
file in the list. The name of the file will be svn-x-x-x-setup.exe, where x-x-x is
the release number. You will not need any of the files with other identifiers such as
dev or pdb in their name. These are for development only.
Once you have identified the file, you can download and execute it. When you
run the program, it will launch a basic Windows installer program. You will get the
standard prompts such as accepting the license agreement and where to install
the application. After you step through all the setup questions, the binaries will be
placed in the target directory. Even though you are provided with a graphical
installer, these are still command-line programs, so they must be run at a Windows
command prompt or another shell such as cygwin. Some graphical tools are being
developed to get around the command line; we’ll discuss these later.
2.1.3 Installing on Linux
We will use Red Hat or Fedora as the Linux distribution to examine using the RPM
binaries, but the process is the same for any version. In any of the Linux distribu-
tions, there are some dependencies you need to worry about, but this is still a rel-
atively painless task. On the Downloads page, select Red Hat Linux, and you will
see a list of the different versions of the OS. Select the appropriate one, and a
page with a number of RPMs will open. For a normal install you will need the fol-
lowing packages, which need to be installed in the order listed:
■ apr-x-x-x...rpm—Apache portable runtime libraries
■ neon-x-x-x..rpm—DAV protocol libraries
■ subversion-x-x-x.rpm—Subversion client
■ subversion-server-x-x-x.rpm—Binaries to run the Subversion server
Licensed to <null>
18 CHAPTER 2
Getting started
Each of the packages will have a version number appended after the filename. You
must also be careful not to get the “dev” RPMs. These will have the same filename
except they contain the word dev in between the base name and the revision num-
ber. Also, you will need only the server package if the repository needs to be accessed
over the network. You can just use the default rpm install command. If your oper-
ating system is missing any dependencies, the install will notify you. You will find
some of these package in the same location where you downloaded Subversion, so
that is a good place to start looking should the need arise.
2.1.4 Subversion is installed; what now?
Unless you are accessing Subversion over the network protocol (we will discuss
this setup in chapter 7), there is nothing else you need to do. There is no service
or daemon that needs to run; all the access is done through clients accessing the
repository layer. To see if everything is working correctly, you can run the svn cli-
ent with the --version option:
$ svn --version
svn, version 1.1.0 (Release Candidate 1)
compiled Aug 6 2004, 21:01:15
Copyright (C) 2000-2004 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/
).
The following repository access (RA) modules are available:
* ra_dav : Module for accessing a repository via WebDAV (DeltaV) protocol.
- handles 'http' schema
- handles 'https' schema
* ra_local : Module for accessing a repository on local disk.
- handles 'file' schema
* ra_svn : Module for accessing a repository using the svn network protocol.
- handles 'svn' schema
This will tell you which version of Subversion you have, plus which modules are
installed. You should see the three modules listed above, unless you skipped the
Apache server package. If one of the modules is missing, you cannot access your
repository using that method. For example, if ra_dav is not listed, you will not be
able to set up the repository using the Apache HTTP protocol.
Licensed to <null>
Command-line interface 19
2.2 Command-line interface
Subversion comes with a set of command-line interfaces called clients, which are used
to perform all of the tasks. Unless you have a third-party tool to provide the interface
to Subversion commands (we will talk about these in chapter 10), these clients will be
the way you interact with the version control system. As a result, it is important to
understand how these work and how to get around them, in addition to the concepts
behind them. For example, consider an application such as Word. You may know that
you want to underline a section of text, but if you do not know how to get around the
GUI, you will have trouble using the tool. The same holds true for Subversion; you
know that you need to commit to the repository, but if you don’t understand the syn-
tax, this simple process will be more complicated. This section will guide you through
the clients in Subversion, so that you can use the tool more proficiently.
There are three Subversion command-line interfaces, each with a different pur-
pose; we’ll describe these in the next section. They are simply executable com-
mands; you pass in the operations (subcommand) and the specific options for that
command. This is the same for Windows and UNIX-based operating systems. All the
executables will reside in the $SUBVERSION/bin directory; if you set up your PATH
environment variable as described in the previous section, you will be able to run
these commands without specifying the entire path. While the clients will allow you
interchange the order of the subcommands and options, for clarity you should use
the following syntax: client_name <subcommand> [options] [arguments].
2.2.1 Different clients
Subversion provides multiple interfaces for different uses. This allows for a clear
separation of tasks between users and administrators.
User client. The svn client makes up the bulk of Subversion; this is what the users
will run to perform the actual version control commands. This interface was
made to feel like CVS where possible to provide an easy transition for those who
are new to Subversion.
Administrator client. Subversion provides a separate client called svnadmin for per-
forming administrative and maintenance functions on the repository. Having this cli-
ent provides a clear separation of duties in Subversion, keeping the user client cleaner
and easier to use, in addition to facilitating better security. Since the administrator cli-
ent works on the repository, it must be run on the local repository machine, not over a
network. As a result, all arguments referencing a repository are in the PATH format,
not URL. See section 2.2.3 for more information on PATH and URL.
Licensed to <null>
20 CHAPTER 2
Getting started
Browser client. The svnlook client is a tool that will browse a repository without
making any changes. It has many of the information-gathering commands of the
user client such as diff, cat, and history. We will see how these commands work
in the user client over the next few chapters. When we discuss repository adminis-
tration, these commands will be examined from the point of view of the svnlook
client. This client is good for use in trigger or hook scripts to collect information
on the repository. Just like the svnadmin client, this client is run on the reposi-
tory host, so it accesses the repository via PATH and not URL.
2.2.2 Getting help
While all the clients provide different operations, they all parse the command-line
input the same way. The first thing to note is the help for each of the clients. The
help provided by the clients is a good reference, but that is usually the extent of
the information provided. Running a client with help as an argument will list all
available subcommands for that client. To get additional help on a specific sub-
command, simply pass that subcommand as an argument. For example, let’s look
at the help for the checkout command:
$ svn help checkout
checkout (co): Check out a working copy from a repository.
usage: checkout URL... [PATH]
Note: If PATH is omitted, the basename of the URL will be used as
the destination. If multiple URLs are given each will be checked
out into a sub-directory of PATH, with the name of the sub-directory
being the basename of the URL.
Valid options:
-r [--revision] arg :ARG (some commands also take ARG1:ARG2 range)
A revision argument can be one of:
NUMBER revision number
"{" DATE "}" revision at start of the date
"HEAD" latest in repository
"BASE" base rev of item's working copy
"COMMITTED" last commit at or before BASE
"PREV" revision just before COMMITTED
-q [--quiet] : print as little as possible
-N [--non-recursive] : operate on single directory only
--username arg : specify a username ARG
--password arg : specify a password ARG
--no-auth-cache : do not cache authentication tokens
--non-interactive : do no interactive prompting
--config-dir arg : read user configuration files from directory ARG
Licensed to <null>
Command-line interface 21
There are a few things to understand about the syntax that will help you use Sub-
version effectively. First, notice the description line, specifically the text in the
parentheses. Many of Subversion’s commands will have multiple names; in the
case of the checkout command, it has one alias, co. While this may seem confusing
at first, many users prefer the shorthand or, in some cases, a “backward compati-
bility” feel for other version control systems such as CVS. Next, it is worthwhile to
understand the usage notation if you are not familiar with it already. The usage
will specify which options and arguments the command will be expecting for
input. When an option or argument is enclosed in brackets, it indicates that this
not required. In most cases for optional arguments, the help will tell you what the
default behavior for the command will be. As you can see from the checkout help,
if you omit the PATH argument, it will be substituted with the base name from the
URL. Figure 2.1 shows an example of a Subversion command line and the differ-
ent componentsIt is important to understand what the default values are for
optional arguments so you know what is going to be affected by the command.
Finally, all the possible options for the command are listed.
2.2.3 Paths and URLs
Throughout Subversion, you will see the different notations for referring to loca-
tions in a directory or repository. The two will we will focus on now are PATH and
URL; other administrative commands have other notations and will be addressed
later. A PATH is simply a standard operating system directory. This notation is used
for performing operations on working copy files and also for accessing the reposi-
tory with the administrative client on the local machine. The second notation is
URL, which is used when referring to a repository. Just like accessing a web site, a
svn cat -- revision 25 /home/jeff/myrepo/source/c/hello.c
client
subcommand
optional argument required argument
Figure 2.1 Command-line syntax
Licensed to <null>
22 CHAPTER 2
Getting started
Subversion URL is a protocol followed by a path with the following notation: pro-
tocol:///absolute/path. Depending on how you access your repository, you will
use one of the protocols described in table 2.1.
For example, if you are accessing a repository on the local system in the directory
/repos/testrepo, your URL would be file:///repos/testrepo. If the local host-
name is Pluto and you are accessing the same repository over the network, it
would look something like the following URL: http://pluto.domain.com/repos/
testrepo.
2.3 Creating a repository
Before you can start working with Subversion, you need a repository. If you have
access to an existing one, great; if this is not the case, don’t worry. Creating a
repository is a surprisingly simple task in Subversion once you understand the
basics of permissions and where the repository should be located. When you cre-
ate a repository, all of the databases and configurations will be set up for you. Also,
if you are creating one just for trying out some of the commands and concepts we
will be discussing, getting the permissions and details is not critical. Once you are
ready to create a production repository, the specifics we will be talking about
come into play.
2.3.1 Finding a location for the repository
The first step to creating a repository is finding a place for it to reside. All reposi-
tories reside on local filesystems; they can be accessed locally or over one of the
Table 2.1 Repository access protocols
Protocol Description Authentication Port
http Uses the http protocol to access an Apache web server
with WEBDav/DeltaV pointing to the Subversion repository
filesystem
Yes 80
file Accesses a local filesystem No NA
svn Uses the custom Subversion protocol Yes 3690
https Uses the https (http + SSL encryption) protocol to
access an Apache web server with WEBDav/DeltaV point-
ing to the Subversion repository filesystem
Yes 443
svn+ssh Uses the custom Subversion protocol but with SSH Yes 3690
Licensed to <null>
Creating a repository 23
network protocols listed in table 2.1. Repositories can be created anywhere on the
local host with one exception; they should not be created or accessed on directo-
ries that are shared, including Windows shares, NFS, and Samba. You may be
tempted to try this, thinking that you can use the local filesystem access URL
(file://) and just mount it on a network share. Remember, Subversion uses Ber-
keley DB as the filesystem store; the way locking works in the database does not
support access over a shared filesystem. If you try this, it may appear to work, but
you will get unpredictable results and eventually put your repository in a bad
state. If you need to access the repository over the network, you can use one of the
protocols provided. Information to set these up can be found in chapter 7; for
now we will use just local filesystem access.
Be sure the directory you use has enough space for the source code plus the
back end. Subversion is a very efficient version control system in terms of disk
space, but the size of the repository will be bigger than just the files you are load-
ing. The size will depend on factors such as the number of changes, metadata
attached to the files, and how your logging is set up. Unfortunately, there is no
formula you can use to determine the amount of space needed. As you add con-
tent to the files and change logs, the filesystem will grow. The good news is that
this will grow by only the size of the change, so it is more efficient than storing
entire copies of files. Once you know where you want your repository, you will
need to create the subdirectory for it. There is no standard or rule to the naming
of the repository path. From here on, we will use /repos as the directory all Sub-
version repositories will be placed in. If you want your repository to be called
testrepo, simply create the subdirectory /repos/testrepo.
2.3.2 Permissions
The method or protocol you use to access your repository will guide you in how
the permissions will be set up for the Berkeley DB filesystem. While the examples
will be in a Linux environment, the same concepts apply to a repository on a Win-
dows machine. No matter if your users access the repository from the local
machine or one of the network protocols, you should have the directory owned by
a “system” user. You may want to create a user and a group called svn, or some
derivative of that. This user should create all the repositories. You can also use this
ID to perform administrative tasks on the repository. Even if there are only one or
two users on a system, you should stick to this practice. If you keep the owner and
administrator of the repository separate from the day-to-day users, the risk of caus-
ing problems will be greatly decreased. Just as in a UNIX environment, you should
not do your work as root.
Licensed to <null>
24 CHAPTER 2
Getting started
Permissions for network accessed repositories. When setting up permissions for a
network repository, you have two options. The first option is to simply add the net-
work user to the group that owns the repository. You would pursue this option in
an environment where you access the repository over the network and locally.
This is perfectly legitimate and can be used when security does not need to be
extremely tight. The second option is to have one user with the permissions to
access the repository at a filesystem level. This user would be the same ID that runs
the Apache or svnserve process. Thus, the directory permissions would look the
same as the previous listing, but the only user in the svn group would be the
apache user, for example. This will prevent users on the repository machine from
having the ability to directly write to the DB files.
UNIX users—Check your mask. No matter whether you connect to the repository
locally or over a network protocol, it is critical to make sure the umask of the user
is set correctly. Users, through the client interfaces, will create files in the Berkeley
DB while working in Subversion. If the umask is set improperly, the files will be
created with the wrong permissions. When other users try to access these files,
they will get permission-denied errors. At a minimum, the umask should be set to
002. This goes not only for local users but also for the ID running the network ser-
vice. You may have to set the umask for a network user in the startup script to be
sure it is correct. This can easily be done in the Apache configuration file for the
case of one network user. If users are accessing the repository locally, you will
need to set all their umasks. If this is a security issue, you will have to write a wrap-
per script to svn that sets the umask and then calls the real svn command. For
example, the following simple script will accomplish this for you:
#!/bin/bash
umask 002
/usr/local/bin/svn $*
Assuming Subversion has been installed in /usr/local/bin, this simple wrapper
will change the umask for the duration of the script and then call the real svn
command with the same parameters passed into it.
2.3.3 Svnadmin create
Once you have determined the location for your repository, the actual creation is
extremely simple. The Subversion admin interface has a utility called create. This
command is run locally from the machine on which the repository will reside. All
it requires for an argument is the path to the repository directory:
$ svnadmin create /repos/testrepo
Licensed to <null>
Creating a repository 25
Congratulations, you have just created a Subversion repository! That’s all there is
to it. This will take only a few seconds and then return you right to the command
prompt. There are not many options that can be used with the create operation.
The few that do exist are advanced and do not need to be addressed now.
2.3.4 Internal repository directories and files
If you are curious and look in the /repos/testrepo directory, you will see a bunch
of subdirectories. Table 2.2 briefly describes the files and directories in the reposi-
tory directory. Most users will not have to work in these directories, especially if
you are not sure about what they do. When we discuss advanced topics such as
repository configuration and maintenance, we’ll explain the use of these directo-
ries. Out of the box, Subversion provides a robust implementation that will pre-
vent the need for accessing these areas.
Permissions for locally accessed repositories. For repositories accessed on the local
machine, you will use the operating system group permissions to control authori-
zation. The easiest way to do this is simply add the users who need access to the
repository to the svn group you created previously. Make sure that the repository
directory is recursively in this group and the group write permissions are turned
on. Your listing should look like the following:
$ ls -ltr
total 28
-rwxrwxr-x 1 svn svn 376 Mar 23 20:52 README.txt
Table 2.2 Repository directories and files
Name Description
README.txt A brief text file that indicates the directory is a Subversion repository and where
some of the configuration files are located
conf Directory containing configuration files for services such as the svnserve daemon
dav Working area for the mod_dav_svn module for Apache HTTP server and WebDav /
DeltaV protocols
db The location of the Berkeley DB filesystem implementation
format The file containing the Subversion filesystem layout
hooks Directory to store all the hook or trigger scripts
locks Special Berkeley DB directory to lock the back end for recovery or maintenance
processes
Licensed to <null>
26 CHAPTER 2
Getting started
drwxrwxr-x 2 svn svn 4096 Mar 23 20:52 locks
drwxrwxr-x 2 svn svn 4096 Mar 23 20:52 hooks
-rw-rw-r-- 1 svn svn 2 Mar 23 20:52 format
drwxrwxr-x 2 svn svn 4096 Mar 23 20:52 dav
drwxrwxr-x 2 svn svn 4096 Mar 23 20:52 conf
drwxrwxr-x 2 svn svn 4096 Mar 23 21:36 db
While not all of the directories need to have group write, the one to worry about is
db. If this directory is not set up correctly, users will be unable to check out or
commit to the repository. If you have some experience with system administra-
tion, you will probably see a glaring hole in this: users will have the ability to write
to these files. Depending on your user base, this may or may not be a problem. If
this security setup is too loose for you, you can have your users access the reposi-
tory through a network protocol and lock down the permissions more.
2.4 Common options
Now that you have your new repository, you are almost ready to jump in, but not
quite yet. Before you start looking at the Subversion commands, it is a good idea to
understand some of the common options and default behaviors. Since the client
interfaces are a set of command-line executables, these common options are simply
arguments passed into the command. This is no different than an OS command
option, such as -l for the ls command. The common options we will talk about next
are available in multiple commands in Subversion. An option will have the same
behavior no matter what command it is in. For example, the --username option will
pass in an ID and is available on the commit, update, and other commands.
2.4.1 Recursion
When you run a command that can operate on multiple files, by default it will
recursively parse through the subdirectories. This will depend on what you use for
an argument to the command: a file or a directory. If the argument is a file, then
only that file will be processed by the command. If you pass in a directory, the
command will process every file and directory under that. For example, consider
the directory structure in figure 2.2. If you start the add command at the directory
/home/jeff/testrepo/source, you will get everything under the java and c direc-
tories. While this may not seem that important in this example, consider a tree
with hundreds of directories, five and six levels deep, without having recursion.
You would need to write a script to add these files.
While recursion can be a great feature, there are times when you want to oper-
ate at only a single level. In our previous example, maybe you want to add only the
Licensed to <null>
Common options 27
files in the /home/jeff/testrepos/source directory
without going down multiple levels. In this case,
Subversion commands that use recursion have a
switch called --non-recursive. This tells the com-
mand to operate only on files at the same level in
the directory tree as the target. So in the previous
directory tree, the command would operate on the
directories c and java and the file config.txt.
Nothing will be done to the files under the java
and c directories. As you will see in later chapters,
there are a few exceptions where commands will
operate nonrecursively by default, and you will
need to instruct Subversion to be recursive.
2.4.2 Entering the log message
Any command that writes to the repository requires a
log message to be submitted. This can be done auto-
matically through command-line options or manu-
ally through an editor. In chapter 1, you saw the
importance of entering a detailed log message. You
should keep this in mind when determining how the
message will be entered into a command. There are
two general ways of entering a message: on a com-
mand line or through an editor. With the command
line, you give the command either the text or the
location of the text to use. If you do not specify this
on the command line, Subversion will spawn a text
editor, and you will enter the message there.
Entering the log message on the command line.
There are two ways to enter the log message on the command line; the first is with
the --message option. This option takes a string encapsulated in quotes as a
parameter, which is the actual message:
$ svn commit --message "This is the log message"
The command line is a good tool if you are automating a process in a script and
do not have a way to manually enter a message. It can also be used for messages
that are short and that you want to quickly enter without having to run them
through an editor. Finally, this is a good workaround if you cannot start an editor
source
Java
main.c
hello.c
main.java
hello.java
config.txt
C
Figure 2.2 Example directory tree
Licensed to <null>
Exploring the Variety of Random
Documents with Different Content
The Fairy Rade.
The Fairy Rade, or procession, was a matter of great importance. It
took place on the coming in of summer, and the peasantry, by using the
precaution of placing a branch of rowan over their door, might safely
gaze on the cavalcade, as with music sounding, bridles ringing, and
voices mingling, it pursued its way from place to place. An old woman
of Nithsdale gave the following description of one of these processions:
"In the night afore Roodmass I had trysted with a neebor lass a Scots
mile frae hame to talk anent buying braws i' the fair. We had nae sutten
lang aneath the haw-buss till we heard the loud laugh of fowk riding,
wi' the jingling o' bridles, and the clanking o' hoofs. We banged up,
thinking they wad ride owre us. We kent nae but it was drunken fowk
ridin' to the fair i' the forenight. We glowred roun' and roun', and sune
saw it was the Fairie-fowks Rade. We cowred down till they passed by.
A beam o' light was dancing owre them mair bonnie than moonshine:
they were a' wee wee fowk wi' green scarfs on, but ane that rade
foremost, and that ane was a good deal larger than the lave wi' bonnie
lang hair, bun' about wi' a strap whilk glinted like stars. They rade on
braw wee white naigs, wi' unco lang swooping tails, an' manes hung wi'
whustles that the win' played on. This an' their tongue when they sang
was like the soun' o' a far awa psalm. Marion an' me was in a brade lea
fiel', where they came by us; a high hedge o' haw-trees keepit them
frae gaun through Johnnie Corrie's corn, but they lap a' owre it like
sparrows, and gallopt into a green know beyont it. We gaed i' the
morning to look at the treddit corn; but the fient a hoof mark was
there, nor a blade broken."
The Changeling.
But the Fairies of Scotland were not, even according to Mr. Cromek,
uniformly benevolent. Woman and child abstraction was by no means
uncommon with them, and the substitutes they provided were, in
general, but little attractive.
A fine child at Caerlaveroc, in Nithsdale, was observed on the second
day after its birth, and before it was baptised, to have become quite ill-
favoured and deformed. Its yelling every night deprived the whole
family of rest; it bit and tore its mother's breasts, and would lie still
neither in the cradle nor the arms. The mother being one day obliged to
go from home, left it in charge of the servant girl. The poor lass was
sitting bemoaning herself—"Were it nae for thy girning face, I would
knock the big, winnow the corn, and grun the meal."—"Lowse the
cradle-band," said the child, "and tent the neighbours, and I'll work yere
work." Up he started—the wind arose—the corn was chopped—the
outlyers were foddered—the hand-mill moved around, as by instinct—
and the knocking-mill did its work with amazing rapidity. The lass and
child then rested and diverted themselves, till, on the approach of the
mistress, it was restored to the cradle, and renewed its cries. The girl
took the first opportunity of telling the adventure to her mistress.
"What'll we do with the wee diel?" said she. "I'll work it a pirn," replied
the lass. At midnight the chimney-top was covered up, and every chink
and cranny stopped. The fire was blown till it was glowing hot, and the
maid speedily undressed the child, and tossed him on the burning coals.
He shrieked and yelled in the most dreadful manner, and in an instant
the Fairies were heard moaning on every side, and rattling at the
windows, door, and chimney. "In the name of God bring back the
bairn," cried the lass. The window flew up, the real child was laid on the
mother's lap, and the wee diel flew up the chimney laughing.
Departure of the Fairies.
On a Sabbath morning, all the inmates of a little hamlet had gone to
church, except a herd-boy, and a little girl, his sister, who were lounging
beside one of the cottages, when just as the shadow of the garden-dial
had fallen on the line of noon, they saw a long cavalcade ascending out
of the ravine, through the wooded hollow. It winded among the knolls
and bushes, and turning round the northern gable of the cottage,
beside which the sole spectators of the scene were stationed, began to
ascend the eminence towards the south. The horses were shaggy
diminutive things, speckled dun and grey; the riders stunted, misgrown,
ugly creatures, attired in antique jerkins of plaid, long grey clokes, and
little red caps, from under which their wild uncombed locks shot out
over their cheeks and foreheads. The boy and his sister stood gazing in
utter dismay and astonishment, as rider after rider, each more uncouth
and dwarfish than the other which had preceded it, passed the cottage
and disappeared among the brushwood, which at that period covered
the hill, until at length the entire rout, except the last rider, who
lingered a few yards behind the others, had gone by. "What are you,
little manie? and where are ye going?" inquired the boy, his curiosity
getting the better of his fears and his prudence. "Not of the race of
Adam," said the creature, turning for a moment in its saddle, "the
people of peace shall never more be seen in Scotland."[421]
The Brownie.
The Nis, Kobold, or Goblin, appears in Scotland under the name of
Brownie.[422] Brownie is a personage of small stature, wrinkled visage,
covered with short curly brown hair, and wearing a brown mantle and
hood. His residence is the hollow of an old tree, a ruined castle, or the
abode of man. He is attached to particular families, with whom he has
been known to reside, even for centuries, threshing the corn, cleaning
the house, and doing everything done by his northern and English
brethren. He is, to a certain degree, disinterested; like many great
personages, he is shocked at anything approaching to the name of a
bribe or douceur, yet, like them, allows his scruples to be overcome if
the thing be done in a genteel, delicate, and secret way. Thus, offer
Brownie a piece of bread, a cup of drink, or a new coat and hood, and
he flouted at it, and perhaps, in his huff, quitted the place for ever; but
leave a nice bowl of cream, and some fresh honeycomb, in a snug
private corner, and they soon disappeared, though Brownie, it was to be
supposed, never knew anything of them.
A good woman had just made a web of linsey-woolsey, and, prompted
by her good nature, had manufactured from it a snug mantle and hood
for her little Brownie. Not content with laying the gift in one of his
favourite spots, she indiscreetly called to tell him it was there. This was
too direct, and Brownie quitted the place, crying,
A new mantle and a new hood;
Poor Brownie! ye'll ne'er do mair gude!
Another version of this legend says, that the gudeman of a farm-house
in the parish of Glendevon having left out some clothes one night for
Brownie, he was heard to depart, saying,
Gie Brownie coat, gie Brownie sark,
Ye'se get nae mair o' Brownie's wark![423]
At Leithin-hall, in Dumfrieshire, a Brownie had dwelt, as he himself
declared, for three hundred years. He used to show himself but once to
each master; to other persons he rarely discovered more than his hand.
One master was greatly beloved by Brownie, who on his death
bemoaned him exceedingly, even abstaining from food for many
successive days. The heir returning from foreign parts to take
possession of the estate, Brownie appeared to do him homage, but the
Laird, offended at his mean, starved appearance, ordered him meat and
drink, and new livery. Brownie departed, loudly crying,
Ca', cuttee, ca'!
A' the luck of Leithin Ha'
Gangs wi' me to Bodsbeck Ha'.
In a few years Leithin Ha' was in ruins, and "bonnie Bodsbeck"
flourishing beneath the care of Brownie.
Others say that it was the gudeman of Bodsbeck that offended the
Brownie by leaving out for him a mess of bread and milk, and that he
went away, saying,
Ca, Brownie, ca',
A' the luck of Bodsbeck awa to Leithenha'.
Brownie was not without some roguery in his composition. Two lasses
having made a fine bowlful of buttered brose, had taken it into the byre
to sup in the dark. In their haste they brought but one spoon, so,
placing the bowl between them, they supped by turns. "I hae got but
three sups," cried the one, "and it's a' dune."—"It's a' dune, indeed,"
cried the other.—"Ha, ha, ha!" cried a third voice, "Brownie has got the
maist o' it."—And Brownie it was who had placed himself between
them, and gotten two sups for their one.
The following story will remind the reader of Hinzelmann. A Brownie
once lived with Maxwell, Laird of Dalswinton, and was particularly
attached to the Laird's daughter, the comeliest lass in all the holms of
Nithsdale. In all her love affairs Brownie was her confidant and
assistant; when she was married, it was Brownie who undressed her for
the bridal bed; and when a mother's pains first seized her, and a
servant, who was ordered to go fetch the cannie wife, who lived on the
other side of the Nith, was slow in getting himself ready, Brownie,
though it was one of dark December's stormy nights, and the wind was
howling through the trees, wrapped his lady's fur cloak about him,
mounted the servant's horse, and dashed through the waves of the
foaming Nith. He went to the cannie wife, got her up behind him, and,
to her terror and dismay, plunged again into the torrent. "Ride nae by
the auld pool," said she, "lest we suld meet wi' Brownie." "Fear nae,
dame," replied he, "ye've met a' the Brownies ye will meet." He set her
down at the hall steps, and went to the stable. There finding the lad,
whose embassy he had discharged, but drawing on his boots, he took
off the bridle, and by its vigorous application instilled into the memory
of the loitering loon the importance of dispatch. This was just at the
time of the Reformation, and a zealous minister advised the Laird to
have him baptised. The Laird consented, and the worthy minister hid
himself in the barn. When Brownie was beginning his night's work, the
man of God flung the holy water in his face, repeating at the same time
the form of baptism. The terrified Brownie gave a yell of dismay, and
disappeared for ever.
Another name by which the domestic spirit was known in some parts of
Scotland was Shellycoat, of which the origin is uncertain.[424]
Scotland has also its water-spirit, called Kelpie, who in some respects
corresponds with the Neck of the northern nations. "Every lake," says
Graham,[425] "has its Kelpie, or Water-horse, often seen by the
shepherd, as he sat in a summer's evening upon the brow of a rock,
dashing along the surface of the deep, or browsing on the pasture-
ground upon its verge. Often did this malignant genius of the waters
allure women and children to his subaqueous haunts, there to be
immediately devoured. Often did he also swell the torrent or lake
beyond its usual limits, to overwhelm the hapless traveller in the flood."
[426]
We have now gone through nearly the whole of the Gotho-German
race, and everywhere have found their fairy system the same—a proof,
we conceive, of the truth of the position of its being deeply founded in
the religious system originally common to the whole race. We now
proceed to another, and, perhaps, an older European family, the Celts.
CELTS AND CYMRY.
There every herd by sad experience knows,
How winged with fate their elf-shot arrows fly;
When the sick ewe her summer-food foregoes,
Or, stretched on earth, the heart-smit heifers lie.
Collins.
Under the former of these appellations we include the inhabitants of
Ireland, the Highlands of Scotland, and the Isle of Man; under the latter,
the people of Wales and Brittany. It is, not, however, by any means
meant to be asserted that there is in any of these places to be found a
purely Celtic or Cymric population. The more powerful Gotho-German
race has, every where that they have encountered them, beaten the
Celts and Cymry, and intermingled with them, influencing their
manners, language, and religion.
Our knowledge of the original religion of this race is very limited, chiefly
confined to what the Roman writers have transmitted to us, and the
remaining poems of the Welsh bards. Its character appears to have
been massive, simple, and sublime, and less given to personification
than those of the more eastern nations. The wild and the plastic powers
of nature never seem in it to have assumed the semblance of huge
giants and ingenious dwarfs.
Yet in the popular creed of all these tribes, we meet at the present day
beings exactly corresponding to the Dwarfs and Fairies of the Gotho-
German nations. Of these beings there is no mention in any works—
such as the Welsh Poems, and Mabinogion, the Poems of Ossian, or the
different Irish poems and romances—which can by any possibility lay
claim to an antiquity anterior to the conquests of the Northmen. Is it
not then a reasonable supposition that the Picts, Saxons, and other
sons of the North, brought with them their Dwarfs and Kobolds, and
communicated the knowledge of, and belief in, them to their Celtic and
Cymric subjects and neighbours? Proceeding on this theory, we have
placed the Celts and Cymry next to and after the Gotho-German
nations, though they are perhaps their precursors in Europe.
IRELAND.
Like him, the Sprite,
Whom maids by night
Oft meet in glen that's haunted.
Moore.
We commence our survey of the lands of Celts and Cymry with Ireland,
as being the first in point of importance, but still more as being the land
of our birth. It is pleasing to us, now in the autumn of our life, to return
in imagination to where we passed its spring—its most happy spring. As
we read and meditate, its mountains and its vales, its verdant fields and
lucid streams, objects on which we probably never again shall gaze, rise
up in their primal freshness and beauty before us, and we are once
more present, buoyant with youth, in the scenes where we first heard
the fairy-legends of which we are now to treat. Even the forms of the
individual peasants who are associated with them in our memory, rise
as it were from their humble resting-places and appear before us, again
awaking our sympathies; for, we will boldly assert it, the Irish peasantry,
with all their faults, gain a faster hold on the affections than the
peasantry of any other country. We speak, however, particularly of them
as they were in our county and in our younger days; for we fear that
they are somewhat changed, and not for the better. But our present
business is with the Irish fairies rather than with the Irish people.
The fairies of Ireland can hardly be said to differ in any respect from
those of England and Scotland. Like them they are of diminutive size,
rarely exceeding two feet in height; they live also in society, their
ordinary abode being the interior of the mounds, called in Irish, Raths
(Râhs), in English, Moats, the construction of which is, by the
peasantry, ascribed to the Danes from whom, it might thence perhaps
be inferred, the Irish got their fairies direct and not viâ England. From
these abodes they are at times seen to issue mounted on diminutive
steeds, in order to take at night the diversion of the chase. Their usual
attire is green with red caps.[427] They are fond of music, but we do not
in general hear much of their dancing, perhaps because on account of
the infrequency of thunder, the fairy-rings are less numerous in Ireland
than elsewhere. Though the fairies steal children and strike people with
paralysis and other ailments (which is called being fairy-struck), and
shoot their elf-arrows at the cattle, they are in general kind to those for
whom they have contracted a liking, and often render them essential
service in time of need. They can make themselves visible and invisible,
and assume any forms they please. The pretty tiny conical mushrooms
which grow so abundantly in Ireland are called Fairy-mushrooms; a kind
of nice regularly-formed grass is named Fairy-flax, and the bells of the
foxglove called in some places Fairy-bells, are also said to have some
connexion with the Little People.
The popular belief in Ireland also is, that the Fairies are a portion of the
fallen angels, who, being less guilty than the rest, were not driven to
hell, but were suffered to dwell on earth. They are supposed to be very
uneasy respecting their condition after the final judgement.
The only names by which they are known in those parts of Ireland in
which the English language is spoken are, Fairies, the Good People,[428]
and the Gentry, these last terms being placatory, like the Greek
Eumenides. When, for example, the peasant sees a cloud of dust
sweeping along the road, he raises his hat and says, "God speed you,
gentlemen!" for it is the popular belief that it is in these cloudy vehicles
that the Good People journey from one place to another.[429] The Irish
language has several names for the fairies; all however are forms or
derivations of the word Shia,[430] the proper meaning of which seems
to be Spirit. The most usual name employed by the Munster peasantry
is Shifra; we are not acquainted with the fairy-belief and terminology of
the inhabitants of Connemara and the other wilds of Connaught.[431]
Most of the traits and legends of the Irish fairies are contained in the
Fairy Legends and Traditions of the South of Ireland, compiled by Mr.
Crofton Croker. As we ourselves aided in that work we must inform the
reader that our contributions, both in text and notes, contain only
Leinster ideas and traditions, for that was the only province with which
we were acquainted. We must make the further confession, that some
of the more poetic traits which MM. Grimm, in the Introduction to their
translation of this work, give as characteristic of the Irish fairies, owe
their origin to the fancy of the writers, who were, in many cases, more
anxious to produce amusing tales than to transmit legends faithfully.
The Legend of Knockshegowna (Hill of the Fairy-calf) the first given in
that work, relates how the fairies used to torment the cattle and
herdsmen for intruding on one of their favourite places of resort which
was on this hill. The fairy-queen, it says, having failed in her attempts
to daunt a drunken piper who had undertaken the charge of the cattle,
at last turned herself into a calf, and, with the piper on her back,
jumped over the Shannon, ten miles off, and back again. Pleased with
his courage, she agreed to abandon the hill for the future.
The Legend of Knock-Grafton tells how a little hunchback, while sitting
to rest at nightfall at the side of a Rath or Moat, heard the fairies within
singing over and over again, Da Luan, Da Mart! (i.e., Monday, Tuesday!)
and added, weary with the monotony, Agus da Cadin! (i.e., and
Wednesday!) The fairies were so delighted with this addition to their
song that they brought him into the Moat, entertained him, and finally
freed him from the incumbrance of his hump. Another hunchback
hearing the story went to the Moat to try if he could meet with the
same good fortune. He heard the fairies singing the amended version of
the song, and, anxious to contribute, without waiting for a pause or
attending to the rhythm or melody, he added Agus da Hena! (i.e., and
Friday.)[432] His reward was, being carried into the Moat, and having his
predecessor's hump placed on his back in addition to his own.[433]
In the story named the Priest's Supper, a fisherman, at the request of
the fairies, asks a priest who had stopt at his house, whether they
would be saved or not at the last day. The priest desired him to tell
them to come themselves and put the question to him, but this they
declined doing, and the question remained undecided.
The next three stories are of changelings. The Young Piper, one of our
own contributions, will be found in the Appendix. The Changeling has
nothing peculiar in it; but the Brewery of Eggshells is one which we find
in many places, even in Brittany and Auvergne. In the present version,
the mother puts down eggshells to boil, and to the enquiry of the
changeling she tells him that she is brewing them, and clapping his
hands he says, "Well! I'm fifteen hundred years in the world, and I
never saw a brewery of eggshells before!"
In the Capture of Bridget Purcel, a girl is struck with a little switch
between the shoulders, by something in the form of a little child that
came suddenly behind her, and she pined away and died.
The Legend of Bottle Hill gives the origin of that name, which was as
follows. A poor man was driving his only cow to Cork to sell her. As he
was going over that hill he was suddenly joined by a strange-looking
little old man with a pale withered face and red eyes, to whom he was
eventually induced to give his cow in exchange for a bottle, and both
cow and purchaser then disappeared. When the poor man came home
he followed the directions of the stranger, and spreading a cloth on the
table, and placing the bottle on the ground, he said, "Bottle, do your
duty!" and immediately two little beings rose out of it, and having
covered the table with food in gold and silver dishes, went down again
into the bottle and vanished. By selling these he got a good deal of
money and became rich for one in his station. The secret of his bottle
however transpired, and his landlord induced him to sell it to him. But
his prosperity vanished with it, and he was again reduced to one cow,
and obliged to drive her to Cork for sale. As he journeyed over the
same hill he met the same old man, and sold him the cow for another
bottle. Having made the usual preparations, he laid it on the ground
and said, "Bottle, do your duty!" but instead of the tiny little lads with
their gold and silver dishes, there jumped up out of it two huge fellows
with cudgels, who fell to belabouring the whole family. When they had
done and were gone back into the bottle, the owner of it, without
saying a word, put it under his coat and went to his landlord, who
happened to have a great deal of company with him, and sent in word
that he was come with another bottle to sell. He was at once admitted,
the bottle did its duty, and the men with cudgels laid about them on all
present, and never ceased till the original wealth-giving bottle was
restored. He now grew richer than ever, and his son married his
landlord's daughter, but when the old man and his wife died, the
servants, it is recorded, fighting at their wake, broke the two bottles.
[434]
The Confessions of Tom Bourke, as it contains a faithful transcript of the
words and ideas of that personage, is perhaps the most valuable
portion of the work. From this we learn that in Munster the fairies are,
like the people themselves, divided into factions. Thus we are told that,
on the occasion of the death of Bourke's mother, the two parties fought
for three continuous nights, to decide whether she should be buried
with her own or her husband's people (i. e. family). Bourke also had sat
for hours looking at two parties of the Good People playing at the
popular game of hurling, in a meadow at the opposite side of the river,
with their coats and waistcoats off, and white handkerchiefs on the
heads of one, and red on these of the other party.
A man whom Tom knew was returning one evening from a fair, a little
elevated of course, when he met a berrin (i. e. funeral), which he
joined, as is the custom; but, to his surprise, there was no one there
that he knew except one man, and he had been dead for some years.
When the berrin was over, they gathered round a piper, and began to
dance in the churchyard. Davy longed to be among them, and the man
that he knew came up to him, and bid him take out a partner, but on no
account to give her the usual kiss. He accordingly took out the purtiest
girl in the ring, and danced a jig with her, to the admiration of the
whole company; but at the end he forgot the warning, and complied
with the custom of kissing one's partner. All at once everything
vanished; and when Davy awoke nest morning, he found himself lying
among the tombstones.
Another man, also a little in liquor, was returning one night from a
berrin. The moon was shining bright, and from the other side of the
river came the sounds of merriment, and the notes of a bagpipe. Taking
off his shoes and stockings, he waded across the river, and there he
found a great crowd of people dancing on the Inch[435] on the other
side. He mingled with them without being observed, and he longed to
join in the dance; for he had no mean opinion of his own skill. He did
so, but found that it was not to be compared to theirs, they were so
light and agile. He was going away quite in despair, when a little old
man, who was looking on with marks of displeasure in his face, came
up to him, and telling him he was his friend, and his father's friend,
bade him go into the ring and call for a lilt. He complied, and all were
amazed at his dancing; he then got a table and danced on it, and finally
he span round and round on a trencher. When he had done, they
wanted him to dance again; but he refused with a great oath, and
instantly he found himself lying on the Inch with only a white cow
grazing beside him. On going home, he got a shivering and a fever. He
was for many days out of his mind, and recovered slowly; but ever after
he had great skill in fairy matters. The dancers, it turned out, had
belonged to a different faction, and the old man who gave him his skill
to that to which he himself was attached.
In these genuine confessions it is very remarkable that the Good People
are never represented as of a diminutive size; while in every story that
we ever heard of them in Leinster, they were of pygmy stature. The
following account of their mode of entering houses in Ulster gives them
dimensions approaching to those of Titania's 'small elves.'
A Fairy, the most agile, we may suppose, of the party, is selected, who
contrives to get up to the keyhole of the door, carrying with him a piece
of thread or twine. With this he descends on the inside, where he
fastens it firmly to the floor, or some part of the furniture. Those
without then 'haul taut and belay,' and when it is fast they prepare to
march along this their perilous Es-Sirat, leading to the paradise of
pantry or parlour, in this order. First steps up the Fairy-piper, and in
measured pace pursues his adventurous route, playing might and main
an invigorating elfin-march, or other spirit-stirring air; then one by one
the rest of the train mount the cord and follow his steps. Like the old
Romans, in their triumphal processions, they pass beneath the lofty
arch of the keyhole, and move down along the other side. Lightly, one
by one, they then jump down on the floor, to hold their revels or
accomplish their thefts.
We have never heard of any being, in the parts of Ireland with which
we are acquainted, answering to the Boggart, Brownie, or Nis. A
farmer's family still, we believe, living in the county of Wicklow, used to
assert that in their grandfather's time they never had any trouble about
washing up plates and dishes; for they had only to leave them collected
in a certain part of the house for the Good People, who would come in
and wash and clean them, and in the morning everything would be
clean and in its proper place.
Yet in the county of Cork it would seem that the Cluricaun, of which we
shall presently speak, used to enact the part of Nis or Boggart. Mr.
Croker tells a story of a little being, which he calls a Cluricaun, that
haunted the cellar of a Mr. Macarthy, and in a note on this tale he gives
the contents of a letter informing him of another ycleped Little
Wildbean, that haunted the house of a Quaker gentleman named
Harris, and which is precisely the Nis or Boggart. This Wildbean, who
kept to the cellar, would, if one of the servants through negligence left
the beer-barrel running, wedge himself into the cock and stop it, till
some one came to turn it. His dinner used to be left for him in the
cellar, and the cook having, one Friday, left him nothing but part of a
herring and some cold potatoes, she was at midnight dragged out of
her bed, and down the cellar-stairs, and so much bruised that she kept
her bed for three weeks. In order at last to get rid of him, Mr. Harris
resolved to remove, being told that if he went beyond a running stream
the Cluricaun could not follow him. The last cart, filled with empty
barrels and such like, was just moving off, when from the bung-hole of
one of them Wildbean cried out, "Here, master! here we go all
together!" "What!" said Mr. Harris, "dost thou go also?" "Yes, to be sure,
master. Here we go, all together!" "In that case, friend," replied Mr.
Harris, "let the carts be unloaded; we are just as well where we are." It
is added, that "Mr. Harris died soon after, but it is said the Cluricaun still
haunts the Harris family."
In another of these Fairy Legends, Teigue of the Lee, who haunted the
house of a Mr. Pratt, in the county of Cork, bears a strong resemblance
to the Hinzelmann of Germany. To the story, which is exceedingly well
told by a member of the society of Friends, now no more, also the
narrator of the Legend of Bottle-hill, Mr. Croker has in his notes added
some curious particulars.
A being named the Fear Dearg (i. e. Red Man) is also known in Munster.
A tale named The Lucky Guest, which Mr. Croker gives as taken down
verbatim from the mouth of the narrator by Mr. M'Clise, the artist, gives
the fullest account of this being. A girl related that, when she was quite
a child, one night, during a storm of wind and rain, a knocking was
heard at the door of her father's cabin, and a voice like that of a feeble
old man craving admission. On the door's being opened, there came in
a little old man, about two feet and a half high, with a red sugar-loaf
hat and a long scarlet coat, reaching down nearly to the ground, his
hair was long and grey, and his face yellow and wrinkled. He went over
to the fire (which the family had quitted in their fear), sat down and
dried his clothes, and began smoking a pipe which he found there. The
family went to bed, and in the morning he was gone. In about a month
after he began to come regularly every night about eleven o'clock. The
signal which he gave was thrusting a hairy arm through a hole in the
door, which was then opened, and the family retired to bed, leaving him
the room to himself. If they did not open the door, some accident was
sure to happen next day to themselves or their cattle. On the whole,
however, his visits brought good luck, and the family prospered, till the
landlord put them out of their farm, and they never saw the Fear Dearg
more.
As far as our knowledge extends, there is no being in the Irish rivers
answering to the Nix or Kelpie; but on the sea coast the people believe
in beings of the same kind as the Mermen and Mermaids. The Irish
name is Merrow,[436] and legends are told of them similar to those of
other countries. Thus the Lady of Gollerus resembles the Mermaid-wife
and others which we have already related. Instead, however, of an
entire dress, it is a kind of cap, named Cohuleen Driuth, without which
she cannot return to her subaqueous abode. Other legends tell of
matrimonial unions formed by mortals with these sea-ladies, from which
some families in the south claim a descent. The Lord of Dunkerron, so
beautifully told in verse by Mr. Croker, relates the unfortunate
termination of a marine amour of one of the O'Sullivan family. The Soul-
cages alone contains the adventures of a Mermau.
The Irish Pooka[437] ( uc ) is plainly the English Pouke, Puck, and
would seem, like it, to denote an evil spirit. The notions respecting it
are very vague. A boy in the mountains near Killarney told Mr. Croker
that "old people used to say that the Pookas were very numerous in the
times long ago. They were wicked-minded, black-looking, bad things,
that would come in the form of wild colts, with chains hanging about
them. They did great hurt to benighted travellers." Here we plainly have
the English Puck; but it is remarkable that the boy should speak of
Pookas in the plural number. In Leinster, it was always the, not a Pooka,
that we heard named. When the blackberries begin to decay, and the
seeds to appear, the children are told not to eat them any longer, as the
Pooka has dirtied on them.
The celebrated fall of the Liffey, near Ballymore Eustace, is named Pool-
a-Phooka, or The Pooka's Hole. Near Macroom, in the county of Cork,
are the ruins of a castle built on a rock, named Carrig-a-Phooka, or The
Pooka's Rock. There is an old castle not far from Dublin, called Puck's
Castle, and a townland in the county of Kildare is named Puckstown.
The common expression play the Puck is the same as play the deuce,
play the Devil.
The most remarkable of the Fairy-tribe in Ireland, and one which is
peculiar to the country, is the Leprechaun.[438] This is a being in the
form of an old man, dressed as he is described in one of the following
tales. He is by profession a maker of brogues; he resorts in general only
to secret and retired places, where he is discovered by the sounds
which he makes hammering his brogues. He is rich, like curmudgeons
of his sort, and it is only by the most violent threats of doing him some
bodily harm, that he can be made to show the place where his treasure
lies; but if the person who has caught him can be induced (a thing that
always happens, by the way) to take his eyes off him, he vanishes, and
with him the prospect of wealth. The only instance of more than one
Leprechaun being seen at a time is that which occurs in one of the
following tales, which was related by an old woman, to the writer's
sister and early companion, now no more.
Yet the Leprechaun, though, as we said, peculiar to Ireland, seems
indebted to England, at least, for his name. In Irish, as we have seen,
he is called Lobaircin, and it would not be easy to write the English
Lubberkin more accurately with Irish letters and Irish sounds.
Leprechaun is evidently a corruption of that word.[439] In the time of
Elizabeth and James, the word Lubrican was used in England to indicate
some kind of spirit. Thus Drayton gives as a part of Nymphidia's
invocation of Proserpina:
By the mandrake's dreadful groans;
By the Lubrican's sad moans;
By the noise of dead men's bones
In charnel-house rattling.
That this was the Leprechaun is, we think, clear; for in the Honest
Whore of Decker and Middleton, the following words are used of an
Irish footman:
As for your Irish Lubrican, that spirit
Whom by preposterous charms thy lust has raised.
Part II. i. 1.[440]
We thus have the Leprechaun as a well-known Irish fairy, though his
character was not understood, in the sixteenth century.
The two following tales we ourselves heard from the peasantry of
Kildare in our boyhood:[441]
Clever Tom and the Leprechaun.
Oliver Tom Fwich-(i.e. Fitz)pathrick, as people used to call him, was the
eldest son o' a comfortable farmer, who lived nigh hand to Morristown-
Lattin, not far from the Liffey. Tom was jist turned o' nine-an'-twinty,
whin he met wid the follyin' advinthur, an' he was as cliver, clane, tight,
good-lukin' a boy as any in the whole county Kildare. One fine day in
harvist (it was a holiday) Tom was takin' a ramble by himsilf thro' the
land, an' wint sauntherin' along the sunny side uv a hidge, an' thinkin'
in himsilf, whare id be the grate harm if people, instid uv idlin' an' goin'
about doin' nothin' at all, war to shake out the hay, an' bind and stook
th' oats that was lyin' an the ledge, 'specially as the weather was raither
brokin uv late, whin all uv a suddint he h'ard a clackin' sort o' n'ise jist a
little way fornint him, in the hidge. "Dear me," said Tom, "but isn't it
now raaly surprisin' to hear the stonechatters singin' so late in the
saison." So Tom stole an, goin' on the tips o' his toes to thry iv he cud
git a sight o' what was makin' the n'ise, to see iv he was right in his
guess. The n'ise stopt; but as Tom luked sharp thro' the bushes, what
did he see in a neuk o' the hidge but a brown pitcher that might hould
about a gallon an' a haff o' liquor; an' bye and bye he seen a little wee
deeny dawny bit iv an ould man, wid a little motty iv a cocked hat stuck
an the top iv his head, an' a deeshy daushy leather apron hangin' down
afore him, an' he pulled out a little wooden stool, an' stud up upon it,
and dipped a little piggen into the pitcher, an' tuk out the full av it, an'
put it beside the stool, an' thin sot down undher the pitcher, an' begun
to work at puttin' a heelpiece an a bit iv a brogue jist fittin' fur himsilf.
"Well, by the powers!" said Tom to himsilf, "I aften hard tell o' the
Leprechauns, an', to tell God's thruth, I nivir rightly believed in thim, but
here's won o' thim in right airnest; if I go knowin'ly to work, I'm a med
man. They say a body must nivir take their eyes aff o' thim, or they'll
escape."
Tom now stole an a little farther, wid his eye fixed an the little man jist
as a cat does wid a mouse, or, as we read in books, the rattlesnake
does wid the birds he wants to inchant. So, whin he got up quite close
to him, "God bless your work, honest man," sez Tom. The little man
raised up his head, an' "Thank you kindly," sez he. "I wundher you'd be
workin' an the holiday," sez Tom. "That's my own business, an' none of
your's," was the reply, short enough. "Well, may be, thin, you'd be civil
enough to tell us, what you've got in the pitcher there," sez Tom. "Aye,
will I, wid pleasure," sez he: "it's good beer." "Beer!" sez Tom: "Blud an'
turf, man, whare did ye git it?" "Whare did I git it, is it? why I med it to
be shure; an' what do ye think I med it av?" "Divil a one o' me knows,"
sez Tom, "but av malt, I 'spose; what ilse?" "'Tis there you're out; I med
it av haith." "Av haith!" sez Tom, burstin' out laughin'. "Shure you don't
take me to be sich an omedhaun as to b'lieve that?" "Do as ye plase,"
sez he, "but what I tell ye is the raal thruth. Did ye nivir hear tell o' the
Danes?" "To be shure I did," sez Tom, "warn't thim the chaps we gev
such a lickin' whin they thought to take Derry frum huz?" "Hem," sez
the little man dhryly, "is that all ye know about the matther?" "Well, but
about thim Danes," sez Tom. "Why all th' about thim is," said he, "is
that whin they war here they taught huz to make beer out o' the haith,
an' the saicret's in my family ivir sense." "Will ye giv a body a taste o'
yer beer to thry?" sez Tom. "I'll tell ye what it is, young man, it id be
fitther fur ye to be lukin' afther yer father's propirty thi'n to be botherin'
dacint, quite people wid yer foolish questions. There, now, while you're
idlin' away yer time here, there's the cows hav' bruk into th' oats, an'
are knockin' the corn all about."
Tom was taken so by surprise wid this, that he was jist an the very
point o' turnin' round, whin he recollicted himsilf. So, afeard that the like
might happin agin, he med a grab at the Leprechaun, an' cotch him up
in his hand, but in his hurry he ovirset the pitcher, and spilt all the beer,
so that he couldn't git a taste uv it to tell what sort it was. He thin
swore what he wouldn't do to him iv he didn't show him whare his
money was. Tom luked so wicked, an' so bloody-minded, that the little
man was quite frightened. "So," sez he, "come along wid me a couple o'
fields aff, an' I'll show ye a crock o' gould." So they wint, an' Tom held
the Leprechaun fast in his hand, an' nivir tuk his eyes frum aff uv him,
though they had to crass hidges an' ditches, an' a cruked bit uv a bog
(fur the Leprechaun seemed, out o' pure mischief, to pick out the
hardest and most conthrairy way), till at last they come to a grate field
all full o' bolyawn buies,[442] an' the Leprechaun pointed to a big
bolyawn, an' sez he, "Dig undher that bolyawn, an' you'll git a crock
chuck full o' goulden guineas."
Tom, in his hurry, had nivir minded the bringin' a fack[443] wid him, so
he thought to run home and fetch one, an' that he might know the
place agin, he tuk aff one o' his red garthers, and tied it round the
bolyawn. "I s'pose," sez the Leprechaun, very civilly, "ye've no further
occashin fur me?" "No," sez Tom, "ye may go away now, if ye like, and
God speed ye, an' may good luck attind ye whareivir ye go." "Well, good
bye to ye, Tom Fwichpathrick," sed the Leprechaun, "an' much good
may do ye wid what ye'll git."
So Tom run fur the bare life, till he come home, an' got a fack, an' thin
away wid him as hard as he could pilt back to the field o' bolyawns; but
whin he got there, lo an' behould, not a bolyawn in the field, but had a
red garther, the very idintical model o' his own, tied about it; an' as to
diggin' up the whole field, that was all nonsinse, fur there was more nor
twinty good Irish acres in it. So Tom come home agin wid his fack an
his shouldher, a little cooler nor he wint; and many's the hearty curse he
gev the Leprechaun ivry time he thought o' the nate turn he sarved
him.[444]
The Leprechaun in the Garden.
There's a sort o' people that every body must have met wid sumtime or
another. I mane thim people that purtinds not to b'lieve in things that in
their hearts they do b'lieve in, an' are mortially afeard o' too. Now
Failey[445] Mooney was one o' these. Failey (iv any o' yez knew him)
was a rollockin', rattlin', divil-may-care sort ov a chap like—but that's
neither here nor there; he was always talkin' one nonsinse or another;
an' among the rest o' his fooleries, he purtinded not to b'lieve in the
fairies, the Leprechauns, an' the Poocas, an' he evin sumtimes had the
impedince to purtind to doubt o' ghosts, that every body b'lieves in, at
any rate. Yit sum people used to wink an' luk knowin' whin Failey was
gostherin', fur it was obsarved that he was mighty shy o' crassin' the
foord o' Ahnamoe afther nightfall; an' that whin onst he was ridin' past
the ould church o' Tipper in the dark, tho' he'd got enough o' pottheen
into him to make any man stout, he med the horse trot so that there
was no keepin' up wid him, an' iv'ry now an' thin he'd throw a sharp
luk-out ovir his lift shouldher.
Well, one night there was a parcel o' the neighbours sittin' dhrinkin' an'
talkin' at Larry Reilly's public-house, an' Failey was one o' the party. He
was, as usual, gittin' an wid his nonsinse an' baldherdash about the
fairies, an' swearin' that he didn't b'lieve there was any live things,
barrin' min an' bastes, an' birds and fishes, an' sich like things as a body
cud see, an' he wint on talkin' in so profane a way o' the good people,
that som o' the company grew timid an' begun to crass thimsilves, not
knowin' what might happin', whin an ould woman called Mary Hogan
wid a long blue cloak about her, that was sittin' in the chimbly corner
smokin' her pipe widout takin' the laste share in the conversation, tuk
the pipe out o' her mouth, an' threw the ashes out o' it, an' spit in the
fire, an' turnin' round, luked Failey straight in the face. "An' so you don't
b'lieve there's sich things as Leprechauns, don't ye?" sed she.
Well, Failey luked rayther daunted, but howsumdivir he sed nothin'.
"Why, thin, upon my throth, an' it well becomes the likes o' ye, an'
that's nothin' but a bit uv a gossoon, to take upon yer to purtind not to
b'lieve what yer father, an' yer father's father, an' his father afore him,
nivir med the laste doubt uv. But to make the matther short, seein' 's
b'lievin' they say, an' I, that might be yer gran'mother, tell ye there is
sich things as Leprechauns, an' what's more, that I mysilf seen one o'
thim,—there's fur ye, now!"
All the people in the room luked quite surprised at this, an' crowded up
to the fireplace to listen to her. Failey thried to laugh, but it wouldn't do,
nobody minded him.
"I remimber," sed she, "some time afther I married the honest man,
that's now dead and gone, it was by the same token jist a little afore I
lay in o' my first child (an' that's many a long day ago), I was sittin', as I
sed, out in our little bit o' a gardin, wid my knittin' in my hand, watchin'
sum bees we had that war goin' to swarm. It was a fine sunshiny day
about the middle o' June, an' the bees war hummin' and flyin'
backwards an' forwards frum the hives, an' the birds war chirpin' an'
hoppin' an the bushes, an' the buttherflies war flyin' about an' sittin' an
the flowers, an' ev'ry thing smelt so fresh an' so sweet, an' I felt so
happy, that I hardly knew whare I was. Well, all uv a suddint, I heard
among sum rows of banes we had in a corner o' the gardin, a n'ise that
wint tick tack, tick tack, jist fur all the world as iv a brogue-maker was
puttin' an the heel uv a pump. 'The Lord presarve us,' sed I to mysilf,
'what in the world can that be?' So I laid down my knittin', an' got up,
an' stole ovir to the banes, an' nivir believe me iv I didn't see, sittin'
right forenint me, in the very middle of thim, a bit of an ould man, not a
quarther so big as a new-born child, wid a little cocked hat an his head,
an' a dudeen in his mouth, smokin' away; an' a plain, ould-fashioned,
dhrab-coloured coat, wid big brass buttons upon it, an his back, an' a
pair o' massy silver buckles in his shoes, that a'most covered his feet
they war so big, an' he workin' away as hard as ivir he could, heelin' a
little pair o' pumps. The instant minnit I clapt my two eyes upon him I
knew him to be a Leprechaun, an' as I was stout an' foolhardy, sez I to
him 'God save ye honist man! that's hard work ye're at this hot day.' He
luked up in my face quite vexed like; so wid that I med a run at him an'
cotch hould o' him in my hand, an' axed him whare was his purse o'
money! 'Money?' sed he, 'money annagh! an' whare on airth id a poor
little ould crathur like mysilf git money?' 'Come, come,' sed I, 'none o'
yer thricks upon thravellers; doesn't every body know that Leprechauns,
like ye, are all as rich as the divil himsilf.' So I pulled out a knife I'd in
my pocket, an' put on as wicked a face as ivir I could (an' in throth, that
was no aisy matther fur me thin, fur I was as comely an' good-
humoured a lukin' girl as you'd see frum this to Ballitore)—an' swore by
this and by that, if he didn't instantly gi' me his purse, or show me a pot
o' goold, I'd cut the nose aff his face. Well, to be shure, the little man
did luk so frightened at hearin' these words, that I a'most found it in my
heart to pity the poor little crathur. 'Thin,' sed he, 'come wid me jist a
couple o' fields aff, an' I'll show ye whare I keep my money.' So I wint,
still houldin' him fast in my hand, an' keepin' my eyes fixed upon him,
whin all o' a suddint I h'ard a whiz-z behind me. 'There! there!' cries he,
'there's yer bees all swarmin' an' goin' aff wid thimsilves like blazes.' I,
like a fool as I was, turned my head round, an' whin I seen nothin' at
all, an' luked back at the Leprechaun, an' found nothin' at all at all in my
hand—fur whin I had the ill luck to take my eyes aff him, ye see, he
slipped out o' my fingers jist as iv he was med o' fog or smoke, an' the
sarra the fut he iver come nigh my garden agin."
The Three Leprechauns.
Mrs. L. having heard that Molly Toole, an old woman who held a few
acres of land from Mr. L., had seen Leprechauns, resolved to visit her,
and learn the truth from her own lips. Accordingly, one Sunday, after
church, she made her appearance at Molly's residence, which was—no
very common thing—extremely neat and comfortable. As she entered,
every thing looked gay and cheerful. The sun shone bright in through
the door on the earthen floor. Molly was seated at the far side of the
fire in her arm-chair; her daughter Mary, the prettiest girl on the lands,
was looking to the dinner that was boiling; and her son Mickey, a young
man of about two-and-twenty, was standing lolling with his back against
the dresser.
The arrival of the mistress disturbed the stillness that had hitherto
prevailed. Mary, who was a great favourite, hastened to the door to
meet her, and shake hands with her. Molly herself had nearly got to the
middle of the floor when the mistress met her, and Mickey modestly
staid where he was till he should catch her attention. "O then, musha!
but isn't it a glad sight for my ould eyes to see your own silf undher my
roof? Mary, what ails you, girl? and why don't you go into the room and
fetch out a good chair for the misthress to sit down upon and rest
herself?" "'Deed faith, mother, I'm so glad I don't know what I'm doin'.
Sure you know I didn't see the misthress since she cum down afore."
Mickey now caught Mrs. L.'s eye, and she asked him how he did. "By
Gorra, bravely, ma'am, thank you," said he, giving himself a wriggle,
while his two hands and the small of his back rested on the edge of the
dresser.
"Now, Mary, stir yourself, alanna," said the old woman, "and get out the
bread and butther. Sure you know the misthress can't but be hungry
afther her walk."—"O, never mind it, Molly; it's too much
trouble."—"Throuble, indeed! it's as nice butther, ma'am, as iver you put
a tooth in; and it was Mary herself that med it."—"O, then I must taste
it."
A nice half griddle of whole-meal bread and a print of fresh butter were
now produced, and Molly helped the mistress with her own hands. As
she was eating, Mary kept looking in her face, and at last said, "Ah
then, mother, doesn't the misthress luk mighty well? Upon my faikins,
ma'am, I never seen you luking half so handsome."—"Well! and why
wouldn't she luk well? And niver will she luk betther nor be betther nor I
wish her."—"Well, Molly, I think I may return the compliment, for Mary
is prettier than ever; and as for yourself, I really believe it's young again
you're growing."—"Why, God be thanked, ma'am, I'm stout and hearty;
and though I say it mysilf, there's not an ould woman in the county can
stir about betther nor me, and I'm up ivery mornin' at the peep of day,
and rout them all up out of their beds. Don't I?" said she, looking at
Mary.—"Faith, and sure you do, mother," replied Mickey; "and before the
peep of day, too; for you have no marcy in you at all at all."—"Ah, in my
young days," continued the old woman, "people woren't slugabeds; out
airly, home late—that was the way wid thim."—"And usedn't people to
see Leprechauns in thim days, mother?" said Mickey, laughing.—"Hould
your tongue, you saucy cub, you," cried Molly; "what do you know
about thim?"—"Leprechauns?" said Mrs. L., gladly catching at the
opportunity; "did people really, Molly, see Leprechauns in your young
days?"—"Yes, indeed, ma'am; some people say they did," replied Molly,
very composedly.—"O com' now, mother," cried Mickey, "don't think to
be goin' it upon us that away; you know you seen thim one time
yoursilf, and you hadn't the gumption in you to cotch thim, and git their
crocks of gould from thim."—"Now, Molly, is that really true that you
saw the Leprechauns?"—"'Deed, and did I, ma'am; but this boy's always
laughin' at me about thim, and that makes me rather shy in talkin' o'
thim."—"Well, Molly, I won't laugh at you; so, come, tell me how you
saw them."
"Well, ma'am, you see it was whin I was jist about the age of Mary,
there. I was comin' home late one Monday evenin' from the market; for
my aunt Kitty, God be marciful to her! would keep me to take a cup of
tay. It was in the summer time, you see, ma'am, much about the middle
of June, an' it was through the fields I come. Well, ma'am, as I was
sayin', it was late in the evenin', that is, the sun was near goin' down,
an' the light was straight in my eyes, an' I come along through the bog-
meadow; for it was shortly afther I was married to him that's gone, an'
we wor livin' in this very house you're in now; an' thin whin I come to
the castle-field—the pathway you know, ma'am, goes right through the
middle uv it—an' it was thin as fine a field of whate, jist shot out, as
you'd wish to luk at; an' it was a purty sight to see it wavin' so
beautifully wid every air of wind that was goin' over it, dancin' like to
the music of a thrush, that was singin' down below in the hidge.[446]
Well, ma'am, I crasst over the style that's there yit, and wint along fair
and aisy, till I was near about the middle o' the field, whin somethin'
med me cast my eyes to the ground, a little before me; an' thin I saw,
as sure as I'm sittin' here, no less nor three o' the Leprechauns, all
bundled together like so miny tailyors, in the middle o' the path before
me. They worn't hammerin' their pumps, nor makin' any kind of n'ise
whatever; but there they wor, the three little fellows, wid their cocked
hats upon thim, an' their legs gothered up undher thim, workin' away at
their thrade as hard as may be. If you wor only to see, ma'am, how fast
their little ilbows wint as they pulled out their inds! Well, every one o'
thim had his eye cocked upon me, an' their eyes wor as bright as the
eye of a frog, an' I cudn't stir one step from the spot for the life o' me.
So I turned my head round, and prayed to the Lord in his marcy to
deliver me from thim, and when I wint to luk at thim agin, ma'am, not a
sight o' thim was to be seen: they wor gone like a dhrame."—"But,
Molly, why did you not catch them?"—"I was afeard, ma'am, that's the
thruth uv it; but maybe I was as well widout thim. I niver h'ard tell of a
Leprechaun yit that wasn't too many for any one that cotch
him."—"Well, and Molly, do you think there are any Leprechauns
now?"—"It's my belief, ma'am, they're all gone out of the country, cliver
and clane, along wid the Fairies; for I niver hear tell o' thim now at all."
Mrs. L. having now attained her object, after a little more talk with the
good old woman, took her leave, attended by Mary, who would see her
a piece of the way home. And Mary being asked what she thought of
the Leprechauns, confessed her inability to give a decided opinion: her
mother, she knew, was incapable of telling a lie, and yet she had her
doubts if there ever were such things as Leprechauns.
The following tale of a Cluricaun, related by the writer of the Legend of
Bottle Hill, is of a peculiar character. We have never heard anything
similar of a Leprechaun.
The Little Shoe.
"Now tell me, Molly," said Mr. Coote to Molly Cogan, as he met her on
the road one day, close to one of the old gateways of Kilmallock, "did
you ever hear of the Cluricaun?"—"Is it the Cluricaun? Why, thin, to be
shure; aften an' aften. Many's the time I h'ard my father, rest his sowl!
tell about 'em over and over agin."—"But did you ever see one, Molly—
did you ever see one yourself?"—"Och! no, I niver seen one in my life;
but my gran'father, that's my father's father, you know, he seen one,
one time, an' cotch him too."—"Caught him! Oh! Molly, tell me how was
that."
"Why, thin, I'll tell ye. My gran'father, you see, was out there above in
the bog, dhrawin' home turf, an' the poor ould mare was tir't afther her
day's work, an' the ould man wint out to the stable to look afther her,
an' to see if she was aitin' her hay; an' whin he come to the stable door
there, my dear, he h'ard sumthin' hammerin', hammerin', hammerin',
jist for all the wurld like a shoemaker makin' a shoe, and whis'lin' all the
time the purtiest chune he iver h'ard in his whole life afore. Well, my
gran'father he thought it was the Cluricaun, an' he sed to himsilf, sez
he, 'I'll ketch you, if I can, an' thin I'll have money enough always.' So
he opened the door very quitely, an' didn't make a taste o' n'ise in the
wurld, an' luked all about, but the niver a bit o' the little man cud he
see anywhare, but he h'ard his hammerin' and whis'lin', an' so he luked
and luked, till at last he seen the little fellow; an' whare was he, do ye
think, but in the girth undher the mare; an' there he was, wid his little
bit ov an apron an him, an' his hammer in his hand, an' a little red
night-cap an his head, an' he makin' a shoe; an he was so busy wid his
work, an' was hammerin' an' whis'lin' so loud, that he niver minded my
gran'father, till he cotch him fast in his hand. 'Faix, I have ye now,' says
he, 'an' I'll niver let ye go till I git yer purse—that's what I won't; so
give it here at onst to me, now.' 'Stop, stop,' says the Cluricaun; 'stop,
stop,' says he, 'till I get it for ye.' So my gran'father, like a fool, ye see,
opened his hand a little, an' the little weeny chap jumped away laughin',
an' he niver seen him any more, an' the divil a bit o' the purse did he
git; only the Cluricaun left his little shoe that he was makin'. An' my
gran'father was mad enough wid himself for lettin' him go; but he had
the shoe all his life, an' my own mother tould me she aftin seen it, an'
had it in her hand; an' 'twas the purtiest little shoe she ivir seen."—"An'
did you see it yourself, Molly?"—"Oh! no, my dear, 'twas lost long afore I
was born; but my mother tould me aftin an' aftin enough."
SCOTTISH HIGHLANDS.
Huar Prownie coad agus curochd,
Agus cha dian Prownie opar tullidh.
Brownie has got a cowl and coat,
And never more will work a jot.
Stewart.
Colonies of Gothic Fairies, it would appear, early established themselves
in the Highlands, and almost every Lowland, German, and Scandinavian
Fairy or Dwarf-tale will there find its fellow. The Gaelic Fairies are very
handsome in their persons; their usual attire is green. They dance and
sing, lend and borrow, and they make cloth and shoes in an amazingly
short space of time. They make their raids upon the low country, and
carry off women and children; they fetch midwives to assist at the birth
of their children, and mortals have spent a night at the fairy revels, and
next morning found that the night had extended a hundred years.
Highland fairies also take the diversion of the chase. "One Highlander,"
says Mc.Culloch,[447] "in passing a mountain, hears the tramp of
horses, the music of the horn, and the cheering of the huntsmen; when
suddenly a gallant crew of thirteen fairy hunters, dressed in green,
sweep by him, the silver bosses of their bridles jingling in the night
breeze."
The Gael call the Fairies Daoine Shi',[448] (Dheenè Shee) and their
habitations Shians, or Tomhans. These are a sort of turrets, resembling
masses of rock or hillocks. By day they are indistinguishable, but at
night they are frequently lit up with great splendour.
Brownie, too, 'shows his honest face' in the Highlands; and the
mischievous water-Kelpie also appears in his equine form, and seeks to
decoy unwary persons to mount him, that he may plunge with his rider
into the neighbouring loch or river.
The Highlanders have nearly the same ideas as their Shetland
neighbours, respecting the seals.
The following legends will illustrate what we have stated.[449]
The Fairy's Inquiry.
A clergyman was returning home one night after visiting a sick member
of his congregation. His way led by a lake, and as he proceeded he was
surprised to hear most melodious strains of music. He sat down to
listen. The music seemed to approach coming over the lake
accompanied by a light. At length he discerned a man walking on the
water, attended by a number of little beings, some bearing lights, others
musical instruments. At the beach the man dismissed his attendants,
and then walking up to the minister saluted him courteously. He was a
little grey-headed old man, dressed in rather an unusual garb. The
minister having returned his salute begged of him to come and sit
beside him. He complied with the request, and on being asked who he
was, replied that he was one of the Daoine Shi. He added that he and
they had originally been angels, but having been seduced into revolt by
Satan, they had been cast down to earth where they were to dwell till
the day of doom. His object now was, to ascertain from the minister
what would be their condition after that awful day. The minister then
questioned him on the articles of faith; but as his answers did not prove
satisfactory, and as in repeating the Lord's Prayer, he persisted in saying
wert instead of art in heaven, he did not feel himself justified in holding
out any hopes to him. The fairy then gave a cry of despair and flung
himself into the loch, and the minister resumed his journey.
The Young Man in the Shian.
A farmer named Macgillivray, one time removed from the
neighbourhood of Cairngorm in Strathspey to the forest of Glenavon, in
which the fairies are said to reside. Late one night, as two of his sons,
Donald and Rory, were in search of some of his sheep that had strayed,
they saw lights streaming from the crevices of a fairy turret which in the
day time had only the appearance of a rock. They drew nigh to it, and
there they heard jigs and reels played inside in the most exquisite
manner. Rory was so fascinated that he proposed that they should enter
and take part in the dance. Donald did all he could to dissuade him, but
in vain. He jumped into the Shian, and plunged at once into the whirling
movements of its inhabitants. Donald was in great perplexity, for he
feared to enter the Shian. All he could do therefore was to put his
mouth to one of the crevices, and calling, as the custom was, three
times on his brother, entreating him in the most moving terms, to come
away and return home. But his entreaties were unheeded and he was
obliged to return alone.
Every means now was resorted to for the recovery of Rory, but to no
purpose. His family gave him up for lost, when a Duin Glichd or Wise
man, told Donald to go to the place where he had lost his brother, a
year and a day from the time, and placing in his garments a rowan-
cross, to enter the Shian boldly, and claim him in the divine name, and
if he would not come voluntarily, to seize him and drag him out; for the
fairies would have no power to prevent him. After some hesitation
Donald assented. At the appointed time he approached the Shian at
midnight. It was full of revelry, and the merry dance was going on as
before. Donald had his terrors no doubt, but they gave way to his
fraternal affection. He entered and found Rory in the midst of a
Highland Fling, and running up to him, seized him by the collar,
repeating the words dictated by the Wise man. Rory agreed to go
provided he would let him finish his dance; for he had not been, he
assured him, more than half an hour in the place, but Donald was
inexorable, and took him home to his parents. Rory would never have
believed that his half-hour had been a twelvemonth, "did not the calves
grown now into stots, and the new-born babes now toddling about the
house, at length convince him that in his single reel he had danced for a
twelvemonth and a day."
The Two Fiddlers.
Nearly three hundred years ago, there dwelt in Strathspey two fiddlers,
greatly renowned in their art. One Christmas they resolved to go try
their fortune in Inverness. On arriving in that town they took lodgings,
and as was the custom at that time, hired the bellman to go round
announcing their arrival, their qualifications, their fame, and their terms.
Soon after they were visited by a venerable-looking grey-haired old
man, who not only found no fault with, but actually offered to double
their terms if they would go with him. They agreed, and he led them
out of the town, and brought them to a very strange-looking dwelling
which seemed to them to be very like a Shian. The money, however,
and the entreaties of their guide induced them to enter it, and their
musical talents were instantly put into requisition, and the dancing was
such as in their lives they had never witnessed.
When morning came they took their leave highly gratified with the
liberal treatment they had received. It surprised them greatly to find
that it was out of a hill and not a house that they issued, and when they
came to the town, they could not recognise any place or person, every
thing seemed so altered. While they and the townspeople were in
mutual amazement, there came up a very old man, who on hearing
their story, said: "You are then the two men who lodged with my great-
grandfather, and whom Thomas Rimer, it was supposed, decoyed to
Tomnafurach. Your friends were greatly grieved on your account, but it
is a hundred years ago, and your names are now no longer known." It
was the Sabbath day and the bells were tolling; the fiddlers, deeply
penetrated with awe at what had occurred, entered the church to join in
the offices of religion. They sat in silent meditation while the bell
continued ringing, but the moment that the minister commenced the
service they crumbled away into dust.
The Fairy-Labour.
Many years ago there dwelt in Strathspey a midwife of great repute.
One night just as she was going to bed, she heard a loud knocking at
the door, and on opening it she saw there a man and a grey horse, both
out of breath. The rider requested her to jump up behind him and come
away to assist a lady who was in great danger. He would not even
consent to her stopping to change her dress, as it would cause delay.
She mounted and away they went at full speed. On the way she tried to
learn from the rider whither she was going, but all she could get from
him was, that she would be well paid. At length he let out that it was to
a fairy-lady he was taking her. Nothing daunted, however, she went on,
and on reaching the Shian, she found that her services were really very
much needed. She succeeded in bringing a fine boy to the light, which
caused so much joy, that the fairies desired her to ask what she would,
and if it was in their power, it should be granted. Her desire was that
success might attend herself and her posterity in all similar operations.
The gift was conferred and it continued, it was said, with her great-
grandson, at the time the collector of these legends wrote.
The Fairy borrowing Oatmeal.
A fairy came one day from one of the turrets of Craig-ail-naic to the
wife of one of the tenants in Delnabo, and asked her to lend her a firlot
of oatmeal for food for her family, promising to repay it soon, as she
was every moment expecting an ample supply. The woman complied
with this request, and after, as was the custom of the country, having
regaled her with bread, cheese, and whiskey, she went, as was usual,
to see her a part of the way home. When they had reached the summit
of an eminence near the town, the Béanshi told her she might take her
meal home again as she was now abundantly supplied. The woman did
as desired, and as she went along she beheld the corn-kiln of an
adjacent farm all in a blaze.
The Fairy-Gift.
A farmer in Strathspey was one day engaged in sowing one of his fields
and singing at his work. A fairy damsel of great beauty came up to him
and requested him to sing for her a favourite old Gaelic song named
Nighan Donne na Bual. He complied, and she then asked him to give
her some of his corn. At this he demurred a little and wished to know
what she would give him in return. She replied with a significant look
that his seed would never fail him. He then gave to her liberally and she
departed. He went on sowing, and when he had finished a large field,
he found that his bag was as full and as heavy as when he began. He
then sowed another field of the same size, with the same result, and
satisfied with his day's work, he threw the bag on his shoulder and
went home. Just as he was entering the barn-door he was met by his
wife, a foolish talkative body with a tongue as long, and a head as
empty as the church bell, who, struck with the appearance of the bag
after a day's sowing, began to ask him about it. Instantly it became
quite empty. "I'll be the death of you, you foolish woman," roared out
the farmer; "if it were not for your idle talk, that bag was worth its
weight in gold."
The Stolen Ox.
The tacksman (i. e. tenant) of the farm of Auchriachan in Strathavon,
while searching one day for his goats on a hill in Glenlivat, found
himself suddenly enveloped in a dense fog. It continued till night came
on when he began to give himself up to despair. Suddenly he beheld a
light at no great distance. He hastened toward it, and found that it
proceeded from a strange-looking edifice. The door was open, and he
entered, but great was his surprise to meet there a woman whose
funeral he had lately attended. From her he learned that this was an
abode of the fairies for whom she kept house, and his only chance of
safety, she said, was in being concealed from them; for which purpose
she hid him in a corner of the apartment. Presently in came a troop of
fairies, and began calling out for food. An old dry-looking fellow then
reminded them of the miserly, as he styled him, tacksman of
Auchriachan, and how he cheated them out of their lawful share of his
property, by using some charms taught him by his old grandmother. "He
is now from home," said he, "in search of our allies,[450] his goats, and
his family have neglected to use the charm, so come let us have his
favourite ox for supper." The speaker was Thomas Rimer, and the plan
was adopted with acclamation. "But what are we to do for bread?" cried
one. "We'll have Auchriachan's new baked bread," replied Thomas; "his
wife forgot to cross the first bannock."[451] So said, so done. The ox
was brought in and slaughtered before the eyes of his master, whom,
while the fairies were employed about their cooking, his friend gave an
opportunity of making his escape.
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.
More than just a book-buying platform, we strive to be a bridge
connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.
Join us on a journey of knowledge exploration, passion nurturing, and
personal growth every day!
ebookbell.com

More Related Content

PDF
Hibernate In Action 1st Edition Christian Bauer Gavin King
PDF
Hibernate in Action 1st Edition Christian Bauer
PDF
PowerShell in Depth An administrator s guide Don Jones
PDF
Mercurial The Definitive Guide 1st Edition Bryan O'Sullivan
PDF
Windows Powershell in Action 1st Edition Bruce G. Payette
PDF
Windows Powershell in Action 1st Edition Bruce G. Payette
PDF
Mercurial The Definitive Guide 1st Edition Bryan O'Sullivan
PDF
Windows Powershell in Action 1st Edition Bruce G. Payette
Hibernate In Action 1st Edition Christian Bauer Gavin King
Hibernate in Action 1st Edition Christian Bauer
PowerShell in Depth An administrator s guide Don Jones
Mercurial The Definitive Guide 1st Edition Bryan O'Sullivan
Windows Powershell in Action 1st Edition Bruce G. Payette
Windows Powershell in Action 1st Edition Bruce G. Payette
Mercurial The Definitive Guide 1st Edition Bryan O'Sullivan
Windows Powershell in Action 1st Edition Bruce G. Payette

Similar to Subversion In Action 1st Edition Jeffrey Machols (20)

PDF
Windows Powershell Cookbook Second Edition Second Edition Lee Holmes
PDF
Spring In Action 1 Illustrated Edition Craig Walls Ryan Breidenbach
PDF
WebWork in Action In Action First Edition Patrick Lightbody
PDF
WebWork in Action In Action First Edition Patrick Lightbody
PDF
Hibernate Search in Action 1st Edition Emmanuel Bernard
PDF
Hibernate Search in Action 1st Edition Emmanuel Bernard
PDF
Eclipse In Action A Guide For Java Developers 1st Edition David Gallardo
PDF
JDK 1 4 Tutorial 1 (no book cover) Edition Gregory Travis
PDF
Active Directory Cookbook Fourth Edition Brian Svidergol Robbie Allen
PDF
WebWork in Action In Action First Edition Patrick Lightbody
PDF
Download full ebook of Version Control With Git Jon Loeliger instant download...
PDF
Mastering Perl Second Edition Brian D Foy
PDF
React in Action 1st Edition Mark Tielens Thomas
PDF
LPI Linux Certification in a Nutshell Third Edition Adam Haeder
PDF
LPI Linux Certification in a Nutshell Third Edition Adam Haeder
PDF
Mysql High Availability Tools For Building Robust Data Centers Charles Bell
PDF
React in Action 1st Edition Mark Tielens Thomas
PDF
Azure Infrastructure As Code With Arm Templates And Bicep 1st Edition Henry Been
PDF
Php In A Nutshell A Desktop Quick Reference 1st Edition Paul Hudson
PDF
Programming Elixir 13 Functional Concurrent Pragmatic Fun Dave Thomas
Windows Powershell Cookbook Second Edition Second Edition Lee Holmes
Spring In Action 1 Illustrated Edition Craig Walls Ryan Breidenbach
WebWork in Action In Action First Edition Patrick Lightbody
WebWork in Action In Action First Edition Patrick Lightbody
Hibernate Search in Action 1st Edition Emmanuel Bernard
Hibernate Search in Action 1st Edition Emmanuel Bernard
Eclipse In Action A Guide For Java Developers 1st Edition David Gallardo
JDK 1 4 Tutorial 1 (no book cover) Edition Gregory Travis
Active Directory Cookbook Fourth Edition Brian Svidergol Robbie Allen
WebWork in Action In Action First Edition Patrick Lightbody
Download full ebook of Version Control With Git Jon Loeliger instant download...
Mastering Perl Second Edition Brian D Foy
React in Action 1st Edition Mark Tielens Thomas
LPI Linux Certification in a Nutshell Third Edition Adam Haeder
LPI Linux Certification in a Nutshell Third Edition Adam Haeder
Mysql High Availability Tools For Building Robust Data Centers Charles Bell
React in Action 1st Edition Mark Tielens Thomas
Azure Infrastructure As Code With Arm Templates And Bicep 1st Edition Henry Been
Php In A Nutshell A Desktop Quick Reference 1st Edition Paul Hudson
Programming Elixir 13 Functional Concurrent Pragmatic Fun Dave Thomas
Ad

Recently uploaded (20)

PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
RMMM.pdf make it easy to upload and study
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Computing-Curriculum for Schools in Ghana
PPTX
master seminar digital applications in india
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Weekly quiz Compilation Jan -July 25.pdf
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
Complications of Minimal Access Surgery at WLH
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Cell Structure & Organelles in detailed.
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Orientation - ARALprogram of Deped to the Parents.pptx
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
RMMM.pdf make it easy to upload and study
FourierSeries-QuestionsWithAnswers(Part-A).pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Computing-Curriculum for Schools in Ghana
master seminar digital applications in india
Anesthesia in Laparoscopic Surgery in India
Weekly quiz Compilation Jan -July 25.pdf
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
Complications of Minimal Access Surgery at WLH
A systematic review of self-coping strategies used by university students to ...
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
human mycosis Human fungal infections are called human mycosis..pptx
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Cell Structure & Organelles in detailed.
Supply Chain Operations Speaking Notes -ICLT Program
O7-L3 Supply Chain Operations - ICLT Program
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Ad

Subversion In Action 1st Edition Jeffrey Machols

  • 1. Subversion In Action 1st Edition Jeffrey Machols download https://ebookbell.com/product/subversion-in-action-1st-edition- jeffrey-machols-6729636 Explore and download more ebooks at ebookbell.com
  • 2. Here are some recommended products that we believe you will be interested in. You can click the link to download. Subversion In Institutional Change And Stability A Neglected Mechanism 1st Edition Jan Olsson Auth https://ebookbell.com/product/subversion-in-institutional-change-and- stability-a-neglected-mechanism-1st-edition-jan-olsson-auth-5611208 Narrative Subversion In Medieval Literature El Risden https://ebookbell.com/product/narrative-subversion-in-medieval- literature-el-risden-48811808 Espionage And Subversion In An Industrial Society An Examination And Philosophy Of Defence For Management Peter Hamilton https://ebookbell.com/product/espionage-and-subversion-in-an- industrial-society-an-examination-and-philosophy-of-defence-for- management-peter-hamilton-49419800 The Preaching Fox Festive Subversion In The Plays Of The Wakefield Master Reprint Warren Edminster https://ebookbell.com/product/the-preaching-fox-festive-subversion-in- the-plays-of-the-wakefield-master-reprint-warren-edminster-50769230
  • 3. Marginality And Subversion In Korea The Hong Kyongnae Rebellion Of 1812 Sun Joo Kim https://ebookbell.com/product/marginality-and-subversion-in-korea-the- hong-kyongnae-rebellion-of-1812-sun-joo-kim-51431034 Escape Routes Control And Subversion In The Twentyfirst Century Dimitris Papadopoulos https://ebookbell.com/product/escape-routes-control-and-subversion-in- the-twentyfirst-century-dimitris-papadopoulos-2434750 Myth And Subversion In The Contemporary Novel Jose Manuel Losada Goya https://ebookbell.com/product/myth-and-subversion-in-the-contemporary- novel-jose-manuel-losada-goya-40666804 The Gender Dance Ironic Subversion In C S Lewiss Cosmic Trilogy Monika B Hilder https://ebookbell.com/product/the-gender-dance-ironic-subversion-in-c- s-lewiss-cosmic-trilogy-monika-b-hilder-5032172 Power And Subversion In Byzantium Papers From The Fortythird Spring Symposium Of Byzantine Studies University Of Birmingham March 2010 Reprint Dimiter Angelov https://ebookbell.com/product/power-and-subversion-in-byzantium- papers-from-the-fortythird-spring-symposium-of-byzantine-studies- university-of-birmingham-march-2010-reprint-dimiter-angelov-10841852
  • 5. Jeffrey Machols M A N N I N G Subversion IN ACTION The guide to source control
  • 8. Subversion in Action JEFFREY MACHOLS M A N N I N G Greenwich (74° w. long.) Licensed to <null>
  • 9. For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact: Special Sales Department Manning Publications Co. 209 Bruce Park Avenue Fax: (203) 661-9018 Greenwich, CT 06830 email: manning@manning.com ©2005 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books they publish printed on acid-free paper, and we exert our best efforts to that end. Manning Publications Co. Copyeditor: Linda Recktenwald 209 Bruce Park Avenue Typesetter: Gordan Salinovic Greenwich, CT 06830 Cover designer: Leslie Haimes ISBN 1-932394-36-2 Printed in the United States of America 1 2 3 4 5 6 7 8 9 10 – VHG – 07 06 05 04 Licensed to <null>
  • 10. v contents preface xiii acknowledgments xv about this book xvii about the title xx about the cover illustration xxi 1 Introduction 1 1.1 Understanding version control 2 Why use version control 3 ■ The repository 3 ■ Checkout strategies 3 ■ Commit and update 5 ■ What are change logs? 5 The role of properties 7 1.2 30,000 foot view of Subversion 8 Atomic commits 9 ■ Everything is versioned 9 The three components of Subversion 9 1.3 Revision numbers 10 The old way 11 ■ Subversion revision numbers 12 1.4 Summary 14 2 Getting started 15 2.1 Getting Subversion 16 Which package to get? 16 ■ Installing on Windows 17 Installing on Linux 17 ■ Subversion is installed; what now? 18 Licensed to <null>
  • 11. vi CONTENTS 2.2 Command-line interface 19 Different clients 19 ■ Getting help 20 ■ Paths and URLs 21 2.3 Creating a repository 22 Finding a location for the repository 22 ■ Permissions 23 Svnadmin create 24 ■ Internal repository directories and files 25 2.4 Common options 26 Recursion 26 ■ Entering the log message 27 Accessing specific revisions 30 ■ Authentication 32 2.5 Importing your files into Subversion 33 A basic import 33 ■ Changing what you import 34 Changing where you import 35 2.6 Checking out the repository 35 Finding your starting point 35 ■ A simple checkout 36 The .svn directory 37 ■ Checking out specific versions 37 Changing the paths 38 2.7 Committing changes 39 A path to commit 40 ■ What and when do you commit? 40 Out-of-date transactions 41 2.8 Summary 43 3 Managing your working copy 44 3.1 Checking the state of your working copy 45 Understanding the status codes 45 ■ Running the status command 48 ■ Trimming your file list 49 ■ Getting more information 51 ■ Checking ignored files 51 ■ Repository changes 52 ■ When to use the status 53 3.2 Updating your working copy 54 Running the update command 54 ■ Update status codes 55 Updating to specific revisions 55 3.3 Conflicts 59 Resolution files 59 ■ Resolution scenarios 60 Cleaning up the conflict 64 3.4 Adding files and directories 65 Adding a single file 65 ■ Adding a directory and its contents 66 Wildcards 68 3.5 Copying 68 Where is my previous version? 69 ■ Making a local copy 70 Licensed to <null>
  • 12. CONTENTS vii 3.6 Moving and renaming 71 Moving files in the working copy 72 ■ Directories 73 Moving directly in the repository 74 ■ Implications of moving files on previous revisions 74 3.7 Removing files from the repository 75 Running the remove command 76 ■ Directories 77 3.8 Summary 78 4 Getting change information 79 4.1 Viewing change logs 80 Running the log command 80 ■ Change logs for directories 81 ■ Suppressing the log messages 83 Logs for specific revisions 84 ■ Viewing the change paths 87 ■ Stopping the change logs from a copy 89 Formatting the change logs 90 ■ Changing log messages 94 4.2 Getting a list of files 96 A simple list 96 ■ Verbose 97 ■ Revisions 98 ■ Recursive listing 98 ■ List from URL 99 ■ Old or nonexistent files 99 4.3 Comparing revisions 100 The diff syntax 100 ■ Running the diff command on your local copy 102 ■ Specifying revisions 103 ■ Running diff directly from the repository 105 ■ Using other diff programs 107 Running diff on directories 109 4.4 Looking at file contents 111 Running the cat command 111 Revision numbers 112 ■ URLs 112 4.5 Annotating a file 113 Running the annotate command 114 ■ Annotating specific revisions 114 ■ Directly accessing the repository 115 Be cautious when using annotate 115 4.6 Summary 117 5 Branches and tags 119 5.1 Branching overview 120 What is a branch? 120 ■ When should you use branches? 122 Branching strategies 124 ■ Project root layout 126 Licensed to <null>
  • 13. viii CONTENTS 5.2 Creating branches 130 Creating a branch from a working copy 130 Copying directly into the repository from a working copy 131 Creating a branch on a checkout 133 ■ Repository to repository 134 Creating a branch from a specific revision 135 5.3 Changing repository URLs 136 Recursion 137 ■ Moving repositories 138 Switching to an old revision 139 5.4 Merging revisions 140 A simple merge 140 ■ Moving changes from a branch 141 Merging a single file 142 ■ Conflicts 142 ■ Keeping track of your merges 142 ■ Doing a dry run 145 5.5 Tags in Subversion 146 5.6 Summary 147 6 Properties 148 6.1 Properties overview 149 Name/value pairs 149 ■ Properties are versioned 150 6.2 Adding a property to an object 151 Applying properties to a directory 152 ■ Passing in arguments as file contents 153 ■ Editing property values 155 Removing properties 156 6.3 Listing properties on an object 159 Listing the name and value 159 ■ Property listings on a directory 160 ■ Listing the properties of a specific revision 161 6.4 Getting the value of a property 161 Running the propget 161 ■ Getting properties on multiple files 162 Getting older revisions 162 ■ Removing extra characters from the output 163 6.5 Built-in properties 164 Ignore property 164 ■ Keywords 169 ■ Executable property 172 End-of-line style 173 ■ Externals 174 6.6 Revision properties 176 Default revision properties 176 ■ Adding properties 176 Viewing revision properties 177 ■ Changing the properties 178 6.7 Summary 178 Licensed to <null>
  • 14. CONTENTS ix 7 Repository administration 180 7.1 Backing up your repository 181 Dumping the repository 181 ■ Loading from a dump file 185 Creating a hot backup of a repository 187 ■ Exporting a non-versioned copy 188 7.2 Setting up network access with svnserve 189 Choosing between svnserve and Apache 190 Running the default configuration 191 ■ Svnserve configuration file 192 ■ Setting up authorization 194 ■ Changing the URL 197 Changing the svnserve network settings 197 ■ Running svnserve from the Linux xinetd 198 ■ Running svnserve with ssh 199 7.3 Setting up access with the Apache HTTP server 200 Getting the modules set up 200 ■ A basic setup 201 Multiple repositories 203 ■ Users and authentication 203 Configuring authorization 205 ■ Encrypting the transmission 208 Repository browsing 210 7.4 Summary 213 8 Advanced administration and configuration 214 8.1 Client-side configuration 215 Configuration files 215 ■ Configuring the server connection information 217 ■ SSL settings 220 ■ Command configurations 221 ■ Authentication caching 226 8.2 Resolving deadlocks 227 Working copy locks 227 8.3 Berkeley DB 229 Transaction logs 229 ■ Old transactions 230 8.4 Hooks 231 Commit actions 232 ■ Revision property actions 233 Scripts 234 8.5 Summary 240 9 Subversion utility clients 241 9.1 The svnlook interface 242 Transactions and revisions 242 Licensed to <null>
  • 15. x CONTENTS 9.2 Getting change log information 243 Getting the author 243 ■ Finding the date of a revision 244 Viewing the log message 244 ■ Getting all the change information 244 ■ Finding the files that changed 245 9.3 Getting information on properties 245 Listing the properties 246 ■ Getting the value of a property 247 9.4 Finding out what changed 249 Getting the differences between revisions 249 Viewing the entire contents of a file 250 ■ Finding the directories that changed 251 ■ Looking at the entire tree 251 ■ Getting change information on a directory 252 ■ Getting repository information with svnlook 253 9.5 Other Subversion programs 254 The svnversion tool 254 ■ The svndumpfilter interface 256 9.6 Summary 262 10 Third-party tools 263 10.1 Importing a CVS repository 264 Getting cvs2svn 264 ■ Creating a Subversion dump from CVS 265 Changing the project root information 268 Converting directly into a Subversion repository 269 10.2 Eclipse plug-in 271 Getting Subclipse 271 ■ Using Subclipse 272 Using the command line versus the plug-in 275 10.3 Subversion browsing over Apache with a browser 275 Configuration 276 ■ Using WebSVN 278 10.4 Windows graphical user interface 278 Installing TortoiseSVN 278 ■ Checking out a repository 280 Checking the status 281 ■ Committing to the repository 282 Running other commands 282 10.5 Summary 283 11 Subversion in a development lifecycle 284 11.1 Setting up your environment 285 Ignored files 285 ■ Using autoprops 285 Getting plug-ins and other tools 286 Licensed to <null>
  • 16. CONTENTS xi 11.2 Writing code 286 Bug fixes 287 ■ Patches 289 11.3 Promoting code 292 Properties 293 ■ Tags 294 ■ Automating code promotion 295 11.4 Testing and Subversion 296 Maintaining the testing environment 296 Locking down properties 297 11.5 Summary 297 appendix A SSL certificates 299 appendix B Building Subversion 307 index 313 Licensed to <null>
  • 18. xiii preface When the Apache Software Foundation accepted LDAPd, an open source LDAP server, as a new project in the incubator, I was “elected” to work with the Apache Infrastructure team to bring the source code over and get it into the CVS reposi- tory. Noel Bergman, the mentor for the project, suggested to the team that we use Subversion, a new version control system, instead of CVS. No one on the team, including myself, gave Subversion a very close look. We were all very excited to be a part of Apache and just wanted to get the project going. After all, Subversion had a different revision numbering system that nobody liked, we all had our sys- tems set up for CVS, plus Subversion had not yet even released a 1.0 version. So we took a vote on the Apache Directory project to stay with CVS. Despite our strong resistance to change, Noel stuck to his guns that Subversion was a better tool and it would be worth the relatively small effort required to learn it. After some discussion, Alex Karasulu, the project lead and creator of the server, asked me to investigate Subversion further and see what it had to offer. So I went to the Subversion web site and downloaded the tool. In about two minutes I had a repository created and some test files loaded. Hmm…that was easy. Then it was time to test one of the big claims: that Subversion can rename and move files and directories seamlessly. After years of struggling to do this in CVS, I had to see it to believe it. Part of the migration into Apache required switch- ing to a different directory structure, and I knew that would be a huge headache for me. This worked without a hitch. It took only one evening of playing around, and I was singing a different tune. Licensed to <null>
  • 19. xiv PREFACE After another discussion with Alex, it was time for a second vote with our new recommendations. There was some reluctance on the part of the team, but we decided to go with Subversion. I was fortunate to work with Noel and other mem- bers of the Apache Infrastructure team, who helped me migrate the code. Through this process I was able to get some great experience with Subversion and see its benefits. Over the next few months I became a bigger proponent of Subversion. As I talked to others in the development world, both open source and corporate, I didn’t get the enthusiastic response I expected. It occurred to me that developers still saw ver- sion control as a necessary evil, not a beneficial tool for software development. It was at this point that I wanted to write a comprehensive guide on Subver- sion. It was important to demonstrate to the development community not only how to run the commands but also how the tool can help the software develop- ment process. The staff at Manning also saw a need for this type of book, and so we started Subversion in Action. This book is not just the online help regurgitated with a few examples thrown in. While it will serve as a technical guide to using Subversion, more importantly, it will be a guide for using it as a tool in your software development. Licensed to <null>
  • 20. xv acknowledgments I would like to acknowledge my family for all their support and patience through this process, another one of my projects. There are many people along the way who helped me get to the point where I could write this book. First and foremost I need to thank Alex Karasulu. He opened many doors for me in the open source and technical communities (and sometimes pushed me through the doorway). I would also like to thank Noel Bergman for introducing me to Subversion and helping me through the learning process. None of this would have happened without the people who created, developed, and now support Subversion. The time, effort, and sacrifices it takes to create a project of this size are enormous—and this is all volunteer work. Thanks to all the people who either formally or informally reviewed the book as it was being written and gave input. These include Darin Riedlinger, Michael A. Koziarski, Doug Warren, Michael Oliver, Bill Fly, and James Rybacki. I would espe- cially like to thank Ryan Cox for his multiple passes through the book and great suggestions. All of the great people at Manning Publications really helped me get through this daunting task. I owe a great deal to the following folks: Licensed to <null>
  • 21. xvi ACKNOWLEDGMENTS ■ Marjan Bace, publisher of Manning, for refining my rough idea, training me without limiting me, and finally taking a chance on a rookie ■ Susan Capparelle for her help in coordinating the entire process and assiting me throughout ■ Ann Navarro, the book’s development editor, for all her guidance and support ■ Karen Tegtmeyer, who coordinated all the reviewers and the feedback ■ Mary Piergies, who managed the production of the book and kept things, including me, moving ■ Linda Recktenwald for her detailed editing of the book ■ Dottie Marsico and Gordan Salinovic for turning the text into a book ■ Helen Trimes for getting the book out there and known ■ Susan Forsyth for proofreading the book and getting me through the final stages Licensed to <null>
  • 22. xvii about this book How the book is organized Each chapter in the book is meant to extend your knowledge of Subversion. The first few chapters will give you a basic understanding so you can start using the software productively. The following chapters will show you how to take advantage of the power of Subversion. This means you don’t have read the book from cover to cover to use Subversion. In addition to using the book as a guide, you can use it as a reference. By following the headings, you can quickly find the information you are looking for. Let’s take a look at how the chapters are organized: ■ Chapter 1 gives you an introduction to version control in general and shows what Subversion brings to the table. ■ Chapter 2 gets you started using Subversion. Here you will install the software, create a repository, and start to access it. ■ Chapters 3 and 4 go through the common Subversion commands to manipulate files and get information out of the repository. ■ Chapter 5 discusses branching and tagging concepts and how Subversion implements them. ■ Chapter 6 describes properties, which are Subversion’s implementation of metadata. ■ Chapters 7 and 8 go into repository administration, including backups and network access, and then advance to such topics as client configuration and hook scripts. Licensed to <null>
  • 23. xviii ABOUT THIS BOOK ■ Chapter 9 explores the “extra” Subversion clients that give you more advanced capabilities to customize your implementation. ■ Chapter 10 reviews some of the common third-party tools that can enhance your development with Subversion. ■ Chapter 11 wraps up by showing how you can use Subversion in areas of development that may not fit the traditional view of version control yet still be valuable. Who should read this book Version control is something that affects many parts of an organization, open source or commercial, that does any kind of development. There are three main groups of people who need to know about the tool and the process behind the tool: ■ Developers: This is the obvious group who will benefit from the book. Not only will you learn how to use Subversion, but you will see ways it can help you with your software development. ■ Configuration managers: If you are responsible for the building, deployment, and migration of source code, you will need to have a better understanding of version control than even the developers. In addition to using Subversion, you will need to create scripts, automation, and the processes around the code. ■ System administrators: In many organizations, the people maintaining the infrastructure are separate from those who develop it. Even if you do not work with the code, you will have to install the software, set up access, configure the network, and create backups. These topics have been segmented so you can easily refer to them without having to go through all aspects of Subversion. Conventions The vast majority of Subversion is accessible from the command line. A command prompt will be indicated by the $ character. This will indicate the start of a com- mand, and you will not type the $ when running the command. For example, if you see something like the following: $ run a command Some output you will type everything on the first line, including the spaces, except the first $. The lines without the $ prompt are output from the command. All the commands and the output will be in code font, which tells you that the text is part of the com- mand or part of the output. For the sake of readability, some commands will span Licensed to <null>
  • 24. ABOUT THIS BOOK xix multiple lines in the example. To indicate this, a character will be placed at the end of line: $ run a command on two lines Some output In this example, you will type “run a command on two lines” as the actual com- mand. The output will follow the last line that does not end with . Source code While Subversion and version control in general are designed for software devel- opment, this is not a programming book. With that said, we will be working with code in many of the examples. The source code is oversimplified on purpose so you will not get caught up in figuring out what the program is doing (we will work with HelloWorld quite a bit). I intentionally switch from Java to C—and some- times text files—throughout the book to illustrate that Subversion does not care what it is storing. Author Online Purchase of Subversion in Action includes free access to a private web forum run by Manning Publications where you can make comments about the book, ask technical questions, and receive help from the author and from other users. To access the forum and subscribe to it, point your web browser to www.manning.com/machols. This page provides information on how to get on the forum once you are registered, what kind of help is available, and the rules of conduct on the forum. Manning's commitment to our readers is to provide a venue where a meaningful dialog between individual readers and between readers and the author can take place. It is not a commitment to any specific amount of participation on the part of the author, whose contribution to the AO remains voluntary (and unpaid). We sug- gest you try asking the authors some challenging questions lest his interest stray! The Author Online forum and the archives of previous discussions will be accessible from the publisher's web site as long as the book is in print. Licensed to <null>
  • 25. xx about the title By combining introductions, overviews, and how-to examples, the In Action books are designed to help learning and remembering. According to research in cogni- tive science, the things people remember are things they discover during self- motivated exploration. Although no one at Manning is a cognitive scientist, we are convinced that for learning to become permanent it must pass through stages of exploration, play, and, interestingly, re-telling of what is being learned. People understand and remember new things, which is to say they master them, only after actively explor- ing them. Humans learn in action. An essential part of an In Action guide is that it is example-driven. It encourages the reader to try things out, to play with new code, and explore new ideas. There is another, more mundane, reason for the title of this book: our readers are busy. They use books to do a job or solve a problem. They need books that allow them to jump in and jump out easily and learn just what they want just when they want it. They need books that aid them in action. The books in this series are designed for such readers. Licensed to <null>
  • 26. xxi about the cover illustration The figure on the cover of Subversion in Action is a “Hamal,” or common porter. The illustration is taken from a collection of costumes of the Ottoman Empire published on January 1, 1802, by William Miller of Old Bond Street, London. The title page is missing from the collection and we have been unable to track it down to date. The book's table of contents identifies the figures in both English and French, and each illustration bears the names of two artists who worked on it, both of whom would no doubt be surprised to find their art gracing the front cover of a computer programming book...two hundred years later. The collection was purchased by a Manning editor at an antiquarian flea mar- ket in the "Garage" on West 26th Street in Manhattan. The seller was an American based in Ankara, Turkey, and the transaction took place just as he was packing up his stand for the day. The Manning editor did not have on his person the substan- tial amount of cash that was required for the purchase and a credit card and check were both politely turned down. With the seller flying back to Ankara that evening the situation was getting hopeless. What was the solution? It turned out to be nothing more than an old- fashioned verbal agreement sealed with a handshake. The seller simply proposed that the money be transferred to him by wire and the editor walked out with the bank information on a piece of paper and the portfolio of images under his arm. Needless to say, we transferred the funds the next day, and we remain grateful and Licensed to <null>
  • 27. xxii ABOUT THE COVER ILLUSTRATION impressed by this unknown person’s trust in one of us. It recalls something that might have happened a long time ago. The pictures from the Ottoman collection, like the other illustrations that appear on our covers, bring to life the richness and variety of dress customs of two centuries ago. They recall the sense of isolation and distance of that period—and of every other historic period except our own hyperkinetic present. Dress codes have changed since then and the diversity by region, so rich at the time, has faded away. It is now often hard to tell the inhabitant of one continent from another. Perhaps, trying to view it optimistically, we have traded a cultural and visual diversity for a more varied personal life. Or a more varied and interest- ing intellectual and technical life. We at Manning celebrate the inventiveness, the initiative, and, yes, the fun of the computer business with book covers based on the rich diversity of regional life of two centuries ago, brought back to life by the pictures from this collection. Licensed to <null>
  • 28. 1 Introduction In this chapter ■ Introduction to version control ■ Overview of Subversion ■ New revision numbering paradigm Licensed to <null>
  • 29. 2 CHAPTER 1 Introduction I doubt this was planned, but the dictionary definition of “subversion” happens to provide a fitting description of Subversion’s social role: by subverting the com- manding position held for years by Concurrent Versions System (CVS), it is quickly becoming the de facto standard for open source version control systems. Many open source development communities are moving away from CVS and adapting Subversion, and this trend will only accelerate. If you want to be in on this trend—and take advantage of the best versioning system available for your group-development infrastructure—this book is for you. While other areas of software development such as IDE’s progressed, version control remained relatively stagnant, especially in the open source world. But as the practice of community software development caught on, it became apparent that the glue that allows people to work together in different places and at differ- ent times is their version control system. It also became clear that the old stan- dard, CVS, was becoming inadequate for supporting advanced open source development practices. From this need, Subversion was born as a product built by developers to make version control a seamless part of the development process instead of an impediment. If you find yourself involved in a live discussion that touches on Subversion, you might like to know that those in the know do not pronounce it as a single word, with the accent on “ver.” Instead, they say it as if it were two words, Sub version. Pronounce it as they do and your standing automatically improves. Now, having finished with that important matter, let’s turn to substance. Throughout this book, we will explore the features of Subversion that are making it the success it is and causing development communities and businesses to embrace it so quickly. Not only will we look at how the system works and what the commands do, but we will also tie it all in with your software development process. 1.1 Understanding version control First, it will help to understand the basics of a version control system in a generic sense. Think back to elementary school and remember the bespectacled figure of your librarian. She may have been stern but she knew where every book in the library was, who had it checked out, and when a new edition was coming in. A ver- sion control system plays a similar role, but without the thick glasses and the nasty shushing, of course. Rather than tracking books in a library, a versioning system manages files in a directory. It controls the files coming in and out and keeps track of who made the change. It also provides the useful capability to get back an old revision of a file. Licensed to <null>
  • 30. Understanding version control 3 1.1.1 Why use version control Have you ever been in a situation where something in a file changed and you asked, “What did that file look like before—when it worked? When did this file change? Who changed it?” I often find myself looking at an edit I made in the past and wondering why I made it. A version control system gives you the answer to these questions. It also gives you the tools to manage your code better by provid- ing features such as the following: ■ Helps you manage code by tagging specific versions as a release of the software ■ Allows you to add automation to manual tasks through the use of hook scripts, which run when triggered from an action ■ Allows for multiple users to work on the same file without losing any changes ■ Provides the ability to start another development path from the same code base and then merge the two paths back together ■ Efficiently stores multiple versions of a file by keeping only the changes to each version instead of an entire copy Let’s take a look at how some of these features are implemented by exploring some of the technical aspects of a version control system. 1.1.2 The repository The core of any version control system is the repository, which is a basically a souped-up filesystem. It tracks the changes to files and allows multiple users con- current access. Each time a modified file is saved to the repository, a new revision of that file is created. These revisions contain not only the contents in the file that changed but also external information, such as who changed it and when it was changed. In a standard filesystem, you access and edit files directly; not so in a repository. Instead, the system has a client interface that does the reading and writing to the repository for you. This client talks to the repository and allows for the transparent implementation of all the features we just described. 1.1.3 Checkout strategies We know repositories do not allow direct access to the files and directories, so you need a way to get at your code. To accomplish this, you perform a checkout, which is a request for a copy of the file through the client. You can check out one file, a directory, or the entire repository. This is similar to checking out a book from a library. You go to a central location and get a copy of a book, or in the case of a Licensed to <null>
  • 31. 4 CHAPTER 1 Introduction repository, a file. If a new edition or revision comes out, you go back and check out the new one. Copy-modify-merge. Many version control systems, including Subversion, use a checkout strategy called copy-modify-merge. In this model, when you perform a checkout, you get a working copy of the file in a local directory on your machine. This is a snapshot of the repository where you will make your changes independently of other developers. When you have finished with your changes, you copy the file, main.c in this example, back into the repository. Figure 1.1 illustrates this workflow. Then, when another developer checks out the file main.c, it will include your changes, and that person will follow the same process. If you are making changes at the same time as someone else, the flow will look something like figure 1.2. main.c Repository main.c Checkout Client working copy main.c (changed locally) Client working copy Changes to file main.c (new revision) Merge and Save changes Repository Figure 1.1 Workflow in the copy-modify-merge model Repository Client working copy for Alex main.c (revision 1) Client working copy for Jeff main.c (merged from revision 2 and local copy) main.c (revision 3) main.c (changed locally) main.c (changed locally) main.c (revision 1) main.c (revision 1) main.c (revision 2) Figure 1.2 Workflow in the copy-modify-merge model with multiple users Licensed to <null>
  • 32. Understanding version control 5 This merge will happen automatically if the two changes do not conflict, which would happen if the users made changes to the same line in the file. It is impor- tant to understand that these conflicts are strictly based on whether or not the sys- tem can merge the data within the file. There are no logical checks that take place to ensure that you did not muck up the source code, so you are responsible for the logical validation of the change. 1.1.4 Commit and update Version control systems that use the copy-modify-merge model create a working copy of the repository for you to make your changes. You also need a way to save your edits back to the repository. The process of applying your changes into the repository is called committing (some systems call this check in). When you perform a commit from your working copy, the system will find the files that have changed and compare them against the latest version in the repository. If there are no con- flicts, a new revision of the files will be created and saved in the repository. Once you commit, the repository will be in sync with the changes in your working copy, but this is only half the battle. If you develop in a vacuum, the checkout and commit give you everything needed to keep the repository and working copy in sync, but this does not happen in the real world. While you were editing your working copy, Alex committed his changes to the repository. So not only do you need a way to get your changes into the repository, you need a way to get any changes made to the repository back into your working copy; this is done with an update. An update is a specialized checkout that gives you only the changes in the repository since your checkout or last update. You know that a commit saves your changes back to the repository, but remem- ber that there is more to a version control system than just file contents. When the commit occurs, a record of the change is also saved. This record is called a change log and is one of the components that gives the answer to those who, when, and why questions we have been trying to answer. 1.1.5 What are change logs? One of the reasons for using a version control system is to get more information about a change than just the content difference in a file between revisions. This additional information is stored in the change log and is attached to each revision of a file. Let’s take a look at a typical change for the file main.c in figure 1.3. Licensed to <null>
  • 33. 6 CHAPTER 1 Introduction Each revision’s change log for the file main.c has the same set of information and is ordered by date in descending order. The top line of each change log is the sys- tem information. The line(s) following the system information is the log message. This is a description of the change for that revision, which the user adds as part of the commit. Since the log message is added by the user, the quality of the message will depend on that developer’s attention to detail. When developing software for the long term, it is important to be descriptive when writing the log message. It should be clear to all users why you are making the change and what the problem and fix are. To see how nondescript messages can be a problem, look at the following log message: ----------------------------------------------------------------- r3 | jeff | 2004 -03 -13 13 :46 :28 -0500 (Sat , 13 Mar 2004 ) |1 line Fixed bug . ----------------------------------------------------------------- r2 | alex | 2004 -03 -13 10 :45 :56 -0500 (Sat , 13 Mar 2004 ) |2 lines Added main function . We only had a program stub to this point ----------------------------------------------------------------- r1 | jeff | 2004 -03 -06 14 :16 :03 -0500 (Sat , 06 Mar 2004 ) |1 line Initial Version ---------------------------------------------------------------- Revision number of the change log ID of the user who made the change Date and time revision was saved to the repository Log message entered by the user when the new revision was created Number of lines in the log message Figure 1.3 Change log information provided by subversion Licensed to <null>
  • 34. Understanding version control 7 --------------------------------------------------------------------- r3 | jeff | 2004-03-13 13:46:28 -0500 (Sat, 13 Mar 2004) | 1 line Bug Fix --------------------------------------------------------------------- The log message simply says “bug fix.” While this may make sense to the developer at the time of the change, it will probably not make sense in the future and likely won’t help other developers who look at it. The only way to get any details about the change is to look at the content differences between revisions. This can be tedious and will not always give you the answers you are looking for. Even if you see the differences in the contents of the file, you still may not know why the change was made. Instead of just saying “bug fix,” consider using something like the following message: --------------------------------------------------------------------- r3 | jeff | 2004-03-13 13:46:28 -0500 (Sat, 13 Mar 2004) | 3 lines Bug Fix number 2255. The application is supposed to print a message when it starts. This message did not print because it was directed to STDERR. Adjusted the startup println statement to STDOUT --------------------------------------------------------------------- This log message is clear. Now you can easily see what was fixed, which can drasti- cally cut down your research time. If your development process uses a bug-track- ing tool, you can include the tracker number in the log message for a quick and dirty integration. Change logs provide the basic information in a version control system, but you are not limited to this data. You can add your own customization and information to a version by using properties. 1.1.6 The role of properties Today’s version control systems are much more than simple repositories for stor- ing old versions of source code; they help you manage your development process. For example, most software you develop will have releases. You will want a way to associate a particular version of a file, or more likely multiple files, with a particu- lar release of the entire application. So, for example, you can say that release 2.0 of the application uses revision 10 of the file main.c. In order to accommodate this, version control systems have something called properties, also known as meta- data. This is simply some user-defined piece of information that is associated with a file or revision of a file. If we stick with the analogy of a library, using properties Licensed to <null>
  • 35. 8 CHAPTER 1 Introduction to track releases of your software is similar to using a card catalog system. It allows you to easily track and find your files and see what state they are in. So using properties, you can assign the name of the application release to a revi- sion of the file to track the progress through the releases of your software. Figure 1.4 illustrates how this would look in a version tree for a file called hello.c. The file hello.c has four revisions in the repository; three are associated with a particular release of your software. If version 2.0 of the application needs to be built, revision 4 of hello.c will be used. Versions not associated with a tag are either just checkpoints for a developer to save his work or not production worthy. You can use properties for any kind of custom information that is required in your development process. 1.2 30,000 foot view of Subversion Now that you have an understanding of what most version control systems pro- vide, we can better examine what is different about Subversion. Right off the bat, we know that Subversion uses current open source tools to fill needs that do not directly deal with version control. The following is a list of the key open source tools used: ■ Berkeley DB is used for a back end, which provides an efficient storage facil- ity in terms of speed and memory. ■ The Apache Portable Runtime libraries are used, eliminating the need for operating system–specific code. ■ The Apache HTTP server is used for the network protocol, which gives built-in security and web-browsing capabilities. In addition to utilizing current technologies, Subversion has a few innovations that give it additional advantages. Let’s look at some of them. hello.c Application_1.3 Application_2.0 Rev 4 Rev 3 Rev 2 Application_1.2 Rev 1 Figure 1.4 Tags in the version tree Licensed to <null>
  • 36. 30,000 foot view of Subversion 9 1.2.1 Atomic commits “Atomic” means one global change to the repository, no matter how many files have changed. For example, say you make changes to five different files, instead of five new files being created in traditional systems, Subversion creates one new repository with all the changes. There is one revision number and one change log in an atomic commit, as opposed to one for each file. Don’t worry if this concept is not crystal clear yet; as you move through the book, it will make sense and the reasons why this was implemented will become obvious. 1.2.2 Everything is versioned If you have been in software development for any length of time, you have proba- bly been in a situation similar to this. You come in to work on a Monday morning to find your mailbox full of user complaints that a function in your software doesn’t work anymore, but you haven’t made any changes to the source code in two weeks. After some probing, you find out that this function gets run only annu- ally, so the last time it worked was a year ago. Of course, there have been a dozen releases and patches to the software since last year. In order to see if a code change broke the function, you will need to travel back in time to re-create the repository at that point, build the application, and see if the problem exists. This ability to “go back in time” turns out to be a very powerful feature. Any version control system can get the file contents back easily enough, but there may be more to it than that. For instance, what if some files were moved to different directories? Then you would need to fix the paths in your build scripts. If you are using tags or labels on the files to determine what was in production, there is no way track this unless you manually record it somehow. Subversion not only tracks changes to a file’s contents, it also versions directories and properties, which allows you to return the repository back to its original state, which consists of more than just file contents. 1.2.3 The three components of Subversion Subversion consists of three components: the filesystem, the network, and the cli- ent. The filesystem component is the Subversion repository that stores the files and change logs. The client component is the set of libraries and command-line programs the user will run to access the repository. The network component can be used if the access to the repository is not local—it acts as an intermediary between the filesystem and the client. For local access, the client talks directly to the filesystem. Figure 1.5 shows the coupling points of the components. Licensed to <null>
  • 37. 10 CHAPTER 1 Introduction Each component is a standalone module and can be changed out without affect- ing the other two. So how does this modularity help you? First, it allows you to access the repository over the network or locally on the host. In addition, this design provides more third-party and vertical tools to sit on top of Subversion, and you can easily snap in different network protocols or client interfaces. 1.3 Revision numbers Subversion has developed a new paradigm for identifying version numbers in a repository, one that is based on repository commits and not individual file changes. This is a little different than traditional version control systems, so it may take some getting used to. Local Access Network Access Network API Filesystem API Network Protocol Filesystem API Client API Client Libraries Network API Repository Figure 1.5 Subversion component coupling points Licensed to <null>
  • 38. Revision numbers 11 1.3.1 The old way In traditional version control systems, each file has its own revision number, which is an incremental decimal. So the revision numbers for a file would be 1.1, 1.2, 1.3, etc. There will not be any gaps because each time the file is changed, it is incremented off its own revision number (unless it is manually changed). To see how this can be a deficiency, consider two files: main.c is at revision 1.2 while hello.c is at revision 1.1. If a change is made to both files and committed to the repository, the output of the two logs would look something like this: File: main.c head: 1.3 ---------------------------- revision 1.3 date: 2004/03/09 18:23:14; author: alex; state: Exp; lines: +3 -0 Added author tags to source files that were missing it ---------------------------- revision 1.2 date: 2004/03/09 18:21:19; author: jeff; state: Exp; lines: +1 -0 Added print statement so we know it started ---------------------------- revision 1.1 date: 2004/03/09 18:16:45; author: jeff; state: Exp; branches: 1.1.1; Initial revision ---------------------------- File: hello.c head: 1.2 ---------------------------- revision 1.2 date: 2004/03/09 18:23:14; author: alex; state: Exp; lines: +4 -0 Added author tags to source files that were missing it ---------------------------- revision 1.1 date: 2004/03/09 18:16:45; author: jeff; state: Exp; branches: 1.1.1; Initial revision ---------------------------- Since the revision numbers are just sequential, main.c moves to 1.3 and hello.c is now at 1.2. There is nothing that ties the two revision numbers back to your change. The only way to tell which versions of files trace back to the same change is to look at the log file. This is fine if you are comparing files that you are aware of. What if a change caused your application to go bonkers, and you need to trace Licensed to <null>
  • 39. 12 CHAPTER 1 Introduction back to see what has been modified? To see how difficult this can be to trace, look at how the changes are correlated in the version tree in figure 1.6. As you can see, it is difficult enough to trace changes with only two files. The same commit produced revision 1.2 of the file hello.c and revision 1.3 of main.c. In order to find all the files affected by a change, you will have to look through all your files for either a time stamp or specific log message. To get around this prob- lem with most traditional version control systems, you will need to create a label and attach it to each new file revision. Unless you create a system to tag all previ- ous revisions of a change, it will be difficult to back out of a change. 1.3.2 Subversion revision numbers With the atomic commits, Subversion tracks changes using a per-commit basis, not per-file. Instead of each file maintaining a separate revision num- ber, Subversion has one global revision number for the repository. The num- ber starts at 0 when the repository is created and is incremented by a whole number each time a commit happens. Conceptually, each commit creates a new copy of the repository with the changes applied. Files that do not change on a commit simply have identical copies created in the new reposi- tory, although they are stored more efficiently than a complete copy. Let’s Added author tags to source files that were missing it Added print statement so we know it started Initial Revision Rev 1.3 Rev 1.2 Rev 1.1 Rev 1.1 Rev 1.2 main.c hello.c Figure 1.6 Version tree with traditional version numbering Licensed to <null>
  • 40. Revision numbers 13 take a look at what the log files would look like in Subversion going through the steps in the previous example: File: main.c -------------------------------------------------------------------- r3 | alex | 2004-03-09 22:32:34 -0500 (Tue, 09 Mar 2004) | 1 line Added author tags to source files that were missing it -------------------------------------------------------------------- r2 | jeff | 2004-03-09 22:30:42 -0500 (Tue, 09 Mar 2004) | 1 line Added print statement so we know it started -------------------------------------------------------------------- r1 | jeff | 2004-03-09 22:28:18 -0500 (Tue, 09 Mar 2004) | 1 line Imported Sources -------------------------------------------------------------------- File: hello.c -------------------------------------------------------------------- r3 | alex | 2004-03-09 22:32:34 -0500 (Tue, 09 Mar 2004) | 1 line Added author tags to source files that were missing it -------------------------------------------------------------------- r1 | jeff | 2004-03-09 22:28:18 -0500 (Tue, 09 Mar 2004) | 1 line Imported Sources -------------------------------------------------------------------- What should stand out when you compare the two log histories is that the file hello.c jumps from revision 1 to revision 3. Many people (including myself) cringe the first time they see this. Once you stop and think about it, this method makes more sense. When you commit to the repository, you are applying a set of common changes. If the revision number for each file is the same, it is easier to trace and back out if necessary. This also makes it easier to check out the repository at a specific point. The reason for the ease is that all changes are at the same level in the version tree, as figure 1.7 shows. Unlike the traditional numbering scheme we saw earlier, in Subversion all the files that were changed by the commit to add the author tags are part of revision 3. When you check out a specific revision of the repository, you will get the high- est revision of each file less than or equal to the number specified. So using the files hello.c and main.c from our previous example, you check out revision 2 of the repository. Since main.c has a revision 2, you will get that copy. Because hello.c does not have a revision 2, it will go down to revision 1. Since the commit is considered to be at a repository basis, the change log information is stored at the repository level instead of the file level. This means that instead of each file Licensed to <null>
  • 41. 14 CHAPTER 1 Introduction revision containing the author, date, and change log, this information is kept only once in the repository. This actually allows Subversion to be more efficient in terms of storage. It also allows for easier maintenance; if you need to adjust the change log, you need to do so in only one place instead of every file. 1.4 Summary We have discussed concepts such as atomic commits and the copy-modify-merge model at a high level, but these may not be perfectly clear to you yet. As you read through this book and explore the commands, these concepts will become sec- ond nature. Just remember that it will be up to you to keep your working copy in sync with the repository, with both your changes and those of other developers. You are now ready to dive into Subversion! Whether you are a novice to traditional version control systems or a seasoned veteran, the best way to learn how to use this tool is to walk through the steps as we discuss them. Don’t be afraid to experiment and try different things. If you create a test repository, the worst case would be that you blow it away and have to start over. If you are brand new to version control systems and are feeling a little wary, don’t worry. You can easily set up and destroy test repositories to get the feel for them. We will go through Subversion sequentially, starting with creating a repository. Added author tags to source files that were missing it Added print statement so we know it started Initial Revision Rev 3 Rev 3 Rev 1 Rev 2 Rev 1 hello.c main.c Figure 1.7 Version tree with Subversion revision numbers Licensed to <null>
  • 42. 15 Getting started In this chapter ■ Get and install Subversion ■ Get around the command-line interface ■ Create a repository ■ Basic work cycle—getting a file in and out of Subversion Licensed to <null>
  • 43. 16 CHAPTER 2 Getting started Now that you have an understanding of the high-level features of a version control system, we can start examining the details of Subversion. By the end of this chap- ter, you will be making changes to your code and saving them to the repository. While the next two chapters will ease you into working with Subversion, there will still be a bit of theory thrown in. This is not intended to make you an expert in the theory behind version control, but it is important that you understand and become efficient with these concepts. The goal is to make using Subversion sec- ond nature so it will improve your software development, not hinder it. 2.1 Getting Subversion Before you can jump into using Subversion, you will have to go out and get it. As its popularity grows, it is being bundled with other software packages such as Fedora Linux. Despite this trend, you will be better off going to the Subversion web site and downloading it. This is a fast-moving application, so a bundled distribution such as Fedora will likely be outdated by the time you install it. The software can be downloaded from http://subversion.tigris.com/project_packages.html. 2.1.1 Which package to get? Subversion has binary distributions for multiple operating systems, including Win- dows and most flavors of Linux. When given the option, it is usually quicker and easier to use these, as opposed to building the source code. The install and dependencies are different for each distribution, but they use the standard install system for the particular OS. For example, the Red Hat distribution is an RPM (Red Hat Package Manager) file, FreeBSD uses pkgsrc, and Windows is just an .exe file. If your operating system does not have a binary package, or you need a bleeding-edge release, you will have to compile Subversion. While this may take a little more effort than running an .exe, it is not impossible. You will also need to choose which release of Subversion is right for you. This is a decision that will depend on how in-depth you are going to use the tool and which features and bug fixes come out in new releases. A general rule of thumb is that if you aren’t sure which version to get, you should use the latest stable release. The Subversion web site contains change logs for the releases that will tell you what has been fixed or added. You can look through these logs to see if a particu- lar version is right for your environment or if it is time to upgrade. It is difficult to describe in great detail how to navigate through the site because it is constantly evolving. Once Subversion reaches a maturity level, the web site and distributions will likely follow. Licensed to <null>
  • 44. Getting Subversion 17 Don’t get hung on up on distributions. With all of the different operating systems and configurations, it is impossible to cover all or even most of the possibilities. If you are trying to learn Subversion, don’t let getting the correct distribution or compiling become a roadblock. Most people have access to a Windows or Red Hat workstation. This is all you need to start using Subversion, and you won’t get frus- trated and give up because you can’t get it installed. 2.1.2 Installing on Windows The Windows install of Subversion is more straightforward than that of the other operating systems. There are no dependencies, and you need to download only one .exe file. Go to the Downloads link on the web site and select the Win32 dis- tribution. After you figure out which release fits your needs, find the appropriate file in the list. The name of the file will be svn-x-x-x-setup.exe, where x-x-x is the release number. You will not need any of the files with other identifiers such as dev or pdb in their name. These are for development only. Once you have identified the file, you can download and execute it. When you run the program, it will launch a basic Windows installer program. You will get the standard prompts such as accepting the license agreement and where to install the application. After you step through all the setup questions, the binaries will be placed in the target directory. Even though you are provided with a graphical installer, these are still command-line programs, so they must be run at a Windows command prompt or another shell such as cygwin. Some graphical tools are being developed to get around the command line; we’ll discuss these later. 2.1.3 Installing on Linux We will use Red Hat or Fedora as the Linux distribution to examine using the RPM binaries, but the process is the same for any version. In any of the Linux distribu- tions, there are some dependencies you need to worry about, but this is still a rel- atively painless task. On the Downloads page, select Red Hat Linux, and you will see a list of the different versions of the OS. Select the appropriate one, and a page with a number of RPMs will open. For a normal install you will need the fol- lowing packages, which need to be installed in the order listed: ■ apr-x-x-x...rpm—Apache portable runtime libraries ■ neon-x-x-x..rpm—DAV protocol libraries ■ subversion-x-x-x.rpm—Subversion client ■ subversion-server-x-x-x.rpm—Binaries to run the Subversion server Licensed to <null>
  • 45. 18 CHAPTER 2 Getting started Each of the packages will have a version number appended after the filename. You must also be careful not to get the “dev” RPMs. These will have the same filename except they contain the word dev in between the base name and the revision num- ber. Also, you will need only the server package if the repository needs to be accessed over the network. You can just use the default rpm install command. If your oper- ating system is missing any dependencies, the install will notify you. You will find some of these package in the same location where you downloaded Subversion, so that is a good place to start looking should the need arise. 2.1.4 Subversion is installed; what now? Unless you are accessing Subversion over the network protocol (we will discuss this setup in chapter 7), there is nothing else you need to do. There is no service or daemon that needs to run; all the access is done through clients accessing the repository layer. To see if everything is working correctly, you can run the svn cli- ent with the --version option: $ svn --version svn, version 1.1.0 (Release Candidate 1) compiled Aug 6 2004, 21:01:15 Copyright (C) 2000-2004 CollabNet. Subversion is open source software, see http://subversion.tigris.org/ This product includes software developed by CollabNet (http://www.Collab.Net/ ). The following repository access (RA) modules are available: * ra_dav : Module for accessing a repository via WebDAV (DeltaV) protocol. - handles 'http' schema - handles 'https' schema * ra_local : Module for accessing a repository on local disk. - handles 'file' schema * ra_svn : Module for accessing a repository using the svn network protocol. - handles 'svn' schema This will tell you which version of Subversion you have, plus which modules are installed. You should see the three modules listed above, unless you skipped the Apache server package. If one of the modules is missing, you cannot access your repository using that method. For example, if ra_dav is not listed, you will not be able to set up the repository using the Apache HTTP protocol. Licensed to <null>
  • 46. Command-line interface 19 2.2 Command-line interface Subversion comes with a set of command-line interfaces called clients, which are used to perform all of the tasks. Unless you have a third-party tool to provide the interface to Subversion commands (we will talk about these in chapter 10), these clients will be the way you interact with the version control system. As a result, it is important to understand how these work and how to get around them, in addition to the concepts behind them. For example, consider an application such as Word. You may know that you want to underline a section of text, but if you do not know how to get around the GUI, you will have trouble using the tool. The same holds true for Subversion; you know that you need to commit to the repository, but if you don’t understand the syn- tax, this simple process will be more complicated. This section will guide you through the clients in Subversion, so that you can use the tool more proficiently. There are three Subversion command-line interfaces, each with a different pur- pose; we’ll describe these in the next section. They are simply executable com- mands; you pass in the operations (subcommand) and the specific options for that command. This is the same for Windows and UNIX-based operating systems. All the executables will reside in the $SUBVERSION/bin directory; if you set up your PATH environment variable as described in the previous section, you will be able to run these commands without specifying the entire path. While the clients will allow you interchange the order of the subcommands and options, for clarity you should use the following syntax: client_name <subcommand> [options] [arguments]. 2.2.1 Different clients Subversion provides multiple interfaces for different uses. This allows for a clear separation of tasks between users and administrators. User client. The svn client makes up the bulk of Subversion; this is what the users will run to perform the actual version control commands. This interface was made to feel like CVS where possible to provide an easy transition for those who are new to Subversion. Administrator client. Subversion provides a separate client called svnadmin for per- forming administrative and maintenance functions on the repository. Having this cli- ent provides a clear separation of duties in Subversion, keeping the user client cleaner and easier to use, in addition to facilitating better security. Since the administrator cli- ent works on the repository, it must be run on the local repository machine, not over a network. As a result, all arguments referencing a repository are in the PATH format, not URL. See section 2.2.3 for more information on PATH and URL. Licensed to <null>
  • 47. 20 CHAPTER 2 Getting started Browser client. The svnlook client is a tool that will browse a repository without making any changes. It has many of the information-gathering commands of the user client such as diff, cat, and history. We will see how these commands work in the user client over the next few chapters. When we discuss repository adminis- tration, these commands will be examined from the point of view of the svnlook client. This client is good for use in trigger or hook scripts to collect information on the repository. Just like the svnadmin client, this client is run on the reposi- tory host, so it accesses the repository via PATH and not URL. 2.2.2 Getting help While all the clients provide different operations, they all parse the command-line input the same way. The first thing to note is the help for each of the clients. The help provided by the clients is a good reference, but that is usually the extent of the information provided. Running a client with help as an argument will list all available subcommands for that client. To get additional help on a specific sub- command, simply pass that subcommand as an argument. For example, let’s look at the help for the checkout command: $ svn help checkout checkout (co): Check out a working copy from a repository. usage: checkout URL... [PATH] Note: If PATH is omitted, the basename of the URL will be used as the destination. If multiple URLs are given each will be checked out into a sub-directory of PATH, with the name of the sub-directory being the basename of the URL. Valid options: -r [--revision] arg :ARG (some commands also take ARG1:ARG2 range) A revision argument can be one of: NUMBER revision number "{" DATE "}" revision at start of the date "HEAD" latest in repository "BASE" base rev of item's working copy "COMMITTED" last commit at or before BASE "PREV" revision just before COMMITTED -q [--quiet] : print as little as possible -N [--non-recursive] : operate on single directory only --username arg : specify a username ARG --password arg : specify a password ARG --no-auth-cache : do not cache authentication tokens --non-interactive : do no interactive prompting --config-dir arg : read user configuration files from directory ARG Licensed to <null>
  • 48. Command-line interface 21 There are a few things to understand about the syntax that will help you use Sub- version effectively. First, notice the description line, specifically the text in the parentheses. Many of Subversion’s commands will have multiple names; in the case of the checkout command, it has one alias, co. While this may seem confusing at first, many users prefer the shorthand or, in some cases, a “backward compati- bility” feel for other version control systems such as CVS. Next, it is worthwhile to understand the usage notation if you are not familiar with it already. The usage will specify which options and arguments the command will be expecting for input. When an option or argument is enclosed in brackets, it indicates that this not required. In most cases for optional arguments, the help will tell you what the default behavior for the command will be. As you can see from the checkout help, if you omit the PATH argument, it will be substituted with the base name from the URL. Figure 2.1 shows an example of a Subversion command line and the differ- ent componentsIt is important to understand what the default values are for optional arguments so you know what is going to be affected by the command. Finally, all the possible options for the command are listed. 2.2.3 Paths and URLs Throughout Subversion, you will see the different notations for referring to loca- tions in a directory or repository. The two will we will focus on now are PATH and URL; other administrative commands have other notations and will be addressed later. A PATH is simply a standard operating system directory. This notation is used for performing operations on working copy files and also for accessing the reposi- tory with the administrative client on the local machine. The second notation is URL, which is used when referring to a repository. Just like accessing a web site, a svn cat -- revision 25 /home/jeff/myrepo/source/c/hello.c client subcommand optional argument required argument Figure 2.1 Command-line syntax Licensed to <null>
  • 49. 22 CHAPTER 2 Getting started Subversion URL is a protocol followed by a path with the following notation: pro- tocol:///absolute/path. Depending on how you access your repository, you will use one of the protocols described in table 2.1. For example, if you are accessing a repository on the local system in the directory /repos/testrepo, your URL would be file:///repos/testrepo. If the local host- name is Pluto and you are accessing the same repository over the network, it would look something like the following URL: http://pluto.domain.com/repos/ testrepo. 2.3 Creating a repository Before you can start working with Subversion, you need a repository. If you have access to an existing one, great; if this is not the case, don’t worry. Creating a repository is a surprisingly simple task in Subversion once you understand the basics of permissions and where the repository should be located. When you cre- ate a repository, all of the databases and configurations will be set up for you. Also, if you are creating one just for trying out some of the commands and concepts we will be discussing, getting the permissions and details is not critical. Once you are ready to create a production repository, the specifics we will be talking about come into play. 2.3.1 Finding a location for the repository The first step to creating a repository is finding a place for it to reside. All reposi- tories reside on local filesystems; they can be accessed locally or over one of the Table 2.1 Repository access protocols Protocol Description Authentication Port http Uses the http protocol to access an Apache web server with WEBDav/DeltaV pointing to the Subversion repository filesystem Yes 80 file Accesses a local filesystem No NA svn Uses the custom Subversion protocol Yes 3690 https Uses the https (http + SSL encryption) protocol to access an Apache web server with WEBDav/DeltaV point- ing to the Subversion repository filesystem Yes 443 svn+ssh Uses the custom Subversion protocol but with SSH Yes 3690 Licensed to <null>
  • 50. Creating a repository 23 network protocols listed in table 2.1. Repositories can be created anywhere on the local host with one exception; they should not be created or accessed on directo- ries that are shared, including Windows shares, NFS, and Samba. You may be tempted to try this, thinking that you can use the local filesystem access URL (file://) and just mount it on a network share. Remember, Subversion uses Ber- keley DB as the filesystem store; the way locking works in the database does not support access over a shared filesystem. If you try this, it may appear to work, but you will get unpredictable results and eventually put your repository in a bad state. If you need to access the repository over the network, you can use one of the protocols provided. Information to set these up can be found in chapter 7; for now we will use just local filesystem access. Be sure the directory you use has enough space for the source code plus the back end. Subversion is a very efficient version control system in terms of disk space, but the size of the repository will be bigger than just the files you are load- ing. The size will depend on factors such as the number of changes, metadata attached to the files, and how your logging is set up. Unfortunately, there is no formula you can use to determine the amount of space needed. As you add con- tent to the files and change logs, the filesystem will grow. The good news is that this will grow by only the size of the change, so it is more efficient than storing entire copies of files. Once you know where you want your repository, you will need to create the subdirectory for it. There is no standard or rule to the naming of the repository path. From here on, we will use /repos as the directory all Sub- version repositories will be placed in. If you want your repository to be called testrepo, simply create the subdirectory /repos/testrepo. 2.3.2 Permissions The method or protocol you use to access your repository will guide you in how the permissions will be set up for the Berkeley DB filesystem. While the examples will be in a Linux environment, the same concepts apply to a repository on a Win- dows machine. No matter if your users access the repository from the local machine or one of the network protocols, you should have the directory owned by a “system” user. You may want to create a user and a group called svn, or some derivative of that. This user should create all the repositories. You can also use this ID to perform administrative tasks on the repository. Even if there are only one or two users on a system, you should stick to this practice. If you keep the owner and administrator of the repository separate from the day-to-day users, the risk of caus- ing problems will be greatly decreased. Just as in a UNIX environment, you should not do your work as root. Licensed to <null>
  • 51. 24 CHAPTER 2 Getting started Permissions for network accessed repositories. When setting up permissions for a network repository, you have two options. The first option is to simply add the net- work user to the group that owns the repository. You would pursue this option in an environment where you access the repository over the network and locally. This is perfectly legitimate and can be used when security does not need to be extremely tight. The second option is to have one user with the permissions to access the repository at a filesystem level. This user would be the same ID that runs the Apache or svnserve process. Thus, the directory permissions would look the same as the previous listing, but the only user in the svn group would be the apache user, for example. This will prevent users on the repository machine from having the ability to directly write to the DB files. UNIX users—Check your mask. No matter whether you connect to the repository locally or over a network protocol, it is critical to make sure the umask of the user is set correctly. Users, through the client interfaces, will create files in the Berkeley DB while working in Subversion. If the umask is set improperly, the files will be created with the wrong permissions. When other users try to access these files, they will get permission-denied errors. At a minimum, the umask should be set to 002. This goes not only for local users but also for the ID running the network ser- vice. You may have to set the umask for a network user in the startup script to be sure it is correct. This can easily be done in the Apache configuration file for the case of one network user. If users are accessing the repository locally, you will need to set all their umasks. If this is a security issue, you will have to write a wrap- per script to svn that sets the umask and then calls the real svn command. For example, the following simple script will accomplish this for you: #!/bin/bash umask 002 /usr/local/bin/svn $* Assuming Subversion has been installed in /usr/local/bin, this simple wrapper will change the umask for the duration of the script and then call the real svn command with the same parameters passed into it. 2.3.3 Svnadmin create Once you have determined the location for your repository, the actual creation is extremely simple. The Subversion admin interface has a utility called create. This command is run locally from the machine on which the repository will reside. All it requires for an argument is the path to the repository directory: $ svnadmin create /repos/testrepo Licensed to <null>
  • 52. Creating a repository 25 Congratulations, you have just created a Subversion repository! That’s all there is to it. This will take only a few seconds and then return you right to the command prompt. There are not many options that can be used with the create operation. The few that do exist are advanced and do not need to be addressed now. 2.3.4 Internal repository directories and files If you are curious and look in the /repos/testrepo directory, you will see a bunch of subdirectories. Table 2.2 briefly describes the files and directories in the reposi- tory directory. Most users will not have to work in these directories, especially if you are not sure about what they do. When we discuss advanced topics such as repository configuration and maintenance, we’ll explain the use of these directo- ries. Out of the box, Subversion provides a robust implementation that will pre- vent the need for accessing these areas. Permissions for locally accessed repositories. For repositories accessed on the local machine, you will use the operating system group permissions to control authori- zation. The easiest way to do this is simply add the users who need access to the repository to the svn group you created previously. Make sure that the repository directory is recursively in this group and the group write permissions are turned on. Your listing should look like the following: $ ls -ltr total 28 -rwxrwxr-x 1 svn svn 376 Mar 23 20:52 README.txt Table 2.2 Repository directories and files Name Description README.txt A brief text file that indicates the directory is a Subversion repository and where some of the configuration files are located conf Directory containing configuration files for services such as the svnserve daemon dav Working area for the mod_dav_svn module for Apache HTTP server and WebDav / DeltaV protocols db The location of the Berkeley DB filesystem implementation format The file containing the Subversion filesystem layout hooks Directory to store all the hook or trigger scripts locks Special Berkeley DB directory to lock the back end for recovery or maintenance processes Licensed to <null>
  • 53. 26 CHAPTER 2 Getting started drwxrwxr-x 2 svn svn 4096 Mar 23 20:52 locks drwxrwxr-x 2 svn svn 4096 Mar 23 20:52 hooks -rw-rw-r-- 1 svn svn 2 Mar 23 20:52 format drwxrwxr-x 2 svn svn 4096 Mar 23 20:52 dav drwxrwxr-x 2 svn svn 4096 Mar 23 20:52 conf drwxrwxr-x 2 svn svn 4096 Mar 23 21:36 db While not all of the directories need to have group write, the one to worry about is db. If this directory is not set up correctly, users will be unable to check out or commit to the repository. If you have some experience with system administra- tion, you will probably see a glaring hole in this: users will have the ability to write to these files. Depending on your user base, this may or may not be a problem. If this security setup is too loose for you, you can have your users access the reposi- tory through a network protocol and lock down the permissions more. 2.4 Common options Now that you have your new repository, you are almost ready to jump in, but not quite yet. Before you start looking at the Subversion commands, it is a good idea to understand some of the common options and default behaviors. Since the client interfaces are a set of command-line executables, these common options are simply arguments passed into the command. This is no different than an OS command option, such as -l for the ls command. The common options we will talk about next are available in multiple commands in Subversion. An option will have the same behavior no matter what command it is in. For example, the --username option will pass in an ID and is available on the commit, update, and other commands. 2.4.1 Recursion When you run a command that can operate on multiple files, by default it will recursively parse through the subdirectories. This will depend on what you use for an argument to the command: a file or a directory. If the argument is a file, then only that file will be processed by the command. If you pass in a directory, the command will process every file and directory under that. For example, consider the directory structure in figure 2.2. If you start the add command at the directory /home/jeff/testrepo/source, you will get everything under the java and c direc- tories. While this may not seem that important in this example, consider a tree with hundreds of directories, five and six levels deep, without having recursion. You would need to write a script to add these files. While recursion can be a great feature, there are times when you want to oper- ate at only a single level. In our previous example, maybe you want to add only the Licensed to <null>
  • 54. Common options 27 files in the /home/jeff/testrepos/source directory without going down multiple levels. In this case, Subversion commands that use recursion have a switch called --non-recursive. This tells the com- mand to operate only on files at the same level in the directory tree as the target. So in the previous directory tree, the command would operate on the directories c and java and the file config.txt. Nothing will be done to the files under the java and c directories. As you will see in later chapters, there are a few exceptions where commands will operate nonrecursively by default, and you will need to instruct Subversion to be recursive. 2.4.2 Entering the log message Any command that writes to the repository requires a log message to be submitted. This can be done auto- matically through command-line options or manu- ally through an editor. In chapter 1, you saw the importance of entering a detailed log message. You should keep this in mind when determining how the message will be entered into a command. There are two general ways of entering a message: on a com- mand line or through an editor. With the command line, you give the command either the text or the location of the text to use. If you do not specify this on the command line, Subversion will spawn a text editor, and you will enter the message there. Entering the log message on the command line. There are two ways to enter the log message on the command line; the first is with the --message option. This option takes a string encapsulated in quotes as a parameter, which is the actual message: $ svn commit --message "This is the log message" The command line is a good tool if you are automating a process in a script and do not have a way to manually enter a message. It can also be used for messages that are short and that you want to quickly enter without having to run them through an editor. Finally, this is a good workaround if you cannot start an editor source Java main.c hello.c main.java hello.java config.txt C Figure 2.2 Example directory tree Licensed to <null>
  • 55. Exploring the Variety of Random Documents with Different Content
  • 56. The Fairy Rade. The Fairy Rade, or procession, was a matter of great importance. It took place on the coming in of summer, and the peasantry, by using the precaution of placing a branch of rowan over their door, might safely gaze on the cavalcade, as with music sounding, bridles ringing, and voices mingling, it pursued its way from place to place. An old woman of Nithsdale gave the following description of one of these processions: "In the night afore Roodmass I had trysted with a neebor lass a Scots mile frae hame to talk anent buying braws i' the fair. We had nae sutten lang aneath the haw-buss till we heard the loud laugh of fowk riding, wi' the jingling o' bridles, and the clanking o' hoofs. We banged up, thinking they wad ride owre us. We kent nae but it was drunken fowk ridin' to the fair i' the forenight. We glowred roun' and roun', and sune saw it was the Fairie-fowks Rade. We cowred down till they passed by. A beam o' light was dancing owre them mair bonnie than moonshine: they were a' wee wee fowk wi' green scarfs on, but ane that rade foremost, and that ane was a good deal larger than the lave wi' bonnie lang hair, bun' about wi' a strap whilk glinted like stars. They rade on braw wee white naigs, wi' unco lang swooping tails, an' manes hung wi' whustles that the win' played on. This an' their tongue when they sang was like the soun' o' a far awa psalm. Marion an' me was in a brade lea fiel', where they came by us; a high hedge o' haw-trees keepit them frae gaun through Johnnie Corrie's corn, but they lap a' owre it like sparrows, and gallopt into a green know beyont it. We gaed i' the morning to look at the treddit corn; but the fient a hoof mark was there, nor a blade broken." The Changeling. But the Fairies of Scotland were not, even according to Mr. Cromek, uniformly benevolent. Woman and child abstraction was by no means uncommon with them, and the substitutes they provided were, in general, but little attractive.
  • 57. A fine child at Caerlaveroc, in Nithsdale, was observed on the second day after its birth, and before it was baptised, to have become quite ill- favoured and deformed. Its yelling every night deprived the whole family of rest; it bit and tore its mother's breasts, and would lie still neither in the cradle nor the arms. The mother being one day obliged to go from home, left it in charge of the servant girl. The poor lass was sitting bemoaning herself—"Were it nae for thy girning face, I would knock the big, winnow the corn, and grun the meal."—"Lowse the cradle-band," said the child, "and tent the neighbours, and I'll work yere work." Up he started—the wind arose—the corn was chopped—the outlyers were foddered—the hand-mill moved around, as by instinct— and the knocking-mill did its work with amazing rapidity. The lass and child then rested and diverted themselves, till, on the approach of the mistress, it was restored to the cradle, and renewed its cries. The girl took the first opportunity of telling the adventure to her mistress. "What'll we do with the wee diel?" said she. "I'll work it a pirn," replied the lass. At midnight the chimney-top was covered up, and every chink and cranny stopped. The fire was blown till it was glowing hot, and the maid speedily undressed the child, and tossed him on the burning coals. He shrieked and yelled in the most dreadful manner, and in an instant the Fairies were heard moaning on every side, and rattling at the windows, door, and chimney. "In the name of God bring back the bairn," cried the lass. The window flew up, the real child was laid on the mother's lap, and the wee diel flew up the chimney laughing. Departure of the Fairies. On a Sabbath morning, all the inmates of a little hamlet had gone to church, except a herd-boy, and a little girl, his sister, who were lounging beside one of the cottages, when just as the shadow of the garden-dial had fallen on the line of noon, they saw a long cavalcade ascending out of the ravine, through the wooded hollow. It winded among the knolls and bushes, and turning round the northern gable of the cottage, beside which the sole spectators of the scene were stationed, began to ascend the eminence towards the south. The horses were shaggy diminutive things, speckled dun and grey; the riders stunted, misgrown, ugly creatures, attired in antique jerkins of plaid, long grey clokes, and
  • 58. little red caps, from under which their wild uncombed locks shot out over their cheeks and foreheads. The boy and his sister stood gazing in utter dismay and astonishment, as rider after rider, each more uncouth and dwarfish than the other which had preceded it, passed the cottage and disappeared among the brushwood, which at that period covered the hill, until at length the entire rout, except the last rider, who lingered a few yards behind the others, had gone by. "What are you, little manie? and where are ye going?" inquired the boy, his curiosity getting the better of his fears and his prudence. "Not of the race of Adam," said the creature, turning for a moment in its saddle, "the people of peace shall never more be seen in Scotland."[421] The Brownie. The Nis, Kobold, or Goblin, appears in Scotland under the name of Brownie.[422] Brownie is a personage of small stature, wrinkled visage, covered with short curly brown hair, and wearing a brown mantle and hood. His residence is the hollow of an old tree, a ruined castle, or the abode of man. He is attached to particular families, with whom he has been known to reside, even for centuries, threshing the corn, cleaning the house, and doing everything done by his northern and English brethren. He is, to a certain degree, disinterested; like many great personages, he is shocked at anything approaching to the name of a bribe or douceur, yet, like them, allows his scruples to be overcome if the thing be done in a genteel, delicate, and secret way. Thus, offer Brownie a piece of bread, a cup of drink, or a new coat and hood, and he flouted at it, and perhaps, in his huff, quitted the place for ever; but leave a nice bowl of cream, and some fresh honeycomb, in a snug private corner, and they soon disappeared, though Brownie, it was to be supposed, never knew anything of them. A good woman had just made a web of linsey-woolsey, and, prompted by her good nature, had manufactured from it a snug mantle and hood for her little Brownie. Not content with laying the gift in one of his favourite spots, she indiscreetly called to tell him it was there. This was too direct, and Brownie quitted the place, crying,
  • 59. A new mantle and a new hood; Poor Brownie! ye'll ne'er do mair gude! Another version of this legend says, that the gudeman of a farm-house in the parish of Glendevon having left out some clothes one night for Brownie, he was heard to depart, saying, Gie Brownie coat, gie Brownie sark, Ye'se get nae mair o' Brownie's wark![423] At Leithin-hall, in Dumfrieshire, a Brownie had dwelt, as he himself declared, for three hundred years. He used to show himself but once to each master; to other persons he rarely discovered more than his hand. One master was greatly beloved by Brownie, who on his death bemoaned him exceedingly, even abstaining from food for many successive days. The heir returning from foreign parts to take possession of the estate, Brownie appeared to do him homage, but the Laird, offended at his mean, starved appearance, ordered him meat and drink, and new livery. Brownie departed, loudly crying, Ca', cuttee, ca'! A' the luck of Leithin Ha' Gangs wi' me to Bodsbeck Ha'. In a few years Leithin Ha' was in ruins, and "bonnie Bodsbeck" flourishing beneath the care of Brownie. Others say that it was the gudeman of Bodsbeck that offended the Brownie by leaving out for him a mess of bread and milk, and that he went away, saying, Ca, Brownie, ca', A' the luck of Bodsbeck awa to Leithenha'. Brownie was not without some roguery in his composition. Two lasses having made a fine bowlful of buttered brose, had taken it into the byre to sup in the dark. In their haste they brought but one spoon, so, placing the bowl between them, they supped by turns. "I hae got but three sups," cried the one, "and it's a' dune."—"It's a' dune, indeed,"
  • 60. cried the other.—"Ha, ha, ha!" cried a third voice, "Brownie has got the maist o' it."—And Brownie it was who had placed himself between them, and gotten two sups for their one. The following story will remind the reader of Hinzelmann. A Brownie once lived with Maxwell, Laird of Dalswinton, and was particularly attached to the Laird's daughter, the comeliest lass in all the holms of Nithsdale. In all her love affairs Brownie was her confidant and assistant; when she was married, it was Brownie who undressed her for the bridal bed; and when a mother's pains first seized her, and a servant, who was ordered to go fetch the cannie wife, who lived on the other side of the Nith, was slow in getting himself ready, Brownie, though it was one of dark December's stormy nights, and the wind was howling through the trees, wrapped his lady's fur cloak about him, mounted the servant's horse, and dashed through the waves of the foaming Nith. He went to the cannie wife, got her up behind him, and, to her terror and dismay, plunged again into the torrent. "Ride nae by the auld pool," said she, "lest we suld meet wi' Brownie." "Fear nae, dame," replied he, "ye've met a' the Brownies ye will meet." He set her down at the hall steps, and went to the stable. There finding the lad, whose embassy he had discharged, but drawing on his boots, he took off the bridle, and by its vigorous application instilled into the memory of the loitering loon the importance of dispatch. This was just at the time of the Reformation, and a zealous minister advised the Laird to have him baptised. The Laird consented, and the worthy minister hid himself in the barn. When Brownie was beginning his night's work, the man of God flung the holy water in his face, repeating at the same time the form of baptism. The terrified Brownie gave a yell of dismay, and disappeared for ever. Another name by which the domestic spirit was known in some parts of Scotland was Shellycoat, of which the origin is uncertain.[424]
  • 61. Scotland has also its water-spirit, called Kelpie, who in some respects corresponds with the Neck of the northern nations. "Every lake," says Graham,[425] "has its Kelpie, or Water-horse, often seen by the shepherd, as he sat in a summer's evening upon the brow of a rock, dashing along the surface of the deep, or browsing on the pasture- ground upon its verge. Often did this malignant genius of the waters allure women and children to his subaqueous haunts, there to be immediately devoured. Often did he also swell the torrent or lake beyond its usual limits, to overwhelm the hapless traveller in the flood." [426] We have now gone through nearly the whole of the Gotho-German race, and everywhere have found their fairy system the same—a proof, we conceive, of the truth of the position of its being deeply founded in the religious system originally common to the whole race. We now proceed to another, and, perhaps, an older European family, the Celts.
  • 62. CELTS AND CYMRY. There every herd by sad experience knows, How winged with fate their elf-shot arrows fly; When the sick ewe her summer-food foregoes, Or, stretched on earth, the heart-smit heifers lie. Collins. Under the former of these appellations we include the inhabitants of Ireland, the Highlands of Scotland, and the Isle of Man; under the latter, the people of Wales and Brittany. It is, not, however, by any means meant to be asserted that there is in any of these places to be found a purely Celtic or Cymric population. The more powerful Gotho-German race has, every where that they have encountered them, beaten the Celts and Cymry, and intermingled with them, influencing their manners, language, and religion. Our knowledge of the original religion of this race is very limited, chiefly confined to what the Roman writers have transmitted to us, and the remaining poems of the Welsh bards. Its character appears to have been massive, simple, and sublime, and less given to personification than those of the more eastern nations. The wild and the plastic powers of nature never seem in it to have assumed the semblance of huge giants and ingenious dwarfs. Yet in the popular creed of all these tribes, we meet at the present day beings exactly corresponding to the Dwarfs and Fairies of the Gotho- German nations. Of these beings there is no mention in any works— such as the Welsh Poems, and Mabinogion, the Poems of Ossian, or the different Irish poems and romances—which can by any possibility lay claim to an antiquity anterior to the conquests of the Northmen. Is it not then a reasonable supposition that the Picts, Saxons, and other sons of the North, brought with them their Dwarfs and Kobolds, and communicated the knowledge of, and belief in, them to their Celtic and Cymric subjects and neighbours? Proceeding on this theory, we have
  • 63. placed the Celts and Cymry next to and after the Gotho-German nations, though they are perhaps their precursors in Europe.
  • 64. IRELAND. Like him, the Sprite, Whom maids by night Oft meet in glen that's haunted. Moore. We commence our survey of the lands of Celts and Cymry with Ireland, as being the first in point of importance, but still more as being the land of our birth. It is pleasing to us, now in the autumn of our life, to return in imagination to where we passed its spring—its most happy spring. As we read and meditate, its mountains and its vales, its verdant fields and lucid streams, objects on which we probably never again shall gaze, rise up in their primal freshness and beauty before us, and we are once more present, buoyant with youth, in the scenes where we first heard the fairy-legends of which we are now to treat. Even the forms of the individual peasants who are associated with them in our memory, rise as it were from their humble resting-places and appear before us, again awaking our sympathies; for, we will boldly assert it, the Irish peasantry, with all their faults, gain a faster hold on the affections than the peasantry of any other country. We speak, however, particularly of them as they were in our county and in our younger days; for we fear that they are somewhat changed, and not for the better. But our present business is with the Irish fairies rather than with the Irish people. The fairies of Ireland can hardly be said to differ in any respect from those of England and Scotland. Like them they are of diminutive size, rarely exceeding two feet in height; they live also in society, their ordinary abode being the interior of the mounds, called in Irish, Raths (Râhs), in English, Moats, the construction of which is, by the peasantry, ascribed to the Danes from whom, it might thence perhaps be inferred, the Irish got their fairies direct and not viâ England. From these abodes they are at times seen to issue mounted on diminutive steeds, in order to take at night the diversion of the chase. Their usual
  • 65. attire is green with red caps.[427] They are fond of music, but we do not in general hear much of their dancing, perhaps because on account of the infrequency of thunder, the fairy-rings are less numerous in Ireland than elsewhere. Though the fairies steal children and strike people with paralysis and other ailments (which is called being fairy-struck), and shoot their elf-arrows at the cattle, they are in general kind to those for whom they have contracted a liking, and often render them essential service in time of need. They can make themselves visible and invisible, and assume any forms they please. The pretty tiny conical mushrooms which grow so abundantly in Ireland are called Fairy-mushrooms; a kind of nice regularly-formed grass is named Fairy-flax, and the bells of the foxglove called in some places Fairy-bells, are also said to have some connexion with the Little People. The popular belief in Ireland also is, that the Fairies are a portion of the fallen angels, who, being less guilty than the rest, were not driven to hell, but were suffered to dwell on earth. They are supposed to be very uneasy respecting their condition after the final judgement. The only names by which they are known in those parts of Ireland in which the English language is spoken are, Fairies, the Good People,[428] and the Gentry, these last terms being placatory, like the Greek Eumenides. When, for example, the peasant sees a cloud of dust sweeping along the road, he raises his hat and says, "God speed you, gentlemen!" for it is the popular belief that it is in these cloudy vehicles that the Good People journey from one place to another.[429] The Irish language has several names for the fairies; all however are forms or derivations of the word Shia,[430] the proper meaning of which seems to be Spirit. The most usual name employed by the Munster peasantry is Shifra; we are not acquainted with the fairy-belief and terminology of the inhabitants of Connemara and the other wilds of Connaught.[431] Most of the traits and legends of the Irish fairies are contained in the Fairy Legends and Traditions of the South of Ireland, compiled by Mr. Crofton Croker. As we ourselves aided in that work we must inform the reader that our contributions, both in text and notes, contain only Leinster ideas and traditions, for that was the only province with which
  • 66. we were acquainted. We must make the further confession, that some of the more poetic traits which MM. Grimm, in the Introduction to their translation of this work, give as characteristic of the Irish fairies, owe their origin to the fancy of the writers, who were, in many cases, more anxious to produce amusing tales than to transmit legends faithfully. The Legend of Knockshegowna (Hill of the Fairy-calf) the first given in that work, relates how the fairies used to torment the cattle and herdsmen for intruding on one of their favourite places of resort which was on this hill. The fairy-queen, it says, having failed in her attempts to daunt a drunken piper who had undertaken the charge of the cattle, at last turned herself into a calf, and, with the piper on her back, jumped over the Shannon, ten miles off, and back again. Pleased with his courage, she agreed to abandon the hill for the future. The Legend of Knock-Grafton tells how a little hunchback, while sitting to rest at nightfall at the side of a Rath or Moat, heard the fairies within singing over and over again, Da Luan, Da Mart! (i.e., Monday, Tuesday!) and added, weary with the monotony, Agus da Cadin! (i.e., and Wednesday!) The fairies were so delighted with this addition to their song that they brought him into the Moat, entertained him, and finally freed him from the incumbrance of his hump. Another hunchback hearing the story went to the Moat to try if he could meet with the same good fortune. He heard the fairies singing the amended version of the song, and, anxious to contribute, without waiting for a pause or attending to the rhythm or melody, he added Agus da Hena! (i.e., and Friday.)[432] His reward was, being carried into the Moat, and having his predecessor's hump placed on his back in addition to his own.[433] In the story named the Priest's Supper, a fisherman, at the request of the fairies, asks a priest who had stopt at his house, whether they would be saved or not at the last day. The priest desired him to tell them to come themselves and put the question to him, but this they declined doing, and the question remained undecided. The next three stories are of changelings. The Young Piper, one of our own contributions, will be found in the Appendix. The Changeling has nothing peculiar in it; but the Brewery of Eggshells is one which we find
  • 67. in many places, even in Brittany and Auvergne. In the present version, the mother puts down eggshells to boil, and to the enquiry of the changeling she tells him that she is brewing them, and clapping his hands he says, "Well! I'm fifteen hundred years in the world, and I never saw a brewery of eggshells before!" In the Capture of Bridget Purcel, a girl is struck with a little switch between the shoulders, by something in the form of a little child that came suddenly behind her, and she pined away and died. The Legend of Bottle Hill gives the origin of that name, which was as follows. A poor man was driving his only cow to Cork to sell her. As he was going over that hill he was suddenly joined by a strange-looking little old man with a pale withered face and red eyes, to whom he was eventually induced to give his cow in exchange for a bottle, and both cow and purchaser then disappeared. When the poor man came home he followed the directions of the stranger, and spreading a cloth on the table, and placing the bottle on the ground, he said, "Bottle, do your duty!" and immediately two little beings rose out of it, and having covered the table with food in gold and silver dishes, went down again into the bottle and vanished. By selling these he got a good deal of money and became rich for one in his station. The secret of his bottle however transpired, and his landlord induced him to sell it to him. But his prosperity vanished with it, and he was again reduced to one cow, and obliged to drive her to Cork for sale. As he journeyed over the same hill he met the same old man, and sold him the cow for another bottle. Having made the usual preparations, he laid it on the ground and said, "Bottle, do your duty!" but instead of the tiny little lads with their gold and silver dishes, there jumped up out of it two huge fellows with cudgels, who fell to belabouring the whole family. When they had done and were gone back into the bottle, the owner of it, without saying a word, put it under his coat and went to his landlord, who happened to have a great deal of company with him, and sent in word that he was come with another bottle to sell. He was at once admitted, the bottle did its duty, and the men with cudgels laid about them on all present, and never ceased till the original wealth-giving bottle was restored. He now grew richer than ever, and his son married his landlord's daughter, but when the old man and his wife died, the
  • 68. servants, it is recorded, fighting at their wake, broke the two bottles. [434] The Confessions of Tom Bourke, as it contains a faithful transcript of the words and ideas of that personage, is perhaps the most valuable portion of the work. From this we learn that in Munster the fairies are, like the people themselves, divided into factions. Thus we are told that, on the occasion of the death of Bourke's mother, the two parties fought for three continuous nights, to decide whether she should be buried with her own or her husband's people (i. e. family). Bourke also had sat for hours looking at two parties of the Good People playing at the popular game of hurling, in a meadow at the opposite side of the river, with their coats and waistcoats off, and white handkerchiefs on the heads of one, and red on these of the other party. A man whom Tom knew was returning one evening from a fair, a little elevated of course, when he met a berrin (i. e. funeral), which he joined, as is the custom; but, to his surprise, there was no one there that he knew except one man, and he had been dead for some years. When the berrin was over, they gathered round a piper, and began to dance in the churchyard. Davy longed to be among them, and the man that he knew came up to him, and bid him take out a partner, but on no account to give her the usual kiss. He accordingly took out the purtiest girl in the ring, and danced a jig with her, to the admiration of the whole company; but at the end he forgot the warning, and complied with the custom of kissing one's partner. All at once everything vanished; and when Davy awoke nest morning, he found himself lying among the tombstones. Another man, also a little in liquor, was returning one night from a berrin. The moon was shining bright, and from the other side of the river came the sounds of merriment, and the notes of a bagpipe. Taking off his shoes and stockings, he waded across the river, and there he found a great crowd of people dancing on the Inch[435] on the other side. He mingled with them without being observed, and he longed to join in the dance; for he had no mean opinion of his own skill. He did so, but found that it was not to be compared to theirs, they were so light and agile. He was going away quite in despair, when a little old
  • 69. man, who was looking on with marks of displeasure in his face, came up to him, and telling him he was his friend, and his father's friend, bade him go into the ring and call for a lilt. He complied, and all were amazed at his dancing; he then got a table and danced on it, and finally he span round and round on a trencher. When he had done, they wanted him to dance again; but he refused with a great oath, and instantly he found himself lying on the Inch with only a white cow grazing beside him. On going home, he got a shivering and a fever. He was for many days out of his mind, and recovered slowly; but ever after he had great skill in fairy matters. The dancers, it turned out, had belonged to a different faction, and the old man who gave him his skill to that to which he himself was attached. In these genuine confessions it is very remarkable that the Good People are never represented as of a diminutive size; while in every story that we ever heard of them in Leinster, they were of pygmy stature. The following account of their mode of entering houses in Ulster gives them dimensions approaching to those of Titania's 'small elves.' A Fairy, the most agile, we may suppose, of the party, is selected, who contrives to get up to the keyhole of the door, carrying with him a piece of thread or twine. With this he descends on the inside, where he fastens it firmly to the floor, or some part of the furniture. Those without then 'haul taut and belay,' and when it is fast they prepare to march along this their perilous Es-Sirat, leading to the paradise of pantry or parlour, in this order. First steps up the Fairy-piper, and in measured pace pursues his adventurous route, playing might and main an invigorating elfin-march, or other spirit-stirring air; then one by one the rest of the train mount the cord and follow his steps. Like the old Romans, in their triumphal processions, they pass beneath the lofty arch of the keyhole, and move down along the other side. Lightly, one by one, they then jump down on the floor, to hold their revels or accomplish their thefts.
  • 70. We have never heard of any being, in the parts of Ireland with which we are acquainted, answering to the Boggart, Brownie, or Nis. A farmer's family still, we believe, living in the county of Wicklow, used to assert that in their grandfather's time they never had any trouble about washing up plates and dishes; for they had only to leave them collected in a certain part of the house for the Good People, who would come in and wash and clean them, and in the morning everything would be clean and in its proper place. Yet in the county of Cork it would seem that the Cluricaun, of which we shall presently speak, used to enact the part of Nis or Boggart. Mr. Croker tells a story of a little being, which he calls a Cluricaun, that haunted the cellar of a Mr. Macarthy, and in a note on this tale he gives the contents of a letter informing him of another ycleped Little Wildbean, that haunted the house of a Quaker gentleman named Harris, and which is precisely the Nis or Boggart. This Wildbean, who kept to the cellar, would, if one of the servants through negligence left the beer-barrel running, wedge himself into the cock and stop it, till some one came to turn it. His dinner used to be left for him in the cellar, and the cook having, one Friday, left him nothing but part of a herring and some cold potatoes, she was at midnight dragged out of her bed, and down the cellar-stairs, and so much bruised that she kept her bed for three weeks. In order at last to get rid of him, Mr. Harris resolved to remove, being told that if he went beyond a running stream the Cluricaun could not follow him. The last cart, filled with empty barrels and such like, was just moving off, when from the bung-hole of one of them Wildbean cried out, "Here, master! here we go all together!" "What!" said Mr. Harris, "dost thou go also?" "Yes, to be sure, master. Here we go, all together!" "In that case, friend," replied Mr. Harris, "let the carts be unloaded; we are just as well where we are." It is added, that "Mr. Harris died soon after, but it is said the Cluricaun still haunts the Harris family." In another of these Fairy Legends, Teigue of the Lee, who haunted the house of a Mr. Pratt, in the county of Cork, bears a strong resemblance to the Hinzelmann of Germany. To the story, which is exceedingly well told by a member of the society of Friends, now no more, also the
  • 71. narrator of the Legend of Bottle-hill, Mr. Croker has in his notes added some curious particulars. A being named the Fear Dearg (i. e. Red Man) is also known in Munster. A tale named The Lucky Guest, which Mr. Croker gives as taken down verbatim from the mouth of the narrator by Mr. M'Clise, the artist, gives the fullest account of this being. A girl related that, when she was quite a child, one night, during a storm of wind and rain, a knocking was heard at the door of her father's cabin, and a voice like that of a feeble old man craving admission. On the door's being opened, there came in a little old man, about two feet and a half high, with a red sugar-loaf hat and a long scarlet coat, reaching down nearly to the ground, his hair was long and grey, and his face yellow and wrinkled. He went over to the fire (which the family had quitted in their fear), sat down and dried his clothes, and began smoking a pipe which he found there. The family went to bed, and in the morning he was gone. In about a month after he began to come regularly every night about eleven o'clock. The signal which he gave was thrusting a hairy arm through a hole in the door, which was then opened, and the family retired to bed, leaving him the room to himself. If they did not open the door, some accident was sure to happen next day to themselves or their cattle. On the whole, however, his visits brought good luck, and the family prospered, till the landlord put them out of their farm, and they never saw the Fear Dearg more. As far as our knowledge extends, there is no being in the Irish rivers answering to the Nix or Kelpie; but on the sea coast the people believe in beings of the same kind as the Mermen and Mermaids. The Irish name is Merrow,[436] and legends are told of them similar to those of other countries. Thus the Lady of Gollerus resembles the Mermaid-wife and others which we have already related. Instead, however, of an entire dress, it is a kind of cap, named Cohuleen Driuth, without which she cannot return to her subaqueous abode. Other legends tell of
  • 72. matrimonial unions formed by mortals with these sea-ladies, from which some families in the south claim a descent. The Lord of Dunkerron, so beautifully told in verse by Mr. Croker, relates the unfortunate termination of a marine amour of one of the O'Sullivan family. The Soul- cages alone contains the adventures of a Mermau. The Irish Pooka[437] ( uc ) is plainly the English Pouke, Puck, and would seem, like it, to denote an evil spirit. The notions respecting it are very vague. A boy in the mountains near Killarney told Mr. Croker that "old people used to say that the Pookas were very numerous in the times long ago. They were wicked-minded, black-looking, bad things, that would come in the form of wild colts, with chains hanging about them. They did great hurt to benighted travellers." Here we plainly have the English Puck; but it is remarkable that the boy should speak of Pookas in the plural number. In Leinster, it was always the, not a Pooka, that we heard named. When the blackberries begin to decay, and the seeds to appear, the children are told not to eat them any longer, as the Pooka has dirtied on them. The celebrated fall of the Liffey, near Ballymore Eustace, is named Pool- a-Phooka, or The Pooka's Hole. Near Macroom, in the county of Cork, are the ruins of a castle built on a rock, named Carrig-a-Phooka, or The Pooka's Rock. There is an old castle not far from Dublin, called Puck's Castle, and a townland in the county of Kildare is named Puckstown. The common expression play the Puck is the same as play the deuce, play the Devil. The most remarkable of the Fairy-tribe in Ireland, and one which is peculiar to the country, is the Leprechaun.[438] This is a being in the form of an old man, dressed as he is described in one of the following tales. He is by profession a maker of brogues; he resorts in general only to secret and retired places, where he is discovered by the sounds which he makes hammering his brogues. He is rich, like curmudgeons
  • 73. of his sort, and it is only by the most violent threats of doing him some bodily harm, that he can be made to show the place where his treasure lies; but if the person who has caught him can be induced (a thing that always happens, by the way) to take his eyes off him, he vanishes, and with him the prospect of wealth. The only instance of more than one Leprechaun being seen at a time is that which occurs in one of the following tales, which was related by an old woman, to the writer's sister and early companion, now no more. Yet the Leprechaun, though, as we said, peculiar to Ireland, seems indebted to England, at least, for his name. In Irish, as we have seen, he is called Lobaircin, and it would not be easy to write the English Lubberkin more accurately with Irish letters and Irish sounds. Leprechaun is evidently a corruption of that word.[439] In the time of Elizabeth and James, the word Lubrican was used in England to indicate some kind of spirit. Thus Drayton gives as a part of Nymphidia's invocation of Proserpina: By the mandrake's dreadful groans; By the Lubrican's sad moans; By the noise of dead men's bones In charnel-house rattling. That this was the Leprechaun is, we think, clear; for in the Honest Whore of Decker and Middleton, the following words are used of an Irish footman: As for your Irish Lubrican, that spirit Whom by preposterous charms thy lust has raised. Part II. i. 1.[440] We thus have the Leprechaun as a well-known Irish fairy, though his character was not understood, in the sixteenth century. The two following tales we ourselves heard from the peasantry of Kildare in our boyhood:[441] Clever Tom and the Leprechaun.
  • 74. Oliver Tom Fwich-(i.e. Fitz)pathrick, as people used to call him, was the eldest son o' a comfortable farmer, who lived nigh hand to Morristown- Lattin, not far from the Liffey. Tom was jist turned o' nine-an'-twinty, whin he met wid the follyin' advinthur, an' he was as cliver, clane, tight, good-lukin' a boy as any in the whole county Kildare. One fine day in harvist (it was a holiday) Tom was takin' a ramble by himsilf thro' the land, an' wint sauntherin' along the sunny side uv a hidge, an' thinkin' in himsilf, whare id be the grate harm if people, instid uv idlin' an' goin' about doin' nothin' at all, war to shake out the hay, an' bind and stook th' oats that was lyin' an the ledge, 'specially as the weather was raither brokin uv late, whin all uv a suddint he h'ard a clackin' sort o' n'ise jist a little way fornint him, in the hidge. "Dear me," said Tom, "but isn't it now raaly surprisin' to hear the stonechatters singin' so late in the saison." So Tom stole an, goin' on the tips o' his toes to thry iv he cud git a sight o' what was makin' the n'ise, to see iv he was right in his guess. The n'ise stopt; but as Tom luked sharp thro' the bushes, what did he see in a neuk o' the hidge but a brown pitcher that might hould about a gallon an' a haff o' liquor; an' bye and bye he seen a little wee deeny dawny bit iv an ould man, wid a little motty iv a cocked hat stuck an the top iv his head, an' a deeshy daushy leather apron hangin' down afore him, an' he pulled out a little wooden stool, an' stud up upon it, and dipped a little piggen into the pitcher, an' tuk out the full av it, an' put it beside the stool, an' thin sot down undher the pitcher, an' begun to work at puttin' a heelpiece an a bit iv a brogue jist fittin' fur himsilf. "Well, by the powers!" said Tom to himsilf, "I aften hard tell o' the Leprechauns, an', to tell God's thruth, I nivir rightly believed in thim, but here's won o' thim in right airnest; if I go knowin'ly to work, I'm a med man. They say a body must nivir take their eyes aff o' thim, or they'll escape." Tom now stole an a little farther, wid his eye fixed an the little man jist as a cat does wid a mouse, or, as we read in books, the rattlesnake does wid the birds he wants to inchant. So, whin he got up quite close to him, "God bless your work, honest man," sez Tom. The little man raised up his head, an' "Thank you kindly," sez he. "I wundher you'd be workin' an the holiday," sez Tom. "That's my own business, an' none of your's," was the reply, short enough. "Well, may be, thin, you'd be civil
  • 75. enough to tell us, what you've got in the pitcher there," sez Tom. "Aye, will I, wid pleasure," sez he: "it's good beer." "Beer!" sez Tom: "Blud an' turf, man, whare did ye git it?" "Whare did I git it, is it? why I med it to be shure; an' what do ye think I med it av?" "Divil a one o' me knows," sez Tom, "but av malt, I 'spose; what ilse?" "'Tis there you're out; I med it av haith." "Av haith!" sez Tom, burstin' out laughin'. "Shure you don't take me to be sich an omedhaun as to b'lieve that?" "Do as ye plase," sez he, "but what I tell ye is the raal thruth. Did ye nivir hear tell o' the Danes?" "To be shure I did," sez Tom, "warn't thim the chaps we gev such a lickin' whin they thought to take Derry frum huz?" "Hem," sez the little man dhryly, "is that all ye know about the matther?" "Well, but about thim Danes," sez Tom. "Why all th' about thim is," said he, "is that whin they war here they taught huz to make beer out o' the haith, an' the saicret's in my family ivir sense." "Will ye giv a body a taste o' yer beer to thry?" sez Tom. "I'll tell ye what it is, young man, it id be fitther fur ye to be lukin' afther yer father's propirty thi'n to be botherin' dacint, quite people wid yer foolish questions. There, now, while you're idlin' away yer time here, there's the cows hav' bruk into th' oats, an' are knockin' the corn all about." Tom was taken so by surprise wid this, that he was jist an the very point o' turnin' round, whin he recollicted himsilf. So, afeard that the like might happin agin, he med a grab at the Leprechaun, an' cotch him up in his hand, but in his hurry he ovirset the pitcher, and spilt all the beer, so that he couldn't git a taste uv it to tell what sort it was. He thin swore what he wouldn't do to him iv he didn't show him whare his money was. Tom luked so wicked, an' so bloody-minded, that the little man was quite frightened. "So," sez he, "come along wid me a couple o' fields aff, an' I'll show ye a crock o' gould." So they wint, an' Tom held the Leprechaun fast in his hand, an' nivir tuk his eyes frum aff uv him, though they had to crass hidges an' ditches, an' a cruked bit uv a bog (fur the Leprechaun seemed, out o' pure mischief, to pick out the hardest and most conthrairy way), till at last they come to a grate field all full o' bolyawn buies,[442] an' the Leprechaun pointed to a big bolyawn, an' sez he, "Dig undher that bolyawn, an' you'll git a crock chuck full o' goulden guineas."
  • 76. Tom, in his hurry, had nivir minded the bringin' a fack[443] wid him, so he thought to run home and fetch one, an' that he might know the place agin, he tuk aff one o' his red garthers, and tied it round the bolyawn. "I s'pose," sez the Leprechaun, very civilly, "ye've no further occashin fur me?" "No," sez Tom, "ye may go away now, if ye like, and God speed ye, an' may good luck attind ye whareivir ye go." "Well, good bye to ye, Tom Fwichpathrick," sed the Leprechaun, "an' much good may do ye wid what ye'll git." So Tom run fur the bare life, till he come home, an' got a fack, an' thin away wid him as hard as he could pilt back to the field o' bolyawns; but whin he got there, lo an' behould, not a bolyawn in the field, but had a red garther, the very idintical model o' his own, tied about it; an' as to diggin' up the whole field, that was all nonsinse, fur there was more nor twinty good Irish acres in it. So Tom come home agin wid his fack an his shouldher, a little cooler nor he wint; and many's the hearty curse he gev the Leprechaun ivry time he thought o' the nate turn he sarved him.[444] The Leprechaun in the Garden. There's a sort o' people that every body must have met wid sumtime or another. I mane thim people that purtinds not to b'lieve in things that in their hearts they do b'lieve in, an' are mortially afeard o' too. Now Failey[445] Mooney was one o' these. Failey (iv any o' yez knew him) was a rollockin', rattlin', divil-may-care sort ov a chap like—but that's neither here nor there; he was always talkin' one nonsinse or another; an' among the rest o' his fooleries, he purtinded not to b'lieve in the fairies, the Leprechauns, an' the Poocas, an' he evin sumtimes had the impedince to purtind to doubt o' ghosts, that every body b'lieves in, at any rate. Yit sum people used to wink an' luk knowin' whin Failey was gostherin', fur it was obsarved that he was mighty shy o' crassin' the foord o' Ahnamoe afther nightfall; an' that whin onst he was ridin' past the ould church o' Tipper in the dark, tho' he'd got enough o' pottheen into him to make any man stout, he med the horse trot so that there was no keepin' up wid him, an' iv'ry now an' thin he'd throw a sharp luk-out ovir his lift shouldher.
  • 77. Well, one night there was a parcel o' the neighbours sittin' dhrinkin' an' talkin' at Larry Reilly's public-house, an' Failey was one o' the party. He was, as usual, gittin' an wid his nonsinse an' baldherdash about the fairies, an' swearin' that he didn't b'lieve there was any live things, barrin' min an' bastes, an' birds and fishes, an' sich like things as a body cud see, an' he wint on talkin' in so profane a way o' the good people, that som o' the company grew timid an' begun to crass thimsilves, not knowin' what might happin', whin an ould woman called Mary Hogan wid a long blue cloak about her, that was sittin' in the chimbly corner smokin' her pipe widout takin' the laste share in the conversation, tuk the pipe out o' her mouth, an' threw the ashes out o' it, an' spit in the fire, an' turnin' round, luked Failey straight in the face. "An' so you don't b'lieve there's sich things as Leprechauns, don't ye?" sed she. Well, Failey luked rayther daunted, but howsumdivir he sed nothin'. "Why, thin, upon my throth, an' it well becomes the likes o' ye, an' that's nothin' but a bit uv a gossoon, to take upon yer to purtind not to b'lieve what yer father, an' yer father's father, an' his father afore him, nivir med the laste doubt uv. But to make the matther short, seein' 's b'lievin' they say, an' I, that might be yer gran'mother, tell ye there is sich things as Leprechauns, an' what's more, that I mysilf seen one o' thim,—there's fur ye, now!" All the people in the room luked quite surprised at this, an' crowded up to the fireplace to listen to her. Failey thried to laugh, but it wouldn't do, nobody minded him. "I remimber," sed she, "some time afther I married the honest man, that's now dead and gone, it was by the same token jist a little afore I lay in o' my first child (an' that's many a long day ago), I was sittin', as I sed, out in our little bit o' a gardin, wid my knittin' in my hand, watchin' sum bees we had that war goin' to swarm. It was a fine sunshiny day about the middle o' June, an' the bees war hummin' and flyin' backwards an' forwards frum the hives, an' the birds war chirpin' an' hoppin' an the bushes, an' the buttherflies war flyin' about an' sittin' an the flowers, an' ev'ry thing smelt so fresh an' so sweet, an' I felt so happy, that I hardly knew whare I was. Well, all uv a suddint, I heard among sum rows of banes we had in a corner o' the gardin, a n'ise that
  • 78. wint tick tack, tick tack, jist fur all the world as iv a brogue-maker was puttin' an the heel uv a pump. 'The Lord presarve us,' sed I to mysilf, 'what in the world can that be?' So I laid down my knittin', an' got up, an' stole ovir to the banes, an' nivir believe me iv I didn't see, sittin' right forenint me, in the very middle of thim, a bit of an ould man, not a quarther so big as a new-born child, wid a little cocked hat an his head, an' a dudeen in his mouth, smokin' away; an' a plain, ould-fashioned, dhrab-coloured coat, wid big brass buttons upon it, an his back, an' a pair o' massy silver buckles in his shoes, that a'most covered his feet they war so big, an' he workin' away as hard as ivir he could, heelin' a little pair o' pumps. The instant minnit I clapt my two eyes upon him I knew him to be a Leprechaun, an' as I was stout an' foolhardy, sez I to him 'God save ye honist man! that's hard work ye're at this hot day.' He luked up in my face quite vexed like; so wid that I med a run at him an' cotch hould o' him in my hand, an' axed him whare was his purse o' money! 'Money?' sed he, 'money annagh! an' whare on airth id a poor little ould crathur like mysilf git money?' 'Come, come,' sed I, 'none o' yer thricks upon thravellers; doesn't every body know that Leprechauns, like ye, are all as rich as the divil himsilf.' So I pulled out a knife I'd in my pocket, an' put on as wicked a face as ivir I could (an' in throth, that was no aisy matther fur me thin, fur I was as comely an' good- humoured a lukin' girl as you'd see frum this to Ballitore)—an' swore by this and by that, if he didn't instantly gi' me his purse, or show me a pot o' goold, I'd cut the nose aff his face. Well, to be shure, the little man did luk so frightened at hearin' these words, that I a'most found it in my heart to pity the poor little crathur. 'Thin,' sed he, 'come wid me jist a couple o' fields aff, an' I'll show ye whare I keep my money.' So I wint, still houldin' him fast in my hand, an' keepin' my eyes fixed upon him, whin all o' a suddint I h'ard a whiz-z behind me. 'There! there!' cries he, 'there's yer bees all swarmin' an' goin' aff wid thimsilves like blazes.' I, like a fool as I was, turned my head round, an' whin I seen nothin' at all, an' luked back at the Leprechaun, an' found nothin' at all at all in my hand—fur whin I had the ill luck to take my eyes aff him, ye see, he slipped out o' my fingers jist as iv he was med o' fog or smoke, an' the sarra the fut he iver come nigh my garden agin." The Three Leprechauns.
  • 79. Mrs. L. having heard that Molly Toole, an old woman who held a few acres of land from Mr. L., had seen Leprechauns, resolved to visit her, and learn the truth from her own lips. Accordingly, one Sunday, after church, she made her appearance at Molly's residence, which was—no very common thing—extremely neat and comfortable. As she entered, every thing looked gay and cheerful. The sun shone bright in through the door on the earthen floor. Molly was seated at the far side of the fire in her arm-chair; her daughter Mary, the prettiest girl on the lands, was looking to the dinner that was boiling; and her son Mickey, a young man of about two-and-twenty, was standing lolling with his back against the dresser. The arrival of the mistress disturbed the stillness that had hitherto prevailed. Mary, who was a great favourite, hastened to the door to meet her, and shake hands with her. Molly herself had nearly got to the middle of the floor when the mistress met her, and Mickey modestly staid where he was till he should catch her attention. "O then, musha! but isn't it a glad sight for my ould eyes to see your own silf undher my roof? Mary, what ails you, girl? and why don't you go into the room and fetch out a good chair for the misthress to sit down upon and rest herself?" "'Deed faith, mother, I'm so glad I don't know what I'm doin'. Sure you know I didn't see the misthress since she cum down afore." Mickey now caught Mrs. L.'s eye, and she asked him how he did. "By Gorra, bravely, ma'am, thank you," said he, giving himself a wriggle, while his two hands and the small of his back rested on the edge of the dresser. "Now, Mary, stir yourself, alanna," said the old woman, "and get out the bread and butther. Sure you know the misthress can't but be hungry afther her walk."—"O, never mind it, Molly; it's too much trouble."—"Throuble, indeed! it's as nice butther, ma'am, as iver you put a tooth in; and it was Mary herself that med it."—"O, then I must taste it." A nice half griddle of whole-meal bread and a print of fresh butter were now produced, and Molly helped the mistress with her own hands. As she was eating, Mary kept looking in her face, and at last said, "Ah then, mother, doesn't the misthress luk mighty well? Upon my faikins,
  • 80. ma'am, I never seen you luking half so handsome."—"Well! and why wouldn't she luk well? And niver will she luk betther nor be betther nor I wish her."—"Well, Molly, I think I may return the compliment, for Mary is prettier than ever; and as for yourself, I really believe it's young again you're growing."—"Why, God be thanked, ma'am, I'm stout and hearty; and though I say it mysilf, there's not an ould woman in the county can stir about betther nor me, and I'm up ivery mornin' at the peep of day, and rout them all up out of their beds. Don't I?" said she, looking at Mary.—"Faith, and sure you do, mother," replied Mickey; "and before the peep of day, too; for you have no marcy in you at all at all."—"Ah, in my young days," continued the old woman, "people woren't slugabeds; out airly, home late—that was the way wid thim."—"And usedn't people to see Leprechauns in thim days, mother?" said Mickey, laughing.—"Hould your tongue, you saucy cub, you," cried Molly; "what do you know about thim?"—"Leprechauns?" said Mrs. L., gladly catching at the opportunity; "did people really, Molly, see Leprechauns in your young days?"—"Yes, indeed, ma'am; some people say they did," replied Molly, very composedly.—"O com' now, mother," cried Mickey, "don't think to be goin' it upon us that away; you know you seen thim one time yoursilf, and you hadn't the gumption in you to cotch thim, and git their crocks of gould from thim."—"Now, Molly, is that really true that you saw the Leprechauns?"—"'Deed, and did I, ma'am; but this boy's always laughin' at me about thim, and that makes me rather shy in talkin' o' thim."—"Well, Molly, I won't laugh at you; so, come, tell me how you saw them." "Well, ma'am, you see it was whin I was jist about the age of Mary, there. I was comin' home late one Monday evenin' from the market; for my aunt Kitty, God be marciful to her! would keep me to take a cup of tay. It was in the summer time, you see, ma'am, much about the middle of June, an' it was through the fields I come. Well, ma'am, as I was sayin', it was late in the evenin', that is, the sun was near goin' down, an' the light was straight in my eyes, an' I come along through the bog- meadow; for it was shortly afther I was married to him that's gone, an' we wor livin' in this very house you're in now; an' thin whin I come to the castle-field—the pathway you know, ma'am, goes right through the middle uv it—an' it was thin as fine a field of whate, jist shot out, as you'd wish to luk at; an' it was a purty sight to see it wavin' so
  • 81. beautifully wid every air of wind that was goin' over it, dancin' like to the music of a thrush, that was singin' down below in the hidge.[446] Well, ma'am, I crasst over the style that's there yit, and wint along fair and aisy, till I was near about the middle o' the field, whin somethin' med me cast my eyes to the ground, a little before me; an' thin I saw, as sure as I'm sittin' here, no less nor three o' the Leprechauns, all bundled together like so miny tailyors, in the middle o' the path before me. They worn't hammerin' their pumps, nor makin' any kind of n'ise whatever; but there they wor, the three little fellows, wid their cocked hats upon thim, an' their legs gothered up undher thim, workin' away at their thrade as hard as may be. If you wor only to see, ma'am, how fast their little ilbows wint as they pulled out their inds! Well, every one o' thim had his eye cocked upon me, an' their eyes wor as bright as the eye of a frog, an' I cudn't stir one step from the spot for the life o' me. So I turned my head round, and prayed to the Lord in his marcy to deliver me from thim, and when I wint to luk at thim agin, ma'am, not a sight o' thim was to be seen: they wor gone like a dhrame."—"But, Molly, why did you not catch them?"—"I was afeard, ma'am, that's the thruth uv it; but maybe I was as well widout thim. I niver h'ard tell of a Leprechaun yit that wasn't too many for any one that cotch him."—"Well, and Molly, do you think there are any Leprechauns now?"—"It's my belief, ma'am, they're all gone out of the country, cliver and clane, along wid the Fairies; for I niver hear tell o' thim now at all." Mrs. L. having now attained her object, after a little more talk with the good old woman, took her leave, attended by Mary, who would see her a piece of the way home. And Mary being asked what she thought of the Leprechauns, confessed her inability to give a decided opinion: her mother, she knew, was incapable of telling a lie, and yet she had her doubts if there ever were such things as Leprechauns. The following tale of a Cluricaun, related by the writer of the Legend of Bottle Hill, is of a peculiar character. We have never heard anything
  • 82. similar of a Leprechaun. The Little Shoe. "Now tell me, Molly," said Mr. Coote to Molly Cogan, as he met her on the road one day, close to one of the old gateways of Kilmallock, "did you ever hear of the Cluricaun?"—"Is it the Cluricaun? Why, thin, to be shure; aften an' aften. Many's the time I h'ard my father, rest his sowl! tell about 'em over and over agin."—"But did you ever see one, Molly— did you ever see one yourself?"—"Och! no, I niver seen one in my life; but my gran'father, that's my father's father, you know, he seen one, one time, an' cotch him too."—"Caught him! Oh! Molly, tell me how was that." "Why, thin, I'll tell ye. My gran'father, you see, was out there above in the bog, dhrawin' home turf, an' the poor ould mare was tir't afther her day's work, an' the ould man wint out to the stable to look afther her, an' to see if she was aitin' her hay; an' whin he come to the stable door there, my dear, he h'ard sumthin' hammerin', hammerin', hammerin', jist for all the wurld like a shoemaker makin' a shoe, and whis'lin' all the time the purtiest chune he iver h'ard in his whole life afore. Well, my gran'father he thought it was the Cluricaun, an' he sed to himsilf, sez he, 'I'll ketch you, if I can, an' thin I'll have money enough always.' So he opened the door very quitely, an' didn't make a taste o' n'ise in the wurld, an' luked all about, but the niver a bit o' the little man cud he see anywhare, but he h'ard his hammerin' and whis'lin', an' so he luked and luked, till at last he seen the little fellow; an' whare was he, do ye think, but in the girth undher the mare; an' there he was, wid his little bit ov an apron an him, an' his hammer in his hand, an' a little red night-cap an his head, an' he makin' a shoe; an he was so busy wid his work, an' was hammerin' an' whis'lin' so loud, that he niver minded my gran'father, till he cotch him fast in his hand. 'Faix, I have ye now,' says he, 'an' I'll niver let ye go till I git yer purse—that's what I won't; so give it here at onst to me, now.' 'Stop, stop,' says the Cluricaun; 'stop, stop,' says he, 'till I get it for ye.' So my gran'father, like a fool, ye see, opened his hand a little, an' the little weeny chap jumped away laughin', an' he niver seen him any more, an' the divil a bit o' the purse did he
  • 83. git; only the Cluricaun left his little shoe that he was makin'. An' my gran'father was mad enough wid himself for lettin' him go; but he had the shoe all his life, an' my own mother tould me she aftin seen it, an' had it in her hand; an' 'twas the purtiest little shoe she ivir seen."—"An' did you see it yourself, Molly?"—"Oh! no, my dear, 'twas lost long afore I was born; but my mother tould me aftin an' aftin enough."
  • 84. SCOTTISH HIGHLANDS. Huar Prownie coad agus curochd, Agus cha dian Prownie opar tullidh. Brownie has got a cowl and coat, And never more will work a jot. Stewart. Colonies of Gothic Fairies, it would appear, early established themselves in the Highlands, and almost every Lowland, German, and Scandinavian Fairy or Dwarf-tale will there find its fellow. The Gaelic Fairies are very handsome in their persons; their usual attire is green. They dance and sing, lend and borrow, and they make cloth and shoes in an amazingly short space of time. They make their raids upon the low country, and carry off women and children; they fetch midwives to assist at the birth of their children, and mortals have spent a night at the fairy revels, and next morning found that the night had extended a hundred years. Highland fairies also take the diversion of the chase. "One Highlander," says Mc.Culloch,[447] "in passing a mountain, hears the tramp of horses, the music of the horn, and the cheering of the huntsmen; when suddenly a gallant crew of thirteen fairy hunters, dressed in green, sweep by him, the silver bosses of their bridles jingling in the night breeze." The Gael call the Fairies Daoine Shi',[448] (Dheenè Shee) and their habitations Shians, or Tomhans. These are a sort of turrets, resembling masses of rock or hillocks. By day they are indistinguishable, but at night they are frequently lit up with great splendour. Brownie, too, 'shows his honest face' in the Highlands; and the mischievous water-Kelpie also appears in his equine form, and seeks to decoy unwary persons to mount him, that he may plunge with his rider into the neighbouring loch or river.
  • 85. The Highlanders have nearly the same ideas as their Shetland neighbours, respecting the seals. The following legends will illustrate what we have stated.[449] The Fairy's Inquiry. A clergyman was returning home one night after visiting a sick member of his congregation. His way led by a lake, and as he proceeded he was surprised to hear most melodious strains of music. He sat down to listen. The music seemed to approach coming over the lake accompanied by a light. At length he discerned a man walking on the water, attended by a number of little beings, some bearing lights, others musical instruments. At the beach the man dismissed his attendants, and then walking up to the minister saluted him courteously. He was a little grey-headed old man, dressed in rather an unusual garb. The minister having returned his salute begged of him to come and sit beside him. He complied with the request, and on being asked who he was, replied that he was one of the Daoine Shi. He added that he and they had originally been angels, but having been seduced into revolt by Satan, they had been cast down to earth where they were to dwell till the day of doom. His object now was, to ascertain from the minister what would be their condition after that awful day. The minister then questioned him on the articles of faith; but as his answers did not prove satisfactory, and as in repeating the Lord's Prayer, he persisted in saying wert instead of art in heaven, he did not feel himself justified in holding out any hopes to him. The fairy then gave a cry of despair and flung himself into the loch, and the minister resumed his journey. The Young Man in the Shian. A farmer named Macgillivray, one time removed from the neighbourhood of Cairngorm in Strathspey to the forest of Glenavon, in which the fairies are said to reside. Late one night, as two of his sons, Donald and Rory, were in search of some of his sheep that had strayed, they saw lights streaming from the crevices of a fairy turret which in the
  • 86. day time had only the appearance of a rock. They drew nigh to it, and there they heard jigs and reels played inside in the most exquisite manner. Rory was so fascinated that he proposed that they should enter and take part in the dance. Donald did all he could to dissuade him, but in vain. He jumped into the Shian, and plunged at once into the whirling movements of its inhabitants. Donald was in great perplexity, for he feared to enter the Shian. All he could do therefore was to put his mouth to one of the crevices, and calling, as the custom was, three times on his brother, entreating him in the most moving terms, to come away and return home. But his entreaties were unheeded and he was obliged to return alone. Every means now was resorted to for the recovery of Rory, but to no purpose. His family gave him up for lost, when a Duin Glichd or Wise man, told Donald to go to the place where he had lost his brother, a year and a day from the time, and placing in his garments a rowan- cross, to enter the Shian boldly, and claim him in the divine name, and if he would not come voluntarily, to seize him and drag him out; for the fairies would have no power to prevent him. After some hesitation Donald assented. At the appointed time he approached the Shian at midnight. It was full of revelry, and the merry dance was going on as before. Donald had his terrors no doubt, but they gave way to his fraternal affection. He entered and found Rory in the midst of a Highland Fling, and running up to him, seized him by the collar, repeating the words dictated by the Wise man. Rory agreed to go provided he would let him finish his dance; for he had not been, he assured him, more than half an hour in the place, but Donald was inexorable, and took him home to his parents. Rory would never have believed that his half-hour had been a twelvemonth, "did not the calves grown now into stots, and the new-born babes now toddling about the house, at length convince him that in his single reel he had danced for a twelvemonth and a day." The Two Fiddlers. Nearly three hundred years ago, there dwelt in Strathspey two fiddlers, greatly renowned in their art. One Christmas they resolved to go try
  • 87. their fortune in Inverness. On arriving in that town they took lodgings, and as was the custom at that time, hired the bellman to go round announcing their arrival, their qualifications, their fame, and their terms. Soon after they were visited by a venerable-looking grey-haired old man, who not only found no fault with, but actually offered to double their terms if they would go with him. They agreed, and he led them out of the town, and brought them to a very strange-looking dwelling which seemed to them to be very like a Shian. The money, however, and the entreaties of their guide induced them to enter it, and their musical talents were instantly put into requisition, and the dancing was such as in their lives they had never witnessed. When morning came they took their leave highly gratified with the liberal treatment they had received. It surprised them greatly to find that it was out of a hill and not a house that they issued, and when they came to the town, they could not recognise any place or person, every thing seemed so altered. While they and the townspeople were in mutual amazement, there came up a very old man, who on hearing their story, said: "You are then the two men who lodged with my great- grandfather, and whom Thomas Rimer, it was supposed, decoyed to Tomnafurach. Your friends were greatly grieved on your account, but it is a hundred years ago, and your names are now no longer known." It was the Sabbath day and the bells were tolling; the fiddlers, deeply penetrated with awe at what had occurred, entered the church to join in the offices of religion. They sat in silent meditation while the bell continued ringing, but the moment that the minister commenced the service they crumbled away into dust. The Fairy-Labour. Many years ago there dwelt in Strathspey a midwife of great repute. One night just as she was going to bed, she heard a loud knocking at the door, and on opening it she saw there a man and a grey horse, both out of breath. The rider requested her to jump up behind him and come away to assist a lady who was in great danger. He would not even consent to her stopping to change her dress, as it would cause delay. She mounted and away they went at full speed. On the way she tried to
  • 88. learn from the rider whither she was going, but all she could get from him was, that she would be well paid. At length he let out that it was to a fairy-lady he was taking her. Nothing daunted, however, she went on, and on reaching the Shian, she found that her services were really very much needed. She succeeded in bringing a fine boy to the light, which caused so much joy, that the fairies desired her to ask what she would, and if it was in their power, it should be granted. Her desire was that success might attend herself and her posterity in all similar operations. The gift was conferred and it continued, it was said, with her great- grandson, at the time the collector of these legends wrote. The Fairy borrowing Oatmeal. A fairy came one day from one of the turrets of Craig-ail-naic to the wife of one of the tenants in Delnabo, and asked her to lend her a firlot of oatmeal for food for her family, promising to repay it soon, as she was every moment expecting an ample supply. The woman complied with this request, and after, as was the custom of the country, having regaled her with bread, cheese, and whiskey, she went, as was usual, to see her a part of the way home. When they had reached the summit of an eminence near the town, the Béanshi told her she might take her meal home again as she was now abundantly supplied. The woman did as desired, and as she went along she beheld the corn-kiln of an adjacent farm all in a blaze. The Fairy-Gift. A farmer in Strathspey was one day engaged in sowing one of his fields and singing at his work. A fairy damsel of great beauty came up to him and requested him to sing for her a favourite old Gaelic song named Nighan Donne na Bual. He complied, and she then asked him to give her some of his corn. At this he demurred a little and wished to know what she would give him in return. She replied with a significant look that his seed would never fail him. He then gave to her liberally and she departed. He went on sowing, and when he had finished a large field, he found that his bag was as full and as heavy as when he began. He
  • 89. then sowed another field of the same size, with the same result, and satisfied with his day's work, he threw the bag on his shoulder and went home. Just as he was entering the barn-door he was met by his wife, a foolish talkative body with a tongue as long, and a head as empty as the church bell, who, struck with the appearance of the bag after a day's sowing, began to ask him about it. Instantly it became quite empty. "I'll be the death of you, you foolish woman," roared out the farmer; "if it were not for your idle talk, that bag was worth its weight in gold." The Stolen Ox. The tacksman (i. e. tenant) of the farm of Auchriachan in Strathavon, while searching one day for his goats on a hill in Glenlivat, found himself suddenly enveloped in a dense fog. It continued till night came on when he began to give himself up to despair. Suddenly he beheld a light at no great distance. He hastened toward it, and found that it proceeded from a strange-looking edifice. The door was open, and he entered, but great was his surprise to meet there a woman whose funeral he had lately attended. From her he learned that this was an abode of the fairies for whom she kept house, and his only chance of safety, she said, was in being concealed from them; for which purpose she hid him in a corner of the apartment. Presently in came a troop of fairies, and began calling out for food. An old dry-looking fellow then reminded them of the miserly, as he styled him, tacksman of Auchriachan, and how he cheated them out of their lawful share of his property, by using some charms taught him by his old grandmother. "He is now from home," said he, "in search of our allies,[450] his goats, and his family have neglected to use the charm, so come let us have his favourite ox for supper." The speaker was Thomas Rimer, and the plan was adopted with acclamation. "But what are we to do for bread?" cried one. "We'll have Auchriachan's new baked bread," replied Thomas; "his wife forgot to cross the first bannock."[451] So said, so done. The ox was brought in and slaughtered before the eyes of his master, whom, while the fairies were employed about their cooking, his friend gave an opportunity of making his escape.
  • 90. Welcome to our website – the perfect destination for book lovers and knowledge seekers. We believe that every book holds a new world, offering opportunities for learning, discovery, and personal growth. That’s why we are dedicated to bringing you a diverse collection of books, ranging from classic literature and specialized publications to self-development guides and children's books. More than just a book-buying platform, we strive to be a bridge connecting you with timeless cultural and intellectual values. With an elegant, user-friendly interface and a smart search system, you can quickly find the books that best suit your interests. Additionally, our special promotions and home delivery services help you save time and fully enjoy the joy of reading. Join us on a journey of knowledge exploration, passion nurturing, and personal growth every day! ebookbell.com