Mercurial > hg4j
diff 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 |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/Internals.java Thu Apr 21 19:16:45 2011 +0200 +++ b/src/org/tmatesoft/hg/internal/Internals.java Tue Apr 26 02:50:06 2011 +0200 @@ -18,6 +18,9 @@ import static org.tmatesoft.hg.internal.RequiresFile.*; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -85,4 +88,24 @@ } return filterFactories; } + + public void initEmptyRepository(File hgDir) throws IOException { + hgDir.mkdir(); + FileOutputStream requiresFile = new FileOutputStream(new File(hgDir, "requires")); + StringBuilder sb = new StringBuilder(40); + sb.append("revlogv1\n"); + if ((requiresFlags & STORE) != 0) { + sb.append("store\n"); + } + if ((requiresFlags & FNCACHE) != 0) { + sb.append("fncache\n"); + } + if ((requiresFlags & DOTENCODE) != 0) { + sb.append("dotencode\n"); + } + requiresFile.write(sb.toString().getBytes()); + requiresFile.close(); + new File(hgDir, "store").mkdir(); // with that, hg verify says ok. + } + }