annotate test/org/tmatesoft/hg/test/TestDirstate.java @ 293:9774f47d904d

Issue 13: Status reports filenames with case other than in dirstate incorrectly
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 14 Sep 2011 04:11:37 +0200
parents 954763c82cc3
children 02f2963c70fa
rev   line source
286
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
1 /*
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
2 * Copyright (c) 2011 TMate Software Ltd
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
3 *
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
6 * the Free Software Foundation; version 2 of the License.
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
7 *
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
8 * This program is distributed in the hope that it will be useful,
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
11 * GNU General Public License for more details.
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
12 *
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
13 * For information on how to redistribute this software under
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
14 * the terms of a license other than GNU General Public License
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
15 * contact TMate Software at support@hg4j.com
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
16 */
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
17 package org.tmatesoft.hg.test;
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
18
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
19 import org.junit.Assert;
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
20 import org.junit.Test;
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
21 import org.tmatesoft.hg.core.Nodeid;
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
22 import org.tmatesoft.hg.repo.HgLookup;
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
23 import org.tmatesoft.hg.repo.HgRepository;
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
24 import org.tmatesoft.hg.util.Pair;
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
25
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
26 /**
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
27 *
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
28 * @author Artem Tikhomirov
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
29 * @author TMate Software Ltd.
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
30 */
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
31 public class TestDirstate {
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
32 private HgRepository repo;
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
33
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
34 @Test
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
35 public void testParents() throws Exception {
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
36 repo = Configuration.get().find("log-branches");
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
37 final Pair<Nodeid, Nodeid> wcParents = repo.getWorkingCopyParents();
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
38 Assert.assertEquals("5f24ef64e9dfb1540db524f88cb5c3d265e1a3b5", wcParents.first().toString());
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
39 Assert.assertTrue(wcParents.second().isNull());
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
40 //
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
41 // TODO same static and non-static
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
42 }
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
43
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
44 @Test
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
45 public void testParentsEmptyRepo() throws Exception {
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
46 // check contract return values for empty/nonexistent dirstate
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
47 repo = new HgLookup().detect(TestIncoming.initEmptyTempRepo("testParentsEmptyRepo"));
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
48 final Pair<Nodeid, Nodeid> wcParents = repo.getWorkingCopyParents();
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
49 Assert.assertTrue(wcParents.first().isNull());
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
50 Assert.assertTrue(wcParents.second().isNull());
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
51 }
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
52
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
53 @Test
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
54 public void testBranchName() throws Exception {
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
55 repo = Configuration.get().find("log-branches");
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
56 Assert.assertEquals("test", repo.getWorkingCopyBranchName());
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
57 repo = Configuration.get().own();
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
58 Assert.assertEquals("default", repo.getWorkingCopyBranchName());
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
59 }
293
9774f47d904d Issue 13: Status reports filenames with case other than in dirstate incorrectly
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 286
diff changeset
60
9774f47d904d Issue 13: Status reports filenames with case other than in dirstate incorrectly
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 286
diff changeset
61 public void testMixedNameCaseHandling() {
9774f47d904d Issue 13: Status reports filenames with case other than in dirstate incorrectly
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 286
diff changeset
62 // 1. dirstate: /a/b/c, FileIterator: /a/B/C
9774f47d904d Issue 13: Status reports filenames with case other than in dirstate incorrectly
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 286
diff changeset
63 // 2. dirstate: /a/B/C, FileIterator: /a/b/c
9774f47d904d Issue 13: Status reports filenames with case other than in dirstate incorrectly
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 286
diff changeset
64 // 2. dirstate: /a/B/C, FileIterator: /A/b/C
9774f47d904d Issue 13: Status reports filenames with case other than in dirstate incorrectly
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 286
diff changeset
65 }
286
954763c82cc3 Few tests for working copy information (branch, parents)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
66 }