1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.util.service;
17
18 import java.io.File;
19 import java.util.ArrayList;
20 import java.util.Arrays;
21 import java.util.List;
22
23 import org.kuali.common.util.Assert;
24 import org.kuali.common.util.CollectionUtils;
25 import org.kuali.common.util.LocationUtils;
26
27
28
29
30 @Deprecated
31 public class SvnService extends DefaultExecService implements ScmService {
32
33 private static final String SVN = "svn";
34
35 @Override
36 public void version() {
37 executeAndValidate(SVN, Arrays.asList("--version"));
38 }
39
40 @Override
41 public void add(List<File> paths) {
42 if (CollectionUtils.isEmpty(paths)) {
43
44 return;
45 }
46 String command = "add";
47 List<String> cpaths = LocationUtils.getCanonicalPaths(paths);
48 List<String> options = Arrays.asList("--force", "--parents", "--depth", "infinity");
49
50 List<String> arguments = new ArrayList<String>();
51 arguments.add(command);
52 arguments.addAll(cpaths);
53 arguments.addAll(options);
54
55 executeAndValidate(SVN, arguments);
56 }
57
58 @Override
59 public void delete(List<File> paths) {
60 if (CollectionUtils.isEmpty(paths)) {
61
62 return;
63 }
64 String command = "delete";
65 List<String> cpaths = LocationUtils.getCanonicalPaths(paths);
66 List<String> options = Arrays.asList("--force");
67
68 List<String> arguments = new ArrayList<String>();
69 arguments.add(command);
70 arguments.addAll(cpaths);
71 arguments.addAll(options);
72
73 executeAndValidate(SVN, arguments);
74 }
75
76 @Override
77 public void commit(List<File> paths, String message) {
78 if (CollectionUtils.isEmpty(paths)) {
79
80 return;
81 }
82 Assert.notBlank(message, "Commit message is blank");
83 String command = "commit";
84 List<String> cpaths = LocationUtils.getCanonicalPaths(paths);
85 List<String> options = Arrays.asList("--depth", "infinity", "--message", message);
86
87 List<String> arguments = new ArrayList<String>();
88 arguments.add(command);
89 arguments.addAll(cpaths);
90 arguments.addAll(options);
91
92 executeAndValidate(SVN, arguments);
93 }
94
95 }