Mercurial > hg > mercurial
comparison mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java @ 853:820d02ac9b8a
Map subrepo path when we remove it
author | Dmitry Neverov <dmitry.neverov@jetbrains.com> |
---|---|
date | Thu, 03 Jul 2014 22:12:06 +0200 |
parents | fcc2a5bf4238 |
children | 24a6ef9166ae |
comparison
equal
deleted
inserted
replaced
852:d746a9351572 | 853:820d02ac9b8a |
---|---|
332 String subrepoToRevision = currentSubrepo.revision(); | 332 String subrepoToRevision = currentSubrepo.revision(); |
333 CheckoutRules subrepoRules = mySubrepoCheckoutRulesProvider.getSubrepoRules(mainRootRules, subrepoPath); | 333 CheckoutRules subrepoRules = mySubrepoCheckoutRulesProvider.getSubrepoRules(mainRootRules, subrepoPath); |
334 buildPatch(subrepoRoot, subrepoFromRevision, subrepoToRevision, builder, subrepoRules); | 334 buildPatch(subrepoRoot, subrepoFromRevision, subrepoToRevision, builder, subrepoRules); |
335 | 335 |
336 } else if (configChange.subrepoRemoved()) { | 336 } else if (configChange.subrepoRemoved()) { |
337 builder.deleteDirectory(new File(subrepoPath), true); | 337 deleteDirInPatch(builder, mainRootRules, subrepoPath); |
338 | 338 |
339 } else if (configChange.subrepoUrlChanged()) { | 339 } else if (configChange.subrepoUrlChanged()) { |
340 assert currentSubrepo != null; | 340 assert currentSubrepo != null; |
341 builder.deleteDirectory(new File(subrepoPath), true); | 341 deleteDirInPatch(builder, mainRootRules, subrepoPath); |
342 | 342 |
343 String subrepoUrl = currentSubrepo.resolveUrl(mainRoot.getRepository()); | 343 String subrepoUrl = currentSubrepo.resolveUrl(mainRoot.getRepository()); |
344 HgVcsRoot subrepoRoot = mainRoot.withUrl(subrepoUrl); | 344 HgVcsRoot subrepoRoot = mainRoot.withUrl(subrepoUrl); |
345 String subrepoFromRevision = null; | 345 String subrepoFromRevision = null; |
346 String subrepoToRevision = currentSubrepo.revision(); | 346 String subrepoToRevision = currentSubrepo.revision(); |
357 buildPatch(subrepoRoot, subrepoFromRevision, subrepoToRevision, builder, subrepoRules); | 357 buildPatch(subrepoRoot, subrepoFromRevision, subrepoToRevision, builder, subrepoRules); |
358 } | 358 } |
359 } catch (WrongSubrepoUrlException e) { | 359 } catch (WrongSubrepoUrlException e) { |
360 throw new VcsException("Error while resolving subrepo url", e); | 360 throw new VcsException("Error while resolving subrepo url", e); |
361 } | 361 } |
362 } | |
363 } | |
364 | |
365 private void deleteDirInPatch(@NotNull PatchBuilder builder, @NotNull CheckoutRules rules, @NotNull String unMappedPath) throws IOException { | |
366 for (IncludeRule rule : rules.getRootIncludeRules()) { | |
367 String mappedPath = rule.map(unMappedPath); | |
368 if (mappedPath != null) | |
369 builder.deleteDirectory(new File(mappedPath), true); | |
362 } | 370 } |
363 } | 371 } |
364 | 372 |
365 // builds patch by exporting files using specified version | 373 // builds patch by exporting files using specified version |
366 private void buildFullPatch(@NotNull final HgVcsRoot root, | 374 private void buildFullPatch(@NotNull final HgVcsRoot root, |