Mercurial > hg > mercurial
view mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/StatusCommandTest.java @ 161:bcc04a74783d Eluru-6.0.x
Update copyrights
author | Dmitry Neverov <dmitry.neverov@jetbrains.com> |
---|---|
date | Fri, 21 Jan 2011 09:56:06 +0300 |
parents | 6c1cff1f61cc |
children | d314f06e6ee3 |
line wrap: on
line source
/* * Copyright 2000-2011 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package jetbrains.buildServer.buildTriggers.vcs.mercurial.command; import jetbrains.buildServer.vcs.VcsException; import org.jetbrains.annotations.NotNull; import org.testng.annotations.Test; import java.io.File; import java.io.IOException; import java.util.List; @Test public class StatusCommandTest extends BaseCommandTestCase { public void testAddedFile() throws IOException, VcsException { setRepository("mercurial-tests/testData/rep1", true); List<ModifiedFile> files = runStatus("9875b412a788", "1d446e82d356"); assertEquals(1, files.size()); ModifiedFile md = files.get(0); assertEquals(ModifiedFile.Status.ADDED, md.getStatus()); assertEquals("dir1/file3.txt", md.getPath().replace(File.separatorChar, '/')); } public void testRemovedFile() throws IOException, VcsException { setRepository("mercurial-tests/testData/rep1", true); List<ModifiedFile> files = runStatus("7209b1f1d793", "9522278aa38d"); assertEquals(1, files.size()); ModifiedFile md = files.get(0); assertEquals(ModifiedFile.Status.REMOVED, md.getStatus()); assertEquals("dir1/file4.txt", md.getPath().replace(File.separatorChar, '/')); } public void testModifiedFile() throws IOException, VcsException { setRepository("mercurial-tests/testData/rep1", true); List<ModifiedFile> files = runStatus("9522278aa38d", "b06a290a363b"); assertEquals(1, files.size()); ModifiedFile md = files.get(0); assertEquals(ModifiedFile.Status.MODIFIED, md.getStatus()); assertEquals("dir1/file3.txt", md.getPath().replace(File.separatorChar, '/')); } private List<ModifiedFile> runStatus(final String fromId, final String toId) throws IOException, VcsException { return runCommand(new CommandExecutor<List<ModifiedFile>>() { public List<ModifiedFile> execute(@NotNull final Settings settings) throws VcsException { StatusCommand st = new StatusCommand(settings); st.setFromRevId(fromId); st.setToRevId(toId); return st.execute(); } }); } }