1 package org.apache.maven.scm.provider.svn.svnexe.command.checkin;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.scm.ScmFile;
23 import org.apache.maven.scm.ScmFileStatus;
24 import org.apache.maven.scm.log.ScmLogger;
25 import org.apache.maven.scm.provider.svn.svnexe.command.AbstractFileCheckingConsumer;
26
27 import java.io.File;
28 import java.util.List;
29
30
31
32
33
34
35 public class SvnCheckInConsumer
36 extends AbstractFileCheckingConsumer
37 {
38 private static final String SENDING_TOKEN = "Sending ";
39
40 private static final String ADDING_TOKEN = "Adding ";
41
42 private static final String ADDING_BIN_TOKEN = "Adding (bin) ";
43
44 private static final String DELETING_TOKEN = "Deleting ";
45
46 private static final String TRANSMITTING_TOKEN = "Transmitting file data";
47
48 private static final String COMMITTED_REVISION_TOKEN = "Committed revision";
49
50
51
52
53
54 public SvnCheckInConsumer( ScmLogger logger, File workingDirectory )
55 {
56 super( logger, workingDirectory );
57 }
58
59
60
61
62
63
64 protected void parseLine( String line )
65 {
66 String file;
67
68 if ( line.startsWith( COMMITTED_REVISION_TOKEN ) )
69 {
70 String revisionString = line.substring( COMMITTED_REVISION_TOKEN.length() + 1, line.length() - 1 );
71
72 revision = parseInt( revisionString );
73
74 return;
75 }
76 else if ( line.startsWith( SENDING_TOKEN ) )
77 {
78 file = line.substring( SENDING_TOKEN.length() );
79 }
80 else if ( line.startsWith( ADDING_TOKEN ) )
81 {
82 file = line.substring( ADDING_TOKEN.length() );
83 }
84 else if ( line.startsWith( ADDING_BIN_TOKEN ) )
85 {
86 file = line.substring( ADDING_BIN_TOKEN.length() );
87 }
88 else if ( line.startsWith( DELETING_TOKEN ) )
89 {
90 file = line.substring( DELETING_TOKEN.length() );
91 }
92 else if ( line.startsWith( TRANSMITTING_TOKEN ) )
93 {
94
95 return;
96 }
97 else
98 {
99 if ( logger.isInfoEnabled() )
100 {
101 logger.info( "Unknown line: '" + line + "'" );
102 }
103
104 return;
105 }
106
107 addFile( new ScmFile( file, ScmFileStatus.CHECKED_IN ) );
108 }
109
110 public List<ScmFile> getCheckedInFiles()
111 {
112 return getFiles();
113 }
114 }