comparison src/org/tmatesoft/hg/internal/Internals.java @ 202:706bcc7cfee4

Basic test for HgIncomingCommand. Fix RepositoryComparator for cases when whole repository is unknown. Respect freshly initialized (empty) repositories in general.
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 26 Apr 2011 02:50:06 +0200
parents 6b55f10ef54b
children a415fe296a50
comparison
equal deleted inserted replaced
201:a736f42ed75b 202:706bcc7cfee4
16 */ 16 */
17 package org.tmatesoft.hg.internal; 17 package org.tmatesoft.hg.internal;
18 18
19 import static org.tmatesoft.hg.internal.RequiresFile.*; 19 import static org.tmatesoft.hg.internal.RequiresFile.*;
20 20
21 import java.io.File;
22 import java.io.FileOutputStream;
23 import java.io.IOException;
21 import java.util.ArrayList; 24 import java.util.ArrayList;
22 import java.util.List; 25 import java.util.List;
23 26
24 import org.tmatesoft.hg.repo.HgRepository; 27 import org.tmatesoft.hg.repo.HgRepository;
25 import org.tmatesoft.hg.util.PathRewrite; 28 import org.tmatesoft.hg.util.PathRewrite;
83 filterFactories.add(ff); 86 filterFactories.add(ff);
84 } 87 }
85 } 88 }
86 return filterFactories; 89 return filterFactories;
87 } 90 }
91
92 public void initEmptyRepository(File hgDir) throws IOException {
93 hgDir.mkdir();
94 FileOutputStream requiresFile = new FileOutputStream(new File(hgDir, "requires"));
95 StringBuilder sb = new StringBuilder(40);
96 sb.append("revlogv1\n");
97 if ((requiresFlags & STORE) != 0) {
98 sb.append("store\n");
99 }
100 if ((requiresFlags & FNCACHE) != 0) {
101 sb.append("fncache\n");
102 }
103 if ((requiresFlags & DOTENCODE) != 0) {
104 sb.append("dotencode\n");
105 }
106 requiresFile.write(sb.toString().getBytes());
107 requiresFile.close();
108 new File(hgDir, "store").mkdir(); // with that, hg verify says ok.
109 }
110
88 } 111 }