Mercurial > jhg
comparison src/org/tmatesoft/hg/internal/Internals.java @ 292:a415fe296a50
Refactor PathRewrite to accept any char sequence, not only string
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Wed, 14 Sep 2011 02:16:19 +0200 |
| parents | 706bcc7cfee4 |
| children | 981f9f50bb6c |
comparison
equal
deleted
inserted
replaced
| 291:1483e57541ef | 292:a415fe296a50 |
|---|---|
| 52 } | 52 } |
| 53 | 53 |
| 54 public PathRewrite buildRepositoryFilesHelper() { | 54 public PathRewrite buildRepositoryFilesHelper() { |
| 55 if ((requiresFlags & STORE) != 0) { | 55 if ((requiresFlags & STORE) != 0) { |
| 56 return new PathRewrite() { | 56 return new PathRewrite() { |
| 57 public String rewrite(String path) { | 57 public CharSequence rewrite(CharSequence path) { |
| 58 return "store/" + path; | 58 return "store/" + path; |
| 59 } | 59 } |
| 60 }; | 60 }; |
| 61 } else { | 61 } else { |
| 62 return new PathRewrite() { | 62 return new PathRewrite.Empty(); |
| 63 public String rewrite(String path) { | |
| 64 //no-op | |
| 65 return path; | |
| 66 } | |
| 67 }; | |
| 68 } | 63 } |
| 69 } | 64 } |
| 70 | 65 |
| 71 public ConfigFile newConfigFile() { | 66 public ConfigFile newConfigFile() { |
| 72 return new ConfigFile(); | 67 return new ConfigFile(); |
| 106 requiresFile.write(sb.toString().getBytes()); | 101 requiresFile.write(sb.toString().getBytes()); |
| 107 requiresFile.close(); | 102 requiresFile.close(); |
| 108 new File(hgDir, "store").mkdir(); // with that, hg verify says ok. | 103 new File(hgDir, "store").mkdir(); // with that, hg verify says ok. |
| 109 } | 104 } |
| 110 | 105 |
| 106 public static boolean runningOnWindows() { | |
| 107 return System.getProperty("os.name").indexOf("Windows") != -1; | |
| 108 } | |
| 109 | |
| 111 } | 110 } |
