1 | |
package org.apache.maven.scm.provider.svn; |
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.ChangeFile; |
23 | |
import org.apache.maven.scm.ChangeSet; |
24 | |
import org.apache.maven.scm.provider.ScmProviderRepository; |
25 | |
import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository; |
26 | |
import org.codehaus.plexus.util.StringUtils; |
27 | |
|
28 | |
import java.util.Date; |
29 | |
import java.util.Iterator; |
30 | |
import java.util.List; |
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
public class SvnChangeSet |
37 | |
extends ChangeSet |
38 | |
{ |
39 | |
|
40 | |
private static final long serialVersionUID = -4454710577968060741L; |
41 | |
|
42 | |
public SvnChangeSet() |
43 | |
{ |
44 | 0 | super(); |
45 | 0 | } |
46 | |
|
47 | |
public SvnChangeSet( String strDate, String userDatePattern, String comment, String author, |
48 | |
List<ChangeFile> files ) |
49 | |
{ |
50 | 0 | super( strDate, userDatePattern, comment, author, files ); |
51 | 0 | } |
52 | |
|
53 | |
public SvnChangeSet( Date date, String comment, String author, List<ChangeFile> files ) |
54 | |
{ |
55 | 0 | super( date, comment, author, files ); |
56 | 0 | } |
57 | |
|
58 | |
|
59 | |
public boolean containsFilename( String filename, ScmProviderRepository repository ) |
60 | |
{ |
61 | 0 | SvnScmProviderRepository repo = (SvnScmProviderRepository) repository; |
62 | |
|
63 | 0 | String url = repo.getUrl(); |
64 | |
|
65 | 0 | if ( !url.endsWith( "/" ) ) |
66 | |
{ |
67 | 0 | url += "/"; |
68 | |
} |
69 | |
|
70 | 0 | String currentFile = url + StringUtils.replace( filename, "\\", "/" ); |
71 | |
|
72 | 0 | if ( getFiles() != null ) |
73 | |
{ |
74 | 0 | for ( Iterator<ChangeFile> i = getFiles().iterator(); i.hasNext(); ) |
75 | |
{ |
76 | 0 | ChangeFile file = i.next(); |
77 | |
|
78 | 0 | if ( currentFile.endsWith( StringUtils.replace( file.getName(), "\\", "/" ) ) ) |
79 | |
{ |
80 | 0 | return true; |
81 | |
} |
82 | 0 | } |
83 | |
} |
84 | |
|
85 | 0 | return false; |
86 | |
} |
87 | |
} |