009
YEAR 73220
Software Tools
Subversion and PDStore
COMPSCI
Subversion and PDStore
ealand Part II – Lecture/Lab 5
kland | New Zeversity of AuckThe Univ
1
Today’s Outline
009
y
YEAR 73220
• Subversion (SVN)
S tti U Y P j t
COMPSCI
• Setting Up Your Project – Subversion
PDS
ealand
– PDStore
kland | New Zeversity of AuckThe Univ
2
009
YEAR 732COMPSCI20
Subversion (SVN)
ealand
Subversion (SVN)
kland | New Zeversity of AuckThe Univ
3
Subversion (SVN)
009
( )
• Centralized open-source VCS; started in 2000
YEAR 73220
p
• Developed as replacement for the Concurrent Versions System (CVS) which started 1986
COMPSCI
• Subversion filesystem versions files and folders ("three dimensional" filesystem)
ealand
• Each change creates new revision of the whole fil /f ld st t
kland | New Ze file/folder structure
• Revision names are sequential natural numbers (0 1 2 )
versity of Auck natural numbers (0, 1, 2, …)
The Univ
4
Subversion Features
009 • Supports merging (recommended) as well as locking
YEAR 73220
• Changes are transactions
– Atomic: completely or not at all
Ch n is ith c mmitt d nd b c m s th l t st
COMPSCI
Change is either committed and becomes the latest revision, or is aborted
– Interrupted commits do not corrupt repository
ealand
Interrupted commits do not corrupt repository
• Complete file/folder structure is versioned, including renames and file metadata
kland | New Ze
• Delta encoding and merge algorithms work also with binary data
C t ti l t h i t d t i
versity of Auck • Costs are proportional to change size, not data size
• Works with HTTP server: WebDAV/DeltaV protocol makes it possible to read repository with just a web
The Univ
5
makes it possible to read repository with just a web browser
Basic SVN Operations
009
p
• Checkout: create a working copy of a repository
YEAR 73220
– Choose local folder for working copy – Enter the URL of the repository
– Choose the revision to check out (HEAD revision is latest one)
COMPSCI
Choose the revision to check out (HEAD revision is latest one)
• Update: update your working copy to the latest revision
If i i i ff
ealand
– If no newer revision exists: no effect – If you have changed your working copy:
latest revision will be automatically merged into your working
kland | New Ze y g y g
copy
– Textual merging conflicts have to be resolved manually
versity of Auck
• Commit: write local changes to the repository
– Fails if your local revision is out of date; update first
C t i i
The Univ
6
– Creates a new revision on success
TortoiseSVN
009
Check if somebody else has modified files or has acquired
=Unmodified
=U changed it (needs commit)
YEAR 73220
f f q
lock; also for stealing locks Tell SVN that conflict in files has been resolved
(needs commit)
=Conflict
=U have lock ( l l t )
COMPSCI
has been resolved (release later)
=U deleted it
=U added it Use these instead of normal ones!!!
Also updates version info.
ealand
Create cheap copy of a folder.
Switch to the version in a cheap (l k d )
kland | New Ze
copy (like updating to it).
Merge revision range of branch into other branch.
versity of Auck
Creating a file containing the local changes or use it to update working copy
The Univ
7
copy.
Right-click & drag
= copy/move & update version info
Subclipse
009
p
• SVN plugin for Eclipse, very
YEAR 73220
p g p , y
similar to TortoiseSVN
• Package Explorer will show
COMPSCI
overlay icons for files, e.g.
• Right-click on a folder or file and
l VN d f h
ealand
select SVN command from the
“Team” submenu
Th ds j st th
kland | New Ze • The commands are just the
normal SVN commands, i.e. the way you have to use it is the same
versity of Auck way you have to use it is the same
(still need to add files to repo explicitly)
The Univ
8
Add, Delete, Rename, R v rt
009
Revert
Addfile/folder to the repo
YEAR 73220
p
• All new files/folders need to be added explicitly to the repo
COMPSCI
• Only add source files (e.g. not .classfiles) – Other files are generated from them
ealand
g
– Take up space and are hard to merge
kland | New Ze
For deletingand renaming files/folder in the repo use the SVN commands (don’t delete/rename directly)
versity of Auck
Revertlocal changes in a file/folder if you want to go
The Univ g y g
back to the last version you got from the repo
(i.e. throw away local modifications) 9
Resolving Conflicts
009
g
• After updating SVN might tell you someone committed
YEAR 73220
p g g y
a change that conflicts with your local changes
• Resolving the conflict means deciding how to merge the
COMPSCI
conflicting changes
• Supported by editor h h fli i
ealand
that shows conflicting changes and gives options to resolve it
kland | New Ze options to resolve it
(e.g. use only one of two changes)
versity of Auck g )
• When conflict is resolved, you must
The Univ y
tell SVN
10
Branching / Tagging
009
g gg g
• Creates a copy of a folder in your repository
YEAR 73220
py y p y
• Branch: the copy will be used for further development
• Tag: the copy is just for archival and will remain unchanged
COMPSCI How to do it:
ealand
1. Select folder to copy from (right-click on it, use menu) 2 In the dialog:
kland | New Ze 2. In the dialog:
select new folder to copy to 3. Select revision of that folder
versity of Auck 3. Select rev s on of that folder
(usually HEAD) 4. Enter log message
The Univ
5. Update parent folder of branch or tag to load it
into the local working copy 11
Subversion Tips
009
p
1. Don’t forget to add your files/folders to the repo
YEAR 73220
g y p
2. Don’t add files that are generated (e.g. .class) 3. Careful with binary files, they can be impossible to
COMPSCI
f y f , y mp
merge (so they should be locked)
4. Delete and rename only using SVN operations
ealand
y g p
5. If two SVN clients are running at the same time, there might be errors like “working copy locked”
kland | New Ze
6. If something is wrong with working copy, use cleanup command
versity of Auck
7. If nothing else helps, delete local working copy and check out a new one
8 W i l !!! ( ’ fi d i )
The Univ
8. Write log messages!!! (or you won’t find versions)
12
Subversion References
009
YEAR 732COMPSCI20 • B. Collins-Sussman, B.W. Fitzpatrick, C.M. Pilato.
Version Control with Subversion. 2008.
ealand
http://svnbook.red-bean.com/
kland | New Ze
• TortoiseSVN Manual
versity of Auck
– Press F1 key in any TortoiseSVN dialog for help – Manual can also be found online:
// i /
The Univ
http://tortoisesvn.net/support
13
009
YEAR 732COMPSCI20
Setting Up Your Project
ealand
Setting Up Your Project
kland | New Zeversity of AuckThe Univ
14
Setting Up Your Project
009
g p j
1. Choose and download a grammar from
YEAR 73220
g
http://www.antlr.org/grammar/list
2. Checkout your own local working copy of
https://genoupe se auckland ac nz/svn/students/CS732/projects/
COMPSCI
https://genoupe.se.auckland.ac.nz/svn/students/CS732/projects/
3. Create a branch of projects/Examplein projects Name you branch after the language you chose.
ealand
Name you branch after the language you chose.
4. Open the project in Eclipse – Choose projectsas workspace
kland | New Ze Choose projectsas workspace
– Import the project into the workspace 5 Start the Firebird Guardian:
versity of Auck 5. Start the Firebird Guardian:
Start→Development→Dev. Env. →Firebird →Fb. Guardian 6. Run the reset-pdstore.batin your project folder
The Univ p y p j
A database pdstore.fdbwill be created 15
Working on Your Project
009
g j
1. Have a look at the Eclipse run dialog
YEAR 73220
p g
– Run PDGen on the Java Model – Run GUIDGen
COMPSCI 2. Delete the Java.ggrammar file
3. Add your downloaded grammar file
ealand
3. Add your downloaded grammar file 4. Rename java.sqlto yourlanguage.sql
5 Change reset-pdstore.batso that it refers to
kland | New Ze 5. Change reset pdstore.batso that it refers to
yourlanguageinstead of java
6. Start changing yourlanguage.sql so that an AST model
versity of Auck g g y g g q
for yourlanguageis created (using fresh GUIDs) 7. Run the reset-pdstore.bat in your project folder
The Univ y p j
8. Run PDGen on the yourlanguageModel 16