Mercurial > hg > mercurial
changeset 245:4664e5105633
do labeling in tmp dir
author | Dmitry Neverov <dmitry.neverov@jetbrains.com> |
---|---|
date | Tue, 19 Apr 2011 16:52:26 +0400 |
parents | 5496c02d8dc1 |
children | 8ffe311f9b8e |
files | mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java |
diffstat | 1 files changed, 19 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java Tue Apr 19 16:48:55 2011 +0400 +++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java Tue Apr 19 16:52:26 2011 +0400 @@ -636,26 +636,27 @@ } public String label(@NotNull String label, @NotNull String version, @NotNull VcsRoot root, @NotNull CheckoutRules checkoutRules) throws VcsException { - Settings settings = createSettings(root); - syncRepository(settings); - File workingDir = getWorkingDir(settings); - // I do not know why but hg tag does not work correctly if - // update command was not invoked for the current repo - // in such case if there were no tags before Mercurial attempts to - // create new head when tag is pushed to the parent repository - UpdateCommand uc = new UpdateCommand(settings, workingDir); - uc.execute(); + File tmpDir = null; + try { + tmpDir = createLabelingTmpDir(); + Settings settings = createSettings(root, tmpDir); + syncRepository(settings); + File workingDir = getWorkingDir(settings); + new UpdateCommand(settings, workingDir).execute(); - String fixedTagname = fixTagName(label); - TagCommand tc = new TagCommand(settings, workingDir); - tc.setRevId(new ChangeSet(version).getId()); - tc.setTag(fixedTagname); - tc.execute(); + String fixedTagname = fixTagName(label); + TagCommand tc = new TagCommand(settings, workingDir); + tc.setRevId(new ChangeSet(version).getId()); + tc.setTag(fixedTagname); + tc.execute(); - PushCommand pc = new PushCommand(settings, workingDir); -// pc.setForce(true); - pc.execute(); - return fixedTagname; + PushCommand pc = new PushCommand(settings, workingDir); + pc.execute(); + return fixedTagname; + } finally { + if (tmpDir != null) + FileUtil.delete(tmpDir); + } } private String fixTagName(final String label) {