tikhomirov@10: /* tikhomirov@0: * Copyright (c) 2010 Artem Tikhomirov tikhomirov@0: */ tikhomirov@0: package com.tmate.hgkit.ll; tikhomirov@0: tikhomirov@1: tikhomirov@0: /** tikhomirov@0: * @author artem tikhomirov@0: */ tikhomirov@1: public abstract class HgRepository { tikhomirov@0: tikhomirov@5: public static final int TIP = -1; tikhomirov@5: tikhomirov@2: // temp aux marker method tikhomirov@2: public static IllegalStateException notImplemented() { tikhomirov@2: return new IllegalStateException("Not implemented"); tikhomirov@2: } tikhomirov@2: tikhomirov@0: tikhomirov@0: private Changelog changelog; tikhomirov@2: private HgManifest manifest; tikhomirov@2: tikhomirov@1: private boolean isInvalid = true; tikhomirov@1: tikhomirov@1: public boolean isInvalid() { tikhomirov@1: return this.isInvalid; tikhomirov@1: } tikhomirov@1: tikhomirov@1: protected void setInvalid(boolean invalid) { tikhomirov@1: isInvalid = invalid; tikhomirov@1: } tikhomirov@0: tikhomirov@2: public final Changelog getChangelog() { tikhomirov@0: if (this.changelog == null) { tikhomirov@2: // might want delegate to protected createChangelog() some day tikhomirov@9: RevlogStream content = resolve(toStoragePath("00changelog.i", false)); // XXX perhaps, knowledge about filenames should be in LocalHgRepo? tikhomirov@3: this.changelog = new Changelog(this, content); tikhomirov@0: } tikhomirov@0: return this.changelog; tikhomirov@0: } tikhomirov@2: tikhomirov@2: public final HgManifest getManifest() { tikhomirov@2: if (this.manifest == null) { tikhomirov@13: RevlogStream content = resolve(toStoragePath("00manifest.i", false)); tikhomirov@13: this.manifest = new HgManifest(this, content); tikhomirov@2: } tikhomirov@2: return this.manifest; tikhomirov@2: } tikhomirov@2: tikhomirov@2: public abstract HgDataFile getFileNode(String path); tikhomirov@1: tikhomirov@1: public abstract String getLocation(); tikhomirov@2: tikhomirov@2: tikhomirov@9: protected abstract String toStoragePath(String path, boolean isData); tikhomirov@9: tikhomirov@2: /** tikhomirov@2: * Perhaps, should be separate interface, like ContentLookup tikhomirov@2: */ tikhomirov@9: protected abstract RevlogStream resolve(String repositoryPath); tikhomirov@18: tikhomirov@18: public abstract void status(int rev1, int rev2 /*WorkingDir - TIP, TIP?*/, StatusInspector inspector); tikhomirov@18: tikhomirov@18: public interface StatusInspector { tikhomirov@18: void modified(String fname); tikhomirov@18: void added(String fname); tikhomirov@18: void copied(String fnameOrigin, String fnameAdded); // if copied files of no interest, should delegate to self.added(fnameAdded); tikhomirov@18: void removed(String fname); tikhomirov@18: void clean(String fname); tikhomirov@18: void missing(String fname); tikhomirov@18: void unknown(String fname); // not tracked tikhomirov@18: void ignored(String fname); tikhomirov@18: } tikhomirov@0: }