RemoteFileUtil { static List<String> splitDepotPaths(String depot) { if (depot.startsWith(" depot = depot.substring(2); } List<String> ret = new ArrayList<>(); int prev = 0; int pos = depot.indexOf('/'); while (pos < depot.length() && pos >= 0) { if (pos - prev > 0) { ret.add(depot.substring(prev, pos)); } prev = pos + 1; pos = depot.indexOf('/', prev); } if (prev >= 0 && prev < depot.length()) { ret.add(depot.substring(prev)); } return ret; }  @NotNull static FilePath findRelativeRemotePath(@NotNull P4LocalFile local, @Nullable P4RemoteFile remote);  }
@Test void testSplitDepotPaths_simple() { assertEquals( Collections.singletonList("depot"), RemoteFileUtil.splitDepotPaths(" ); }
@Test void testSplitDepotPaths_many() { assertEquals( Arrays.asList("depot", "a", "b", "c", "d", "e", "f", "g"), RemoteFileUtil.splitDepotPaths(" ); }