1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 from translate.storage.versioncontrol import run_command
24 from translate.storage.versioncontrol import GenericRevisionControlSystem
25
26 -class svn(GenericRevisionControlSystem):
27 """Class to manage items under revision control of Subversion."""
28
29 RCS_METADIR = ".svn"
30 SCAN_PARENTS = False
31
32 - def update(self, revision=None):
33 """update the working copy - remove local modifications if necessary"""
34
35 command = ["svn", "revert", self.location_abs]
36 exitcode, output_revert, error = run_command(command)
37
38 if exitcode != 0:
39 raise IOError("[SVN] Subversion error running '%s': %s" \
40 % (command, error))
41
42 command = ["svn", "update"]
43 if not revision is None:
44 command.extend(["-r", revision])
45
46 command.append(self.location_abs)
47 exitcode, output_update, error = run_command(command)
48 if exitcode != 0:
49 raise IOError("[SVN] Subversion error running '%s': %s" \
50 % (command, error))
51 return output_revert + output_update
52
53 - def commit(self, message=None):
54 """commit the file and return the given message if present"""
55 command = ["svn", "-q", "--non-interactive", "commit"]
56 if message:
57 command.extend(["-m", message])
58
59 command.append(self.location_abs)
60 exitcode, output, error = run_command(command)
61 if exitcode != 0:
62 raise IOError("[SVN] Error running SVN command '%s': %s" % (command, error))
63 return output
64
66 """return the content of the 'head' revision of the file"""
67 command = ["svn", "cat"]
68 if not revision is None:
69 command.extend(["-r", revision])
70
71 command.append(self.location_abs)
72 exitcode, output, error = run_command(command)
73 if exitcode != 0:
74 raise IOError("[SVN] Subversion error running '%s': %s" % (command, error))
75 return output
76