Login | Register
My pages Projects Community openCollabNet

Discussions > dev > [Subclipse-dev] [Patch] isKnownRepository improvement in SVNRepositories.java

subclipse
Discussion topic

Back to topic list

[Subclipse-dev] [Patch] isKnownRepository improvement in SVNRepositories.java

Author laca
Full name Laszlo Biczok
Date 2009-02-19 02:12:00 PST
Message Hi,

If my previous suggestion about the unnecessary iteration in SVNRepositories.java is accepted, then isKnownRepository() can be improved by taking advantage of the improvement of exactMatchExists() by separating the exact match check from the rest.
The suggested modification is below.

Cheers,

Laca

### Eclipse Workspace Patch 1.0
#P org.tigris.subversio​n.subclipse.core
Index: src/org/tigris/subve​rsion/subclipse/core​/repo/SVNRepositorie​s.java
====================​====================​====================​=======
--- src/org/tigris/subve​rsion/subclipse/core​/repo/SVNRepositorie​s.java (revision 4302)
+++ src/org/tigris/subve​rsion/subclipse/core​/repo/SVNRepositorie​s.java (working copy)
@@ -364,15 +364,19 @@
     * The location string corresponds to the Strin returned by ISVNRepositoryLocati​on#getLocation()
     */
    public boolean isKnownRepository(String location, boolean requireExactMatch) {
- Set keys = repositories.keySet();
- for(Iterator iter = keys.iterator();iter​.hasNext();){
- String checkLocation = (String)iter.next();
- if(!requireExactMatch && location.indexOf(che​ckLocation)!=-1){
- return true;
- }
- if (location.equals(che​ckLocation)) return true;
- }
- return false;
+ if(requireExactMatch) {
+ return exactMatchExists(location);
+ }
+ else{
+ Set keys = repositories.keySet();
+ for(Iterator iter = keys.iterator();iter​.hasNext();){
+ String checkLocation = (String)iter.next();
+ if(location.indexOf(​checkLocation)!=-1){​
+ return true;
+ }
+ }
+ return false;
+ }
    }

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

[Subclipse-dev] [Patch] isKnownRepository improvement in SVNRepositories.java laca Laszlo Biczok 2009-02-19 02:12:00 PST
Messages per page: