Version Control Lab. de Bases de Dados e Aplicações Web MIEIC, FEUP 2010/11 Sérgio Nunes
Version Control • Version control is about maintaining a history of revisions made to documents. • Each revision is associated with a timestamp and a user. Revisions can be compared, restored and merged. • Usually available as standalone applications, but can also be embedded in other software (e.g. Word). • Ability to "undo mistakes". • Essential for the organization of multi-developer projects.
Version Control Systems • Version control systems can be: local only, client- server or distributed. • Open-source systems: CVS (1990), Subversion (2000), Mercurial (2005), Git (2005). • Proprietary systems: Microsoft Visual SourceSafe (1994), Perforce (1995).
Client-Server Central Repository User A User B User C Local Copy Local Copy Local Copy
Typical Actions Central Repository update checkout modify files commit
Subversion • Apache Subversion is an open-source client-server version control system. Often abbreviated as SVN. • Subversion clients are available for all major platforms (UNIX, Windows). For Windows Tortoise is a popular client. • Subversion meta information is kept in each directory within a .svn subdirectory.
Common Commands • Create repository. svn import <folder> <repository address> • Get copy from repository. svn checkout <repository address> • Add new files to repository. svn add <file> • Commit changes to repository. svn commit • Update local copy. svn update
Conflicts Central Repository checkout checkout ? edit file-1.txt edit file-1.txt commit commit
LBAW Prototype Obtain prototype archive exemplo-php.tgz: wget http://web.fe.up.pt/~ssn/2010/lbaw/docs/exemplo-php.tgz Uncompress archive: tar xvfz exemplo-php.tgz Import prototype to each group's SVN repository: svn import exemplo http://lbaw.fe.up.pt/svn/lbaw11gxx/exemplo-php -m "Import prototype" Select local development area (e.g. src or public_html): cd ~/public_html svn checkout http://lbaw.fe.up.pt/svn/lbaw11gxx/exemplo-php cd exemplo-php ... change files ... Commit changes to repository: svn commit -m "Config changed"
Best Practices • Each team member has its own local copy. Visible at http://gnomo.fe.up.pt/~<user login>. • Distribute and organize work between members. • Checkout final version to group's account. Visible at http://gnomo.fe.up.pt/~lbaw11gxx.
References • Version Control with Subversion http://svnbook.red-bean.com • Apache Subversion http://subversion.apache.org
Recommend
More recommend