1 | Subversion (SVN) and Change Control |
---|
2 | =================================== |
---|
3 | |
---|
4 | Notes: |
---|
5 | ------ |
---|
6 | * Commands preceded with "$" imply that you should execute the command as |
---|
7 | a general user - not as root. |
---|
8 | * Commands preceded with "#" imply that you should be working as root. |
---|
9 | * Commands with more specific command lines (e.g. "rtr>" or "mysql>") |
---|
10 | imply that you are executing commands on remote equipment, or within |
---|
11 | another program. |
---|
12 | * If a command line ends with "\" this indicates that the command continues |
---|
13 | on the next line and you should treat this as a single line. |
---|
14 | |
---|
15 | Exercises Part I |
---|
16 | ================ |
---|
17 | |
---|
18 | 0. Log in to your PC. |
---|
19 | |
---|
20 | Once you are logged in you can continue with these exercises. |
---|
21 | If Subversion is not already installed: |
---|
22 | |
---|
23 | $ sudo bash (become root user) |
---|
24 | |
---|
25 | # apt-get install subversion (install subversion) |
---|
26 | |
---|
27 | 1. Create a root directory for the SVN repository: |
---|
28 | |
---|
29 | # mkdir /svn |
---|
30 | |
---|
31 | 2. Create the repository: |
---|
32 | |
---|
33 | # svnadmin create /svn/myproject |
---|
34 | |
---|
35 | 3. Create user and password |
---|
36 | |
---|
37 | # editor /svn/myproject/conf/passwd |
---|
38 | sysadm = THE_PASSWORD_FROM_CLASS |
---|
39 | |
---|
40 | 4. Configure access |
---|
41 | |
---|
42 | # editor /svn/myproject/conf/svnserve.conf |
---|
43 | |
---|
44 | Find the following lines, and remove comments in front of them. |
---|
45 | Don't leave space at the start of the lines! |
---|
46 | |
---|
47 | auth-access=write |
---|
48 | password-db=passwd |
---|
49 | |
---|
50 | Exit and save the file. |
---|
51 | |
---|
52 | 5. Start the service: |
---|
53 | |
---|
54 | # svnserve -d -r /svn/myproject |
---|
55 | |
---|
56 | 6. Go to your home directory and create a test file: |
---|
57 | |
---|
58 | # cd |
---|
59 | # editor config.txt |
---|
60 | |
---|
61 | Add some text in the file. Save and exit. |
---|
62 | |
---|
63 | 7. Import the test file in to the repository: |
---|
64 | |
---|
65 | # svn import config.txt svn://localhost/config.txt |
---|
66 | |
---|
67 | You'll be placed in an editor where you can make a comment about the |
---|
68 | file being placed in the repository. At the top of the file add some |
---|
69 | short comment, then save and exit from the file. Accept the default filename. |
---|
70 | |
---|
71 | You'll likely end up in the "joe" editor. If so, add a comment at the top of the file, |
---|
72 | then press CTRL-K-X to exit and save. |
---|
73 | |
---|
74 | You will be asked for a "root" password - just press RETURN. |
---|
75 | |
---|
76 | Next you'll need to enter the user you created in the password file, |
---|
77 | i.e: sysadm |
---|
78 | |
---|
79 | Then type in the password (from the class) |
---|
80 | |
---|
81 | Finally, you may see a warning about storing unencrypted passwords. For now |
---|
82 | say "yes" to the prompt to continue. |
---|
83 | |
---|
84 | If it all works you should see something like: |
---|
85 | |
---|
86 | Store password unencrypted (yes/no)? yes |
---|
87 | Adding config.txt |
---|
88 | |
---|
89 | Committed revision 1. |
---|
90 | |
---|
91 | 8. List the repository: |
---|
92 | |
---|
93 | # svn list svn://localhost |
---|
94 | |
---|
95 | You should just see the name of the file we have committed, or: |
---|
96 | |
---|
97 | config.txt |
---|
98 | |
---|
99 | 9. Create a local copy of the repository |
---|
100 | |
---|
101 | # cd /tmp |
---|
102 | # svn checkout svn://localhost |
---|
103 | # cd localhost |
---|
104 | |
---|
105 | The default directory name is "localhost" in this case. |
---|
106 | |
---|
107 | 10. Edit and make changes to config.txt |
---|
108 | |
---|
109 | # editor config.txt |
---|
110 | |
---|
111 | 11. Commit the changes you just made in your local repository to the master SVN |
---|
112 | repository: |
---|
113 | |
---|
114 | # svn commit |
---|
115 | |
---|
116 | Again you'll have a change to add some comments. Do this save the file |
---|
117 | and exit. |
---|
118 | |
---|
119 | You should see: |
---|
120 | |
---|
121 | Committed revision 2. |
---|
122 | |
---|
123 | That's it. You are now using subversion in a local repository: |
---|
124 | |
---|
125 | /tmp/localhost |
---|
126 | |
---|
127 | In conjunction with the master repository: |
---|
128 | |
---|
129 | /svn/myproject |
---|
130 | |
---|
131 | 12. Run a few more svn commands on the local copy of the master repository |
---|
132 | |
---|
133 | As you are in /tmp/localhost if you type: |
---|
134 | |
---|
135 | # ls -lah |
---|
136 | |
---|
137 | you'll see a hidden directory ".svn" - This is what tells the svn |
---|
138 | command that there is a repository. So, if you type: |
---|
139 | |
---|
140 | # svn list |
---|
141 | |
---|
142 | You'll get back: |
---|
143 | |
---|
144 | config.txt |
---|
145 | |
---|
146 | Try running a few more svn commands: |
---|
147 | |
---|
148 | # svn log |
---|
149 | # svn info |
---|
150 | # svn help |
---|
151 | |
---|