Subversion @ JUG Milano 11 dic 2009

25
Subversion

description

 

Transcript of Subversion @ JUG Milano 11 dic 2009

Page 1: Subversion @ JUG Milano 11 dic 2009

Subversion

Page 2: Subversion @ JUG Milano 11 dic 2009

• Why I need a version control system?

Page 3: Subversion @ JUG Milano 11 dic 2009

• How many VCS?

Page 4: Subversion @ JUG Milano 11 dic 2009

• How many VCS?

CVS

SubversionMercurial

GitBazar

PerforceVisual Source Safe

...

Page 5: Subversion @ JUG Milano 11 dic 2009

• How to choose VCS?

Andrea Francia
Sarà giusto?
Page 6: Subversion @ JUG Milano 11 dic 2009

My project• Project SISMA• Peoples:

– Software Engineers– Geophysics researchers and PhD

• Artifact:– Word Documents– reStructuredText documents– Computational softwares (Bash, C, C++, Fortran)– Other project (Java)

• Security concerns:– Authorizations and Authentication needed

• Other constraints:– Big repo, need of sparse checkout– Binary data– Clients needed for Windows, Mac and Linux

Page 7: Subversion @ JUG Milano 11 dic 2009

My Choice

• Subversion• Reasons:

– Central repository model– Path Based authorization– Selective checkout– Fewer concepts– HTTP Friendly (subset of WebDAV)– Works on Linux, Mac and Windows– Word comparison (through TortoiseSVN)

Page 8: Subversion @ JUG Milano 11 dic 2009

Central Repository Architecture

Central Repository

working copy

svn client

working copy

svn client

working copy

svn client

web browserr/w

r/w r/w

ro

simpler to explain

No local copy of all repo

only online operations

Fewer concepts

Page 9: Subversion @ JUG Milano 11 dic 2009

Fewer concepts

Subverion HG GIT

Commit

Update

Commit

Update

Push

Pull

Commit

Update

Push

Pull

Staging Index

Porcelain

Plumber

Page 10: Subversion @ JUG Milano 11 dic 2009

Clients

• Linux and Mac: svn client

• Windows: TortoiseSVN

$ svn helpusage: svn <subcommand> [options] [args]Subversion command-line client, version 1.6.3.Type 'svn help <subcommand>' for help on a specific subcommand.Type 'svn --version' to see the program version and RA modules or 'svn --version --quiet' to see just the version number.

Page 11: Subversion @ JUG Milano 11 dic 2009

Choosing Server

Apache HTTP

svnserve

svnserve over SSH

fastest!

faster!

Logging!

no log

no log

easy set up

SSH accounts

file permissions

Apache Auth

SSL

firewall friendlybrowser friendly

e.g.LDAP

SLOWEST

Page 12: Subversion @ JUG Milano 11 dic 2009

(Web) Browser Friendlinessrevision number

access from web browsers

• Use case? Deliver a document

Page 13: Subversion @ JUG Milano 11 dic 2009

(Web) Browser Friendliness

• Pick a specific revision (after svn 1.6)

Page 14: Subversion @ JUG Milano 11 dic 2009

Authentication and Authorization (corporate secrets)

• Why bother about? – Because is a requirement:

• Copyright on some artifacts• Artifacts from different partners• Non disclosures agreements• Secrets!

• How?– Path Based Authentication

(http://svnbook.red-bean.com/nightly/en/svn.serverconfig.pathbasedauthz.html)

• Coarse Grained • Difficult to maintain • Doesn’t know anything about history • The only choice

Page 15: Subversion @ JUG Milano 11 dic 2009

/etc/httpd-public/conf.d/subversion.conf

<Location /svn/> DAV svn SVNParentPath /var/svn/ AuthType Basic AuthBasicProvider ldap AuthName "Subversion repository“ AuthLDAPURL ldap://127.0.0.1:389/ou=People,

o=mycompany.com?uid?sub?(objectClass=*) Require valid-user AuthzSVNAccessFile /var/svn/svn-access-file.conf Options Indexes SVNListParentPath on</Location>

Path Based Authorization (1)

Page 16: Subversion @ JUG Milano 11 dic 2009

Path Based Authorization (2)

/var/svn/svn-access-file.conf[groups]mycompany = bob, alicepartner1 = charlie, bravo

[project1:/]

@mycompany=rw

@partner1=r

[project1:/secrets]

@mycompany=rw

@partner1=

[project1:/partner-contribution]@mycompany=rw @partner1=rw

The real file is much bigger! 434 lines

You can split it!

If not well formatted…

Difficult to test write without actually write in the repository!

Page 17: Subversion @ JUG Milano 11 dic 2009

Sparse Checkout (>1.5)(big company, big data)

working copy

4.1 Gb!!

Central Repository

4.1 GB!!!

Page 18: Subversion @ JUG Milano 11 dic 2009

Tortoise SVN

• Windows Client• Integrates with Windows Explorer • Supports basic operations

– Check Out– Update– Commit– Show Log

• Other operations– Repository Browser– Visual Comparison of Word Files– Revision Graph

Page 19: Subversion @ JUG Milano 11 dic 2009

Lab

• Creating a local repo • Creating a repo on beanstalkapp.com• Making the first Checkout• Visual comparing Word documents• Visual comparing Images• Visualizing the history of a document• Using revision graph (with comparing)• Repo Browser con trash-cli (in locale)• Esempio di sparse checkout• Repair move

Page 20: Subversion @ JUG Milano 11 dic 2009

Non solo Subversion

• Subversion server, local mercurial:– hgsubversion

• Using some TortoiseSVN comparison facilities in TortoiseHG:

– http://blog.andreafrancia.it/2009/09/how-compare-word-documents-in.html

Page 21: Subversion @ JUG Milano 11 dic 2009

Links

• Per imparare ad usare Subversion:http://svnbook.red-bean.com/

• Per la scelta:http://versioncontrolblog.com/

• Hosting privato (ad esempio):– http://beanstalkapp.com/

• Hostint opensource (ad esempio):– http://code.google.com/hosting/createProject

• blog.andreafrancia.it:– http://blog.andreafrancia.it/2009/10/utilities-for-managing-svnignore.html– http://blog.andreafrancia.it/2009/07/il-protocollo-di-subversion-si-rinnova.html– http://blog.andreafrancia.it/2008/12/creare-un-repository-personale-svnssh.html

Page 22: Subversion @ JUG Milano 11 dic 2009

Visual comparison

• Create a repo.

• Check out the repo in a wc.

• Create a Word Document and write something in it.

• Commit adding the file.

• Modify the document and commit again.

• Show differences.

Page 23: Subversion @ JUG Milano 11 dic 2009

Compare with … (1/2)

… with any other revision

… with the previous revision

Page 24: Subversion @ JUG Milano 11 dic 2009

Compare with … (2/2)

… with any different branch of the document

Page 25: Subversion @ JUG Milano 11 dic 2009

Revision Graph