comparison src/org/tmatesoft/hg/repo/HgRepository.java @ 235:fd845a53f53d

Experimental access to working dir parents
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 07 Jun 2011 04:54:13 +0200
parents b2cfbe46f9b6
children 6e1373b54e9b
comparison
equal deleted inserted replaced
234:b2cfbe46f9b6 235:fd845a53f53d
14 * the terms of a license other than GNU General Public License 14 * the terms of a license other than GNU General Public License
15 * contact TMate Software at support@hg4j.com 15 * contact TMate Software at support@hg4j.com
16 */ 16 */
17 package org.tmatesoft.hg.repo; 17 package org.tmatesoft.hg.repo;
18 18
19 import static org.tmatesoft.hg.core.Nodeid.NULL;
20
19 import java.io.File; 21 import java.io.File;
20 import java.io.IOException; 22 import java.io.IOException;
21 import java.io.StringReader; 23 import java.io.StringReader;
22 import java.lang.ref.SoftReference; 24 import java.lang.ref.SoftReference;
23 import java.nio.charset.Charset; 25 import java.nio.charset.Charset;
25 import java.util.Collections; 27 import java.util.Collections;
26 import java.util.HashMap; 28 import java.util.HashMap;
27 import java.util.List; 29 import java.util.List;
28 30
29 import org.tmatesoft.hg.core.HgDataStreamException; 31 import org.tmatesoft.hg.core.HgDataStreamException;
32 import org.tmatesoft.hg.core.Nodeid;
30 import org.tmatesoft.hg.internal.ByteArrayChannel; 33 import org.tmatesoft.hg.internal.ByteArrayChannel;
31 import org.tmatesoft.hg.internal.ConfigFile; 34 import org.tmatesoft.hg.internal.ConfigFile;
32 import org.tmatesoft.hg.internal.DataAccessProvider; 35 import org.tmatesoft.hg.internal.DataAccessProvider;
33 import org.tmatesoft.hg.internal.Experimental; 36 import org.tmatesoft.hg.internal.Experimental;
34 import org.tmatesoft.hg.internal.Filter; 37 import org.tmatesoft.hg.internal.Filter;
35 import org.tmatesoft.hg.internal.RequiresFile; 38 import org.tmatesoft.hg.internal.RequiresFile;
36 import org.tmatesoft.hg.internal.RevlogStream; 39 import org.tmatesoft.hg.internal.RevlogStream;
37 import org.tmatesoft.hg.util.CancelledException; 40 import org.tmatesoft.hg.util.CancelledException;
41 import org.tmatesoft.hg.util.Pair;
38 import org.tmatesoft.hg.util.Path; 42 import org.tmatesoft.hg.util.Path;
39 import org.tmatesoft.hg.util.PathRewrite; 43 import org.tmatesoft.hg.util.PathRewrite;
40 import org.tmatesoft.hg.util.ProgressSupport; 44 import org.tmatesoft.hg.util.ProgressSupport;
41 45
42 46
217 221
218 /* clients need to rewrite path from their FS to a repository-friendly paths, and, perhaps, vice versa*/ 222 /* clients need to rewrite path from their FS to a repository-friendly paths, and, perhaps, vice versa*/
219 public PathRewrite getToRepoPathHelper() { 223 public PathRewrite getToRepoPathHelper() {
220 return normalizePath; 224 return normalizePath;
221 } 225 }
226
227 @Experimental(reason="return type and possible values (presently null, perhaps Nodeid.NULL) may get changed")
228 public Pair<Nodeid,Nodeid> getWorkingCopyParents() {
229 Nodeid[] p = loadDirstate().parents();
230 return new Pair<Nodeid,Nodeid>(NULL == p[0] ? null : p[0], NULL == p[1] ? null : p[1]);
231 }
222 232
223 // local to hide use of io.File. 233 // local to hide use of io.File.
224 /*package-local*/ File getRepositoryRoot() { 234 /*package-local*/ File getRepositoryRoot() {
225 return repoDir; 235 return repoDir;
226 } 236 }