Mercurial > hg4j
comparison test/org/tmatesoft/hg/test/MapTagsToFileRevisions.java @ 311:b9592e21176a
Tests for array sort and reverse index building helper
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Mon, 26 Sep 2011 04:06:04 +0200 |
parents | 2f2ab5c27f41 |
children | 283b294d1079 |
comparison
equal
deleted
inserted
replaced
310:237de162be28 | 311:b9592e21176a |
---|---|
53 * each 1000'th revision, total 71 revision: 1 230 vs 270 | 53 * each 1000'th revision, total 71 revision: 1 230 vs 270 |
54 * each 2000'th revision, total 36 revision: 620 vs 270 | 54 * each 2000'th revision, total 36 revision: 620 vs 270 |
55 * each 3000'th revision, total 24 revision: 410 vs 275 | 55 * each 3000'th revision, total 24 revision: 410 vs 275 |
56 */ | 56 */ |
57 private void revisionMap() throws Exception { | 57 private void revisionMap() throws Exception { |
58 ArrayHelper ah = new ArrayHelper(); | |
59 final List<String> initial = Arrays.asList("d", "w", "k", "b", "c", "i", "a", "r", "e", "h"); | |
60 String[] a = (String[]) initial.toArray(); | |
61 ah.sort(a); | |
62 System.out.println(Arrays.toString(initial.toArray())); | |
63 System.out.println(Arrays.toString(a)); | |
64 System.out.println(Arrays.toString(ah.getReverse())); | |
65 Object[] rebuilt = new Object[a.length]; | |
66 for (int i = 0; i < a.length; i++) { | |
67 int indexInOriginal = ah.getReverse()[i]; | |
68 rebuilt[indexInOriginal-1] = a[i]; | |
69 } | |
70 System.out.println(Arrays.toString(rebuilt)); | |
71 // | |
72 final HgRepository repository = new HgLookup().detect(new File("/temp/hg/cpython")); | 58 final HgRepository repository = new HgLookup().detect(new File("/temp/hg/cpython")); |
73 final HgChangelog clog = repository.getChangelog(); | 59 final HgChangelog clog = repository.getChangelog(); |
74 ArrayList<Nodeid> revisions = new ArrayList<Nodeid>(); | 60 ArrayList<Nodeid> revisions = new ArrayList<Nodeid>(); |
75 final int step = 5000; | 61 final int step = 5000; |
76 for (int i = 0, top = clog.getLastRevision(); i < top; i += step) { | 62 for (int i = 0, top = clog.getLastRevision(); i < top; i += step) { |