Mercurial > jhg
view src/org/tmatesoft/hg/repo/HgSubrepoLocation.java @ 413:7f27122011c3
Support and respect for symbolic links and executable flag, with /bin/ls backed implementation to discover these
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 21 Mar 2012 20:40:28 +0100 |
parents | 2747b0723867 |
children | 9c9c442b5f2e |
line wrap: on
line source
/* * Copyright (c) 2011-2012 TMate Software Ltd * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * For information on how to redistribute this software under * the terms of a license other than GNU General Public License * contact TMate Software at support@hg4j.com */ package org.tmatesoft.hg.repo; import java.io.File; import org.tmatesoft.hg.core.HgBadStateException; import org.tmatesoft.hg.core.HgInvalidFileException; import org.tmatesoft.hg.internal.Experimental; import org.tmatesoft.hg.util.Path; /** * WORK IN PROGRESS, DO NOT USE * @author Artem Tikhomirov * @author TMate Software Ltd. */ @Experimental(reason="Work in progress") public class HgSubrepoLocation { private final HgRepository owner; private final Kind kind; private final Path location; private final String source; private final String revInfo; public enum Kind { Hg, SVN, Git, } public HgSubrepoLocation(HgRepository parentRepo, String repoLocation, String actualLocation, Kind type, String revision) { owner = parentRepo; location = Path.create(repoLocation); source = actualLocation; kind = type; revInfo = revision; } // as defined in .hgsub, key value public Path getLocation() { return location; } // value from .hgsub public String getSource() { return source; } public Kind getType() { return kind; } public String getRevision() { return revInfo; } /** * @return whether this sub repository is known only locally */ public boolean isCommitted() { return revInfo != null; } /** * @return <code>true</code> when there are local changes in the sub repository */ public boolean hasChanges() { throw HgRepository.notImplemented(); } // public boolean isLocal() { // } public HgRepository getOwner() { return owner; } public HgRepository getRepo() throws HgInvalidFileException { if (kind != Kind.Hg) { throw new HgBadStateException(String.format("Unsupported subrepository %s", kind)); } return new HgLookup().detect(new File(owner.getWorkingDir(), source)); } }